From 892c708693f3d23c7398371184c35090777a1e55 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 4 Jun 2019 19:44:27 -0700 Subject: [PATCH 01/76] beta 1 commit --- pom.xml | 13 +- src/main/java/com/xero/api/ApiClient.java | 26 +- src/main/java/com/xero/api/Config.java | 83 - .../xero/api/ConfigBasedSignerFactory.java | 22 - .../java/com/xero/api/HmacSignerFactory.java | 20 - src/main/java/com/xero/api/JsonConfig.java | 414 - .../java/com/xero/api/OAuthAccessToken.java | 248 - .../com/xero/api/OAuthAuthorizeToken.java | 22 - .../com/xero/api/OAuthGetTemporaryToken.java | 122 - .../java/com/xero/api/OAuthParameters.java | 347 - .../com/xero/api/OAuthRequestResource.java | 457 - .../java/com/xero/api/OAuthRequestToken.java | 74 - .../java/com/xero/api/RFC3339DateFormat.java | 6 +- .../java/com/xero/api/RsaSignerFactory.java | 68 - src/main/java/com/xero/api/SignerFactory.java | 7 - src/main/java/com/xero/api/StringUtil.java | 18 +- src/main/java/com/xero/api/XeroApi20.java | 34 + .../java/com/xero/api/XeroApiException.java | 90 - src/main/java/com/xero/api/XeroClient.java | 1970 -- .../com/xero/api/XeroClientException.java | 34 - .../java/com/xero/api/XeroHttpContext.java | 124 - .../com/xero/api/client/AccountingApi.java | 22610 ++++++++++++---- .../java/com/xero/api/client/AssetApi.java | 417 - .../com/xero/api/client/BankFeedsApi.java | 455 - .../java/com/xero/api/client/FilesApi.java | 823 - .../api/exception/XeroExceptionHandler.java | 237 - .../com/xero/api/jaxb/XeroJAXBMarshaller.java | 56 - .../com/xero/example/CallbackServlet.java | 53 - .../com/xero/example/CustomJsonConfig.java | 173 - .../xero/example/RequestResourceServlet.java | 2773 -- .../com/xero/example/RequestTokenServlet.java | 58 +- .../java/com/xero/example/SampleData.java | 811 - .../com/xero/models/accounting/Account.java | 33 +- .../xero/models/accounting/AccountType.java | 8 +- .../com/xero/models/accounting/Accounts.java | 5 +- .../models/accounting/AccountsPayable.java | 3 +- .../models/accounting/AccountsReceivable.java | 3 +- .../com/xero/models/accounting/Address.java | 9 +- .../xero/models/accounting/Allocation.java | 3 +- .../xero/models/accounting/Allocations.java | 5 +- .../xero/models/accounting/Attachment.java | 3 +- .../xero/models/accounting/Attachments.java | 5 +- .../com/xero/models/accounting/Balances.java | 3 +- .../models/accounting/BankTransaction.java | 21 +- .../models/accounting/BankTransactions.java | 5 +- .../xero/models/accounting/BankTransfer.java | 5 +- .../xero/models/accounting/BankTransfers.java | 5 +- .../xero/models/accounting/BatchPayment.java | 5 +- .../accounting/BatchPaymentDetails.java | 3 +- .../xero/models/accounting/BatchPayments.java | 5 +- .../java/com/xero/models/accounting/Bill.java | 5 +- .../xero/models/accounting/BrandingTheme.java | 3 +- .../models/accounting/BrandingThemes.java | 5 +- .../xero/models/accounting/CISOrgSetting.java | 3 +- .../xero/models/accounting/CISSetting.java | 3 +- .../xero/models/accounting/CISSettings.java | 5 +- .../com/xero/models/accounting/Contact.java | 27 +- .../xero/models/accounting/ContactGroup.java | 11 +- .../xero/models/accounting/ContactGroups.java | 5 +- .../xero/models/accounting/ContactPerson.java | 3 +- .../com/xero/models/accounting/Contacts.java | 5 +- .../xero/models/accounting/CountryCode.java | 8 +- .../xero/models/accounting/CreditNote.java | 27 +- .../xero/models/accounting/CreditNotes.java | 5 +- .../xero/models/accounting/Currencies.java | 5 +- .../com/xero/models/accounting/Currency.java | 5 +- .../xero/models/accounting/CurrencyCode.java | 8 +- .../com/xero/models/accounting/Element.java | 5 +- .../com/xero/models/accounting/Employee.java | 9 +- .../com/xero/models/accounting/Employees.java | 5 +- .../com/xero/models/accounting/Error.java | 5 +- .../xero/models/accounting/ExpenseClaim.java | 13 +- .../xero/models/accounting/ExpenseClaims.java | 5 +- .../xero/models/accounting/ExternalLink.java | 9 +- .../xero/models/accounting/HistoryRecord.java | 3 +- .../models/accounting/HistoryRecords.java | 5 +- .../com/xero/models/accounting/Invoice.java | 31 +- .../models/accounting/InvoiceReminder.java | 3 +- .../models/accounting/InvoiceReminders.java | 5 +- .../com/xero/models/accounting/Invoices.java | 5 +- .../java/com/xero/models/accounting/Item.java | 5 +- .../com/xero/models/accounting/Items.java | 5 +- .../com/xero/models/accounting/Journal.java | 11 +- .../xero/models/accounting/JournalLine.java | 7 +- .../com/xero/models/accounting/Journals.java | 5 +- .../models/accounting/LineAmountTypes.java | 8 +- .../com/xero/models/accounting/LineItem.java | 5 +- .../models/accounting/LineItemTracking.java | 3 +- .../models/accounting/LinkedTransaction.java | 23 +- .../models/accounting/LinkedTransactions.java | 5 +- .../xero/models/accounting/ManualJournal.java | 17 +- .../models/accounting/ManualJournalLine.java | 7 +- .../models/accounting/ManualJournals.java | 5 +- .../xero/models/accounting/OnlineInvoice.java | 3 +- .../models/accounting/OnlineInvoices.java | 5 +- .../xero/models/accounting/Organisation.java | 57 +- .../xero/models/accounting/Organisations.java | 5 +- .../xero/models/accounting/Overpayment.java | 27 +- .../xero/models/accounting/Overpayments.java | 5 +- .../com/xero/models/accounting/Payment.java | 17 +- .../models/accounting/PaymentService.java | 5 +- .../models/accounting/PaymentServices.java | 5 +- .../xero/models/accounting/PaymentTerm.java | 3 +- .../models/accounting/PaymentTermType.java | 8 +- .../com/xero/models/accounting/Payments.java | 5 +- .../com/xero/models/accounting/Phone.java | 9 +- .../xero/models/accounting/Prepayment.java | 25 +- .../xero/models/accounting/Prepayments.java | 5 +- .../com/xero/models/accounting/Purchase.java | 3 +- .../xero/models/accounting/PurchaseOrder.java | 19 +- .../models/accounting/PurchaseOrders.java | 5 +- .../com/xero/models/accounting/Receipt.java | 15 +- .../com/xero/models/accounting/Receipts.java | 5 +- .../models/accounting/RepeatingInvoice.java | 23 +- .../models/accounting/RepeatingInvoices.java | 5 +- .../com/xero/models/accounting/Report.java | 11 +- .../models/accounting/ReportAttribute.java | 3 +- .../xero/models/accounting/ReportCell.java | 5 +- .../xero/models/accounting/ReportFields.java | 3 +- .../com/xero/models/accounting/ReportRow.java | 7 +- .../xero/models/accounting/ReportRows.java | 9 +- .../xero/models/accounting/ReportWithRow.java | 9 +- .../models/accounting/ReportWithRows.java | 5 +- .../com/xero/models/accounting/Reports.java | 5 +- .../xero/models/accounting/RequestEmpty.java | 3 +- .../com/xero/models/accounting/RowType.java | 8 +- .../com/xero/models/accounting/Schedule.java | 15 +- .../xero/models/accounting/TaxComponent.java | 3 +- .../com/xero/models/accounting/TaxRate.java | 17 +- .../com/xero/models/accounting/TaxRates.java | 5 +- .../com/xero/models/accounting/TaxType.java | 8 +- .../accounting/TenNinteyNineContact.java | 3 +- .../com/xero/models/accounting/TimeZone.java | 8 +- .../models/accounting/TrackingCategories.java | 5 +- .../models/accounting/TrackingCategory.java | 11 +- .../models/accounting/TrackingOption.java | 9 +- .../models/accounting/TrackingOptions.java | 5 +- .../java/com/xero/models/accounting/User.java | 9 +- .../com/xero/models/accounting/Users.java | 5 +- .../models/accounting/ValidationError.java | 3 +- src/test/.gitignore | 1 - .../java/com/xero/api/XeroClientTest.java | 28 - .../api/client/AccountingApiAccountsTest.java | 185 - .../AccountingApiBankTransactionTest.java | 224 - .../client/AccountingApiBankTransferTest.java | 198 - .../client/AccountingApiBatchPaymentTest.java | 146 - .../AccountingApiBrandingThemeTest.java | 153 - .../client/AccountingApiContactGroupTest.java | 166 - .../api/client/AccountingApiContactsTest.java | 293 - .../client/AccountingApiCreditNotesTest.java | 316 - .../client/AccountingApiEmployeesTest.java | 150 - .../AccountingApiExpenseClaimsTest.java | 221 - .../api/client/AccountingApiInvoicesTest.java | 368 - .../api/client/AccountingApiItemsTest.java | 200 - .../api/client/AccountingApiJournalsTest.java | 163 - .../AccountingApiLinkedTransactionsTest.java | 167 - .../AccountingApiManualJournalsTest.java | 252 - .../AccountingApiOrganisationsTest.java | 122 - .../client/AccountingApiOverpaymentsTest.java | 191 - .../AccountingApiPaymentServicesTest.java | 110 - .../api/client/AccountingApiPaymentsTest.java | 201 - .../client/AccountingApiPrepaymentsTest.java | 191 - .../AccountingApiPurchaseOrdersTest.java | 274 - .../api/client/AccountingApiReceiptsTest.java | 264 - .../AccountingApiRepeatingInvoicesTest.java | 240 - .../api/client/AccountingApiReportsTest.java | 395 - .../api/client/AccountingApiTaxRatesTest.java | 157 - .../AccountingApiTrackingCategoriesTest.java | 166 - .../api/client/AccountingApiUsersTest.java | 116 - .../exception/XeroExceptionHandlerTest.java | 216 - .../com/xero/api/tests/XeroClientTests.java | 43 - .../org.mockito.plugins.MockMaker | 1 - 172 files changed, 18303 insertions(+), 21184 deletions(-) delete mode 100755 src/main/java/com/xero/api/Config.java delete mode 100644 src/main/java/com/xero/api/ConfigBasedSignerFactory.java delete mode 100644 src/main/java/com/xero/api/HmacSignerFactory.java delete mode 100644 src/main/java/com/xero/api/JsonConfig.java delete mode 100644 src/main/java/com/xero/api/OAuthAccessToken.java delete mode 100644 src/main/java/com/xero/api/OAuthAuthorizeToken.java delete mode 100644 src/main/java/com/xero/api/OAuthGetTemporaryToken.java delete mode 100644 src/main/java/com/xero/api/OAuthParameters.java delete mode 100644 src/main/java/com/xero/api/OAuthRequestResource.java delete mode 100644 src/main/java/com/xero/api/OAuthRequestToken.java delete mode 100755 src/main/java/com/xero/api/RsaSignerFactory.java delete mode 100644 src/main/java/com/xero/api/SignerFactory.java create mode 100644 src/main/java/com/xero/api/XeroApi20.java delete mode 100644 src/main/java/com/xero/api/XeroApiException.java delete mode 100644 src/main/java/com/xero/api/XeroClient.java delete mode 100644 src/main/java/com/xero/api/XeroClientException.java delete mode 100644 src/main/java/com/xero/api/XeroHttpContext.java delete mode 100644 src/main/java/com/xero/api/client/AssetApi.java delete mode 100644 src/main/java/com/xero/api/client/BankFeedsApi.java delete mode 100644 src/main/java/com/xero/api/client/FilesApi.java delete mode 100644 src/main/java/com/xero/api/exception/XeroExceptionHandler.java delete mode 100644 src/main/java/com/xero/api/jaxb/XeroJAXBMarshaller.java delete mode 100755 src/main/java/com/xero/example/CallbackServlet.java delete mode 100644 src/main/java/com/xero/example/CustomJsonConfig.java delete mode 100755 src/main/java/com/xero/example/RequestResourceServlet.java delete mode 100755 src/main/java/com/xero/example/SampleData.java delete mode 100644 src/test/.gitignore delete mode 100644 src/test/java/com/xero/api/XeroClientTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiAccountsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiContactsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiItemsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiJournalsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiReportsTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java delete mode 100644 src/test/java/com/xero/api/client/AccountingApiUsersTest.java delete mode 100644 src/test/java/com/xero/api/exception/XeroExceptionHandlerTest.java delete mode 100644 src/test/java/com/xero/api/tests/XeroClientTests.java delete mode 100644 src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker diff --git a/pom.xml b/pom.xml index a9bbf690..9ee63251 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.xeroapi xero-java jar - 2.3.8 + 3.0.0-beta-1 Xero-Java SDK This is the official Java SDK for Xero API https://github.com/XeroAPI/Xero-Java @@ -38,16 +38,16 @@ http://github.com/XeroAPI/Xero-Java/tree/master - - com.github.xeroapi - xeroapi-schemas - 1.0.0 - com.google.api-client google-api-client ${google-api-client-version} + + com.github.scribejava + scribejava-apis + 6.6.2 + com.googlecode.json-simple json-simple @@ -224,6 +224,7 @@ + org.apache.maven.plugins maven-javadoc-plugin diff --git a/src/main/java/com/xero/api/ApiClient.java b/src/main/java/com/xero/api/ApiClient.java index 75e9dd00..96cbed0d 100644 --- a/src/main/java/com/xero/api/ApiClient.java +++ b/src/main/java/com/xero/api/ApiClient.java @@ -1,5 +1,6 @@ package com.xero.api; +import com.xero.api.client.*; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -12,26 +13,26 @@ import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.Json; - import java.io.IOException; import java.io.OutputStream; + public class ApiClient { private final String basePath; private final HttpRequestFactory httpRequestFactory; private final ObjectMapper objectMapper; - private static final String defaultBasePath = "https://virtserver.swaggerhub.com/SidneyAllen/assets-api/1.0.0"; + private static final String defaultBasePath = "https://api.xero.com/api.xro/2.0"; // A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults. private static ObjectMapper createDefaultObjectMapper() { - ObjectMapper objectMapper = new ObjectMapper() - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) - .setDateFormat(new RFC3339DateFormat()) - .setSerializationInclusion(Include.NON_NULL); - objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); - + ObjectMapper objectMapper = new ObjectMapper() + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .setDateFormat(new RFC3339DateFormat()) + .setSerializationInclusion(Include.NON_NULL); + objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); + ThreeTenModule module = new ThreeTenModule(); module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); @@ -85,10 +86,9 @@ public void writeTo(OutputStream out) throws IOException { } // Builder pattern to get API instances for this client. - /* - public ClientApi clientApi() { - return new ClientApi(this); + + public AccountingApi accountingApi() { + return new AccountingApi(this); } - */ } diff --git a/src/main/java/com/xero/api/Config.java b/src/main/java/com/xero/api/Config.java deleted file mode 100755 index c6b6e54f..00000000 --- a/src/main/java/com/xero/api/Config.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.xero.api; - - -public interface Config { - - String getAppType(); - - String getPrivateKeyPassword(); - - String getPathToPrivateKey(); - - String getConsumerKey(); - - String getConsumerSecret(); - - String getApiUrl(); - - String getFilesUrl(); - - String getAssetsUrl(); - - String getBankFeedsUrl(); - - String getRequestTokenUrl(); - - String getAuthorizeUrl(); - - String getAccessTokenUrl(); - - String getUserAgent(); - - String getAccept(); - - String getRedirectUri(); - - String getProxyHost(); - - long getProxyPort(); - - boolean getProxyHttpsEnabled(); - - int getConnectTimeout(); - - int getReadTimeout(); - - String getDecimalPlaces(); - - String getAppFirewallHostname(); - - String getAppFirewallUrlPrefix(); - - String getKeyStorePath(); - - String getKeyStorePassword(); - - boolean isUsingAppFirewall(); - - // SETTERS - - void setConsumerKey(String consumerKey); - - void setConsumerSecret(String consumerSecret); - - void setAppType(String appType); - - void setAuthCallBackUrl(String authCallbackUrl); - - void setConnectTimeout(int connectTimeout); - - void setReadTimeout(int readTimeout); - - void setDecimalPlaces(String decimalPlaces); - - void setUsingAppFirewall(boolean usingAppFirewall); - - void setAppFirewallHostname(String appFirewallHostname); - - void setAppFirewallUrlPrefix(String appFirewallUrlPrefix); - - void setKeyStorePath(String keyStorePath); - - void setKeyStorePassword(String keyStorePassword); -} diff --git a/src/main/java/com/xero/api/ConfigBasedSignerFactory.java b/src/main/java/com/xero/api/ConfigBasedSignerFactory.java deleted file mode 100644 index 794e4794..00000000 --- a/src/main/java/com/xero/api/ConfigBasedSignerFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.xero.api; - -import com.google.api.client.auth.oauth.OAuthSigner; - -public class ConfigBasedSignerFactory implements SignerFactory { - private static final String PUBLIC_APP = "PUBLIC"; - private Config config; - - public ConfigBasedSignerFactory(Config config) { - this.config = config; - } - - @Override - public OAuthSigner createSigner(String tokenSharedSecret) { - if (config.getAppType().equals(PUBLIC_APP)) { - return new HmacSignerFactory(config.getConsumerSecret()).createSigner(tokenSharedSecret); - } else { - return new RsaSignerFactory(config.getPathToPrivateKey(), config.getPrivateKeyPassword()).createSigner( - tokenSharedSecret); - } - } -} diff --git a/src/main/java/com/xero/api/HmacSignerFactory.java b/src/main/java/com/xero/api/HmacSignerFactory.java deleted file mode 100644 index 6de61b1c..00000000 --- a/src/main/java/com/xero/api/HmacSignerFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.xero.api; - -import com.google.api.client.auth.oauth.OAuthHmacSigner; - -public class HmacSignerFactory implements SignerFactory { - - private String consumerSecret; - - public HmacSignerFactory(String consumerSecret) { - this.consumerSecret = consumerSecret; - } - - @Override - public OAuthHmacSigner createSigner(String tokenSecret) { - OAuthHmacSigner signer = new OAuthHmacSigner(); - signer.tokenSharedSecret = tokenSecret; - signer.clientSharedSecret = consumerSecret; - return signer; - } -} diff --git a/src/main/java/com/xero/api/JsonConfig.java b/src/main/java/com/xero/api/JsonConfig.java deleted file mode 100644 index 5a4a9ddf..00000000 --- a/src/main/java/com/xero/api/JsonConfig.java +++ /dev/null @@ -1,414 +0,0 @@ -package com.xero.api; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import static java.lang.String.format; - -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; - -public class JsonConfig implements Config { - - private String SDK_VERSION = "2.3.8"; - private String APP_TYPE = "Public"; - private String USER_AGENT = "Xero-Java-SDK"; - private String ACCEPT = "application/xml"; - private String CONSUMER_KEY; - private String CONSUMER_SECRET; - private String API_BASE_URL = "https://api.xero.com"; - private String API_ENDPOINT_URL = "https://api.xero.com/api.xro/2.0/"; - private String FILES_ENDPOINT_URL = "https://api.xero.com/files.xro/1.0/"; - private String ASSETS_ENDPOINT_URL = "https://api.xero.com/assets.xro/1.0"; - private String BANKFEEDS_ENDPOINT_URL = "https://api.xero.com/bankfeeds.xro/1.0"; - private String REQUEST_TOKEN_URL = "https://api.xero.com/oauth/RequestToken"; - private String AUTHENTICATE_URL = "https://api.xero.com/oauth/Authorize"; - private String ACCESS_TOKEN_URL = "https://api.xero.com/oauth/AccessToken"; - private String API_ENDPOINT_STEM = "/api.xro/2.0/"; - private String FILES_ENDPOINT_STEM = "/files.xro/1.0/"; - private String ASSETS_ENDPOINT_STEM = "/assets.xro/1.0/"; - private String BANKFEEDS_ENDPOINT_STEM = "/bankfeeds.xro/1.0/"; - private String REQUEST_TOKEN_STEM = "/oauth/RequestToken"; - private String AUTHENTICATE_STEM = "/oauth/Authorize"; - private String ACCESS_TOKEN_STEM = "/oauth/AccessToken"; - - private String CALLBACK_BASE_URL; - private String AUTH_CALLBACK_URL; - private String PATH_TO_PRIVATE_KEY_CERT; - private String PRIVATE_KEY_PASSWORD; - private String PROXY_HOST; - private long PROXY_PORT = 80; - private boolean PROXY_HTTPS_ENABLED = false; - private int CONNECT_TIMEOUT = 60; - private int READ_TIMEOUT = 60; - private String DECIMAL_PLACES = null; - private boolean USING_APP_FIREWALL = false; - private String APP_FIREWALL_HOSTNAME; - private String APP_FIREWALL_URL_PREFIX; - private String KEY_STORE_PATH; - private String KEY_STORE_PASSWORD; - private String configFile; - private static Config instance = null; - final static Logger logger = LogManager.getLogger(JsonConfig.class); - - public JsonConfig(String configFile) { - this.configFile = configFile; - - load(); - } - - /* Static 'instance' method */ - public static Config getInstance() { - if (instance == null) { - instance = new JsonConfig("config.json"); - } - return instance; - } - - @Override - public String getAppType() { - return APP_TYPE; - } - - @Override - public String getPrivateKeyPassword() { - return PRIVATE_KEY_PASSWORD; - } - - @Override - public String getPathToPrivateKey() { - return PATH_TO_PRIVATE_KEY_CERT; - } - - @Override - public String getConsumerKey() { - return CONSUMER_KEY; - } - - @Override - public String getConsumerSecret() { - return CONSUMER_SECRET; - } - - @Override - public String getApiUrl() { - return API_ENDPOINT_URL; - } - - @Override - public String getFilesUrl() { - return FILES_ENDPOINT_URL; - } - - @Override - public String getAssetsUrl() { - return ASSETS_ENDPOINT_URL; - } - - @Override - public String getBankFeedsUrl() { - return BANKFEEDS_ENDPOINT_URL; - } - - @Override - public String getRequestTokenUrl() { - return REQUEST_TOKEN_URL; - } - - @Override - public String getAuthorizeUrl() { - return AUTHENTICATE_URL; - } - - @Override - public String getAccessTokenUrl() { - return ACCESS_TOKEN_URL; - } - - @Override - public String getUserAgent() { - return USER_AGENT + " " + CONSUMER_KEY + " [Xero-Java-" + SDK_VERSION + "]"; - } - - @Override - public String getAccept() { - return ACCEPT; - } - - @Override - public String getRedirectUri() { - return AUTH_CALLBACK_URL; - } - - @Override - public String getProxyHost() { - return PROXY_HOST; - } - - @Override - public long getProxyPort() { - return PROXY_PORT; - } - - @Override - public boolean getProxyHttpsEnabled() { - return PROXY_HTTPS_ENABLED; - } - - @Override - public int getConnectTimeout() { - // in seconds - return CONNECT_TIMEOUT; - } - - @Override - public int getReadTimeout() { - // in seconds - return READ_TIMEOUT; - } - - @Override - public String getDecimalPlaces(){ - // 2 or 4 - return DECIMAL_PLACES; - } - - @Override - public boolean isUsingAppFirewall() { - return USING_APP_FIREWALL; - } - - @Override - public String getAppFirewallHostname() { - return APP_FIREWALL_HOSTNAME; - } - - @Override - public String getAppFirewallUrlPrefix() { - return APP_FIREWALL_URL_PREFIX; - } - - @Override - public String getKeyStorePath() { - return KEY_STORE_PATH; - } - - @Override - public String getKeyStorePassword() { - return KEY_STORE_PASSWORD; - } - -// SETTERS - - @Override - public void setConsumerKey(String consumerKey) { - CONSUMER_KEY = consumerKey; - } - - @Override - public void setConsumerSecret(String consumerSecret) { - CONSUMER_SECRET = consumerSecret; - } - - @Override - public void setAppType(String appType) { - APP_TYPE = appType; - } - - @Override - public void setAuthCallBackUrl(String authCallbackUrl) { - AUTH_CALLBACK_URL = authCallbackUrl; - } - - @Override - public void setConnectTimeout(int connectTimeout) { - // in seconds - CONNECT_TIMEOUT = connectTimeout; - } - - @Override - public void setReadTimeout(int readTimeout) { - // in seconds - READ_TIMEOUT = readTimeout; - } - - @Override - public void setDecimalPlaces(String decimalPlaces) { - // 2 or 4 - DECIMAL_PLACES = decimalPlaces; - } - - @Override - public void setUsingAppFirewall(boolean usingAppFirewall) { - this.USING_APP_FIREWALL = usingAppFirewall; - } - - @Override - public void setAppFirewallHostname(String appFirewallHostname) { - this.APP_FIREWALL_HOSTNAME = appFirewallHostname; - } - - @Override - public void setAppFirewallUrlPrefix(String appFirewallUrlPrefix) { - this.APP_FIREWALL_URL_PREFIX = appFirewallUrlPrefix; - } - - @Override - public void setKeyStorePath(String keyStorePath) { - this.KEY_STORE_PATH = keyStorePath; - } - - @Override - public void setKeyStorePassword(String keyStorePassword) { - this.KEY_STORE_PASSWORD = keyStorePassword; - } - - private void load() { - InputStream inputStream = JsonConfig.class.getResourceAsStream("/" + configFile); - - if (inputStream == null) { - logger.error(format("Config file '%s' could not be found in src/resources folder. Missing file?", configFile)); - throw new XeroClientException(format("Config file '%s' could not be opened. Missing file?", configFile)); - } else { - JSONObject jsonObject; - try(InputStreamReader reader = new InputStreamReader(inputStream)) { - JSONParser parser = new JSONParser(); - jsonObject = (JSONObject) parser.parse(reader); - } catch (FileNotFoundException e) { - logger.error(e); - throw new XeroClientException(format("Config file '%s' not found", configFile), e); - } catch (IOException e) { - logger.error(e); - throw new XeroClientException(format("IO error reading config file '%s' not found", configFile), e); - } catch (ParseException e) { - logger.error(e); - throw new XeroClientException(format("Parse error reading config file '%s' not found", configFile), e); - } - - if (jsonObject.containsKey("AppType")) { - APP_TYPE = (String) jsonObject.get("AppType"); - } - - if (jsonObject.containsKey("UserAgent")) { - USER_AGENT = (String) jsonObject.get("UserAgent"); - } - - if (jsonObject.containsKey("Accept")) { - ACCEPT = (String) jsonObject.get("Accept"); - } - - if (jsonObject.containsKey("ConsumerKey")) { - CONSUMER_KEY = (String) jsonObject.get("ConsumerKey"); - } - - if (jsonObject.containsKey("ConsumerSecret")) { - CONSUMER_SECRET = (String) jsonObject.get("ConsumerSecret"); - } - - if (jsonObject.containsKey("ApiBaseUrl")) { - API_BASE_URL = (String) jsonObject.get("ApiBaseUrl"); - if (jsonObject.containsKey("ApiEndpointPath")) { - String endpointPath = (String) jsonObject.get("ApiEndpointPath"); - API_ENDPOINT_URL = API_BASE_URL + endpointPath; - } else { - API_ENDPOINT_URL = API_BASE_URL + API_ENDPOINT_STEM; - } - - if (jsonObject.containsKey("FilesEndpointPath")) { - String filesEndpointPath = (String) jsonObject.get("FilesEndpointPath"); - FILES_ENDPOINT_URL = API_BASE_URL + filesEndpointPath; - } else { - FILES_ENDPOINT_URL = API_BASE_URL + FILES_ENDPOINT_STEM; - } - - if (jsonObject.containsKey("AssetsEndpointPath")) { - String assetsEndpointPath = (String) jsonObject.get("AssetsEndpointPath"); - ASSETS_ENDPOINT_URL = API_BASE_URL + assetsEndpointPath; - } else { - ASSETS_ENDPOINT_URL = API_BASE_URL + ASSETS_ENDPOINT_STEM; - } - - if (jsonObject.containsKey("BankFeedsEndpointPath")) { - String BankFeedsEndpointPath = (String) jsonObject.get("BankFeedsEndpointPath"); - BANKFEEDS_ENDPOINT_URL = API_BASE_URL + BankFeedsEndpointPath; - } else { - BANKFEEDS_ENDPOINT_URL = API_BASE_URL + BANKFEEDS_ENDPOINT_STEM; - } - - if (jsonObject.containsKey("RequestTokenPath")) { - String requestPath = (String) jsonObject.get("RequestTokenPath"); - REQUEST_TOKEN_URL = API_BASE_URL + requestPath; - } else { - REQUEST_TOKEN_URL = API_BASE_URL + REQUEST_TOKEN_STEM; - } - - if (jsonObject.containsKey("AccessTokenPath")) { - String accessPath = (String) jsonObject.get("AccessTokenPath"); - ACCESS_TOKEN_URL = API_BASE_URL + accessPath; - } else { - ACCESS_TOKEN_URL = API_BASE_URL + ACCESS_TOKEN_STEM; - } - - if (jsonObject.containsKey("AuthenticateUrl")) { - String authenticatePath = (String) jsonObject.get("AuthenticateUrl"); - AUTHENTICATE_URL = API_BASE_URL + authenticatePath; - } else { - AUTHENTICATE_URL = API_BASE_URL + AUTHENTICATE_STEM; - } - } - - if (jsonObject.containsKey("CallbackBaseUrl")) { - CALLBACK_BASE_URL = (String) jsonObject.get("CallbackBaseUrl"); - if (jsonObject.containsKey("CallbackPath")) { - String callbackPath = (String) jsonObject.get("CallbackPath"); - AUTH_CALLBACK_URL = CALLBACK_BASE_URL + callbackPath; - } - } - - if (jsonObject.containsKey("PrivateKeyCert")) { - PATH_TO_PRIVATE_KEY_CERT = (String) jsonObject.get("PrivateKeyCert"); - PRIVATE_KEY_PASSWORD = (String) jsonObject.get("PrivateKeyPassword"); - } - - if (jsonObject.containsKey("ProxyHost")) { - PROXY_HOST = (String) jsonObject.get("ProxyHost"); - if (jsonObject.containsKey("ProxyPort")) { - PROXY_PORT = (long) jsonObject.get("ProxyPort"); - } - - if (jsonObject.containsKey("ProxyHttpsEnabled")) { - PROXY_HTTPS_ENABLED = (boolean) jsonObject.get("ProxyHttpsEnabled"); - } - } - - if (jsonObject.containsKey("DecimalPlaces")) { - DECIMAL_PLACES = (String) jsonObject.get("DecimalPlaces"); - } - - if (jsonObject.containsKey("KeyStorePath")) { - KEY_STORE_PATH = (String) jsonObject.get("KeyStorePath"); - } - - if (jsonObject.containsKey("KeyStorePassword")) { - KEY_STORE_PASSWORD = (String) jsonObject.get("KeyStorePassword"); - } - - if (jsonObject.containsKey("usingAppFirewall")) { - USING_APP_FIREWALL = (boolean) jsonObject.get("usingAppFirewall"); - - if (jsonObject.containsKey("appFirewallHostname")) { - APP_FIREWALL_HOSTNAME = (String) jsonObject.get("appFirewallHostname"); - } - - if (jsonObject.containsKey("appFirewallUrlPrefix")) { - APP_FIREWALL_URL_PREFIX = (String) jsonObject.get("appFirewallUrlPrefix"); - } - } - } - } -} diff --git a/src/main/java/com/xero/api/OAuthAccessToken.java b/src/main/java/com/xero/api/OAuthAccessToken.java deleted file mode 100644 index 39405147..00000000 --- a/src/main/java/com/xero/api/OAuthAccessToken.java +++ /dev/null @@ -1,248 +0,0 @@ -package com.xero.api; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -import com.google.api.client.auth.oauth.OAuthCredentialsResponse; -import com.google.api.client.auth.oauth.OAuthSigner; -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.UrlEncodedParser; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpHost; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.util.EntityUtils; - -public class OAuthAccessToken { - - private String token = null; - private String tokenSecret = null; - private String sessionHandle = null; - private long tokenTimestamp; - private boolean isSuccess; - private String problem = null; - private String advice = null; - private Config config; - private SignerFactory signerFactory; - private CloseableHttpClient httpclient; - public String verifier; - public String tempToken; - private String tempTokenSecret; - private int connectTimeout = 20; - private int readTimeout = 20; - private GenericUrl requestUrl; - private HttpGet httpget; - - public OAuthAccessToken(Config config) { - this(config, new ConfigBasedSignerFactory(config)); - } - - public OAuthAccessToken(Config config, SignerFactory signerFactory) { - this.config = config; - this.signerFactory = signerFactory; - } - - public OAuthAccessToken build(String verifier, String tempToken, String tempTokenSecret) throws IOException { - this.verifier = verifier; - this.tempToken = tempToken; - this.tempTokenSecret = tempTokenSecret; - this.connectTimeout = config.getConnectTimeout() * 1000; - this.readTimeout = config.getReadTimeout() * 1000; - - httpclient = new XeroHttpContext(config).getHttpClient(); - - requestUrl = new GenericUrl(this.config.getAccessTokenUrl()); - httpget = new HttpGet(this.config.getAccessTokenUrl()); - - this.createParameters().intercept(httpget,requestUrl); - - return this; - } - - public OAuthAccessToken build() throws IOException { - this.connectTimeout = config.getConnectTimeout() * 1000; - this.readTimeout = config.getReadTimeout() * 1000; - httpclient = new XeroHttpContext(config).getHttpClient(); - - requestUrl = new GenericUrl(this.config.getAccessTokenUrl()); - httpget = new HttpGet(this.config.getAccessTokenUrl()); - - this.createRefreshParameters().intercept(httpget,requestUrl); - - return this; - } - - public boolean execute() throws IOException { - - RequestConfig.Builder requestConfig = RequestConfig.custom() - .setConnectTimeout(connectTimeout) - .setConnectionRequestTimeout(readTimeout) - .setSocketTimeout(connectTimeout); - - //Proxy Service Setup - unable to fully test as we don't have a proxy - // server to test against. - if(!"".equals(config.getProxyHost()) && config.getProxyHost() != null) { - int port = (int) (config.getProxyPort() == 80 && config.getProxyHttpsEnabled() ? 443 : config.getProxyPort()); - HttpHost proxy = new HttpHost(config.getProxyHost(), port, config.getProxyHttpsEnabled() ? "https" : "http"); - requestConfig.setProxy(proxy); - } - - httpget.setConfig(requestConfig.build()); - - try { - CloseableHttpResponse response = httpclient.execute(httpget); - try { - HttpEntity entity = response.getEntity(); - String retSrc = EntityUtils.toString(entity); - - OAuthCredentialsResponse oauthResponse = new OAuthCredentialsResponse(); - UrlEncodedParser.parse(retSrc, oauthResponse); - - if ((oauthResponse.token == null || oauthResponse.token.length() == 0) && (config.getKeyStorePassword() == null || config.getKeyStorePassword().length() == 0)) - { - Map oauthError = getQueryMap(retSrc); - this.problem = oauthError.get("oauth_problem"); - this.advice = oauthError.get("oauth_problem_advice"); - isSuccess = false; - } else { - Map oauthKeys = getQueryMap(retSrc); - this.token = oauthKeys.get("oauth_token"); - this.tokenSecret = oauthKeys.get("oauth_token_secret"); - this.sessionHandle = oauthKeys.get("oauth_session_handle"); - this.tokenTimestamp = System.currentTimeMillis() / 1000l; - isSuccess = true; - } - - EntityUtils.consume(entity); - - } finally { - response.close(); - } - - } finally { - httpclient.close(); - } - return isSuccess; - } - - public void setToken(String token) { - this.token = token; - if (config.getAppType().equals("PRIVATE")) { - this.token = config.getConsumerKey(); - } - } - - public String getToken() { - return token; - } - - public void setTokenSecret(String secret) { - this.tokenSecret = secret; - } - - public String getTokenSecret() { - return tokenSecret; - } - - public Boolean isSuccess() { - return isSuccess; - } - - public String getProblem() { - return problem; - } - - public String getAdvice() { - return advice; - } - - public void setSessionHandle(String sessionHandle) { - this.sessionHandle = sessionHandle; - } - - public String getSessionHandle() { - return sessionHandle; - } - - public String getTokenTimestamp() { - String s = Objects.toString(tokenTimestamp, null); - return s; - } - - private static Map getQueryMap(String query) { - String[] params = query.split("&"); - Map map = new HashMap(); - for (String param : params) { - String name = param.split("=")[0]; - String value = param.split("=")[1]; - map.put(name, value); - } - - return map; - } - - public HashMap getAll() { - HashMap map = new HashMap(); - - map.put("token", getToken()); - map.put("tokenSecret", getTokenSecret()); - map.put("sessionHandle", getSessionHandle()); - map.put("tokenTimestamp", getTokenTimestamp()); - - return map; - } - - private OAuthParameters createParameters() { - OAuthSigner signer = signerFactory.createSigner(tempTokenSecret); - - OAuthParameters result = new OAuthParameters(); - result.consumerKey = config.getConsumerKey(); - result.usingAppFirewall = config.isUsingAppFirewall(); - result.appFirewallHostname = config.getAppFirewallHostname(); - result.appFirewallUrlPrefix = config.getAppFirewallUrlPrefix(); - result.token = tempToken; - result.verifier = verifier; - result.signer = signer; - return result; - } - -@SuppressWarnings("unused") -private OAuthParameters createRefreshParameters() { - OAuthSigner signer = signerFactory.createSigner(null); - - OAuthParameters result = new OAuthParameters(); - result.consumerKey = config.getConsumerKey(); - result.usingAppFirewall = config.isUsingAppFirewall(); - result.appFirewallHostname = config.getAppFirewallHostname(); - result.appFirewallUrlPrefix = config.getAppFirewallUrlPrefix(); - result.token = this.token; - result.sessionHandle = this.sessionHandle; - result.signer = signer; - return result; - } - - public boolean isStale(String timestamp) { - boolean bool = false; - - if (timestamp == null || timestamp.isEmpty()) { - bool = false; - } else { - - long currentTime = System.currentTimeMillis() / 1000l; - - long tokenTimestamp = Long.parseLong(timestamp); - long secondsElapsed = (currentTime - tokenTimestamp); - - if (secondsElapsed >= 1800) { - bool = true; - } - } - - return bool; - } -} diff --git a/src/main/java/com/xero/api/OAuthAuthorizeToken.java b/src/main/java/com/xero/api/OAuthAuthorizeToken.java deleted file mode 100644 index 792f9336..00000000 --- a/src/main/java/com/xero/api/OAuthAuthorizeToken.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.xero.api; - -import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl; - -public class OAuthAuthorizeToken { - - private String authUrl = null; - - public OAuthAuthorizeToken(Config c, String tempToken) - { - OAuthAuthorizeTemporaryTokenUrl accessTempToken = new OAuthAuthorizeTemporaryTokenUrl(c.getAuthorizeUrl()); - accessTempToken.temporaryToken = tempToken; - accessTempToken.set("oauth_callback",c.getRedirectUri()); - authUrl = accessTempToken.build(); - } - - public String getAuthUrl() - { - return authUrl; - } - -} diff --git a/src/main/java/com/xero/api/OAuthGetTemporaryToken.java b/src/main/java/com/xero/api/OAuthGetTemporaryToken.java deleted file mode 100644 index 85249809..00000000 --- a/src/main/java/com/xero/api/OAuthGetTemporaryToken.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.xero.api; - -/** - * Replace the google OAuth API Client Class of the same name so that we can use - * our own modified version of OAuthParameters and be able to create a customized - * signature to deal with the L7 Application Firewall - * - * @author John Vogtle - */ - -import com.google.api.client.auth.oauth.OAuthCredentialsResponse; -import com.google.api.client.auth.oauth.OAuthSigner; -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.UrlEncodedParser; - -import java.io.IOException; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpHost; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.util.EntityUtils; - -public class OAuthGetTemporaryToken extends GenericUrl { - - public String callback; - public String consumerKey; - public OAuthSigner signer; - protected boolean usePost; - private boolean usingAppFirewall; - private String appFirewallHostname = ""; - private String appFirewallUrlPrefix = ""; - public Config config; - private CloseableHttpClient httpclient; - private int connectTimeout = 20; - private int readTimeout = 20; - - public OAuthGetTemporaryToken(String authorizationServerUrl) { - super(authorizationServerUrl); - } - - public OAuthGetTemporaryToken(String authorizationServerUrl, - boolean usingAppFirewall, String appFirewallHostname, String appFirewallUrlPrefix) { - super(authorizationServerUrl); - this.usingAppFirewall = usingAppFirewall; - this.appFirewallHostname = appFirewallHostname; - this.appFirewallUrlPrefix = appFirewallUrlPrefix; - } - - public final OAuthCredentialsResponse execute() throws IOException,XeroApiException { - this.connectTimeout = config.getConnectTimeout() * 1000; - this.readTimeout = config.getReadTimeout() * 1000; - - httpclient = new XeroHttpContext(config).getHttpClient(); - GenericUrl requestUrl = new GenericUrl(this.config.getRequestTokenUrl()); - - HttpGet httpget = new HttpGet(this.config.getRequestTokenUrl()); - - RequestConfig.Builder requestConfig = RequestConfig.custom() - .setConnectTimeout(connectTimeout) - .setConnectionRequestTimeout(readTimeout) - .setSocketTimeout(connectTimeout); - - //Proxy Service Setup - unable to fully test as we don't have a proxy - // server to test against. - if(!"".equals(config.getProxyHost()) && config.getProxyHost() != null) { - int port = (int) (config.getProxyPort() == 80 && config.getProxyHttpsEnabled() ? 443 : config.getProxyPort()); - HttpHost proxy = new HttpHost(config.getProxyHost(), port, config.getProxyHttpsEnabled() ? "https" : "http"); - requestConfig.setProxy(proxy); - } - this.createParameters().intercept(httpget,requestUrl); - httpget.setConfig(requestConfig.build()); - - try { - CloseableHttpResponse response = httpclient.execute(httpget); - try { - HttpEntity entity = response.getEntity(); - String content = EntityUtils.toString(entity); - - OAuthCredentialsResponse oauthResponse = new OAuthCredentialsResponse(); - UrlEncodedParser.parse(content, oauthResponse); - - int code = response.getStatusLine().getStatusCode(); - if (oauthResponse.token == null) { - XeroApiException e = new XeroApiException(400,content); - throw e; - } - if (code != 200) { - XeroApiException e = new XeroApiException(code,content); - throw e; - } - - //System.out.println("RequestToken Response: " + retSrc); - EntityUtils.consume(entity); - return oauthResponse; - } finally { - response.close(); - } - } finally { - httpclient.close(); - } - } - - public OAuthParameters createParameters() { - OAuthParameters result = new OAuthParameters(); - result.usingAppFirewall = this.usingAppFirewall; - result.appFirewallHostname = this. appFirewallHostname; - result.appFirewallUrlPrefix = this.appFirewallUrlPrefix; - result.consumerKey = this.consumerKey; - result.signer = this.signer; - result.callback = this.callback; - return result; - } - - public void setConfig(Config config) { - this.config = config; - this.consumerKey = config.getConsumerKey(); - this.callback = config.getRedirectUri(); - } -} \ No newline at end of file diff --git a/src/main/java/com/xero/api/OAuthParameters.java b/src/main/java/com/xero/api/OAuthParameters.java deleted file mode 100644 index 8842c211..00000000 --- a/src/main/java/com/xero/api/OAuthParameters.java +++ /dev/null @@ -1,347 +0,0 @@ -package com.xero.api; - -import com.google.api.client.auth.oauth.OAuthSigner; -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.HttpExecuteInterceptor; -import com.google.api.client.http.HttpRequest; -import com.google.api.client.http.HttpRequestInitializer; -import com.google.api.client.util.escape.PercentEscaper; - -import java.io.IOException; -import java.security.GeneralSecurityException; -import java.security.SecureRandom; -import java.util.Collection; -import java.util.Map; -import java.util.TreeMap; - -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class OAuthParameters implements HttpExecuteInterceptor, HttpRequestInitializer { - final static Logger logger = LogManager.getLogger(OAuthParameters.class); - - public OAuthParameters() { - - } - - /** Secure random number generator to sign requests. */ - private static final SecureRandom RANDOM = new SecureRandom(); - - /** Required OAuth signature algorithm. */ - public OAuthSigner signer; - - /** - * Absolute URI back to which the server will redirect the resource owner when the Resource Owner - * Authorization step is completed. - */ - public String callback; - - /** - * Required identifier portion of the client credentials (equivalent to a username). - */ - public String consumerKey; - - /** Required nonce value. Should be computed using {@link #computeNonce()}. */ - public String nonce; - - /** Realm. */ - public String realm; - - /** Signature. Required but normally computed using {@link #computeSignature}. */ - public String signature; - - /** - * Name of the signature method used by the client to sign the request. Required, but normally - * computed using {@link #computeSignature}. - */ - public String signatureMethod; - - /** - * Required timestamp value. Should be computed using {@link #computeTimestamp()}. - */ - public String timestamp; - - /** - * Token value used to associate the request with the resource owner or {@code null} if the - * request is not associated with a resource owner. - */ - public String token; - - /** - * Session handle. - */ - public String sessionHandle; - - /** The verification code received from the server. */ - public String verifier; - - /** - * Must either be "1.0" or {@code null} to skip. Provides the version of the authentication - * process as defined in this specification. - */ - public String version; - - /** - * A value of true indicates that server is sitting behind and application firewall (e.g. L7) - * Values for hostname and URL's will be adjusted when calculating oauth signatures as the - * application firewall will be changing the request - */ - public boolean usingAppFirewall = false; - - /** - * The hostname used for communicating through the application firewall. If the url hostname - * matches this, the value of "api.xero.com" will be used instead when calculating the oauth - * signature. - */ - public String appFirewallHostname = ""; - private static final String XERO_API_HOST = "api.xero.com"; - - /** - * The prefix the application firewall uses to identify mappings for it's own URL rewriting. - * The value of the prefix will be stripped from the URL when calculating the oauth signature. - */ - public String appFirewallUrlPrefix = ""; - - private static final PercentEscaper ESCAPER = new PercentEscaper("-_.~", false); - - /** - * Computes a nonce based on the hex string of a random non-negative long, setting the value of - * the {@link #nonce} field. - */ - public void computeNonce() { - nonce = Long.toHexString(Math.abs(RANDOM.nextLong())); - } - - /** - * Computes a timestamp based on the current system time, setting the value of the - * {@link #timestamp} field. - */ - public void computeTimestamp() { - timestamp = Long.toString(System.currentTimeMillis() / 1000); - } - - /** - * Computes a new signature based on the fields and the given request method and URL, setting the - * values of the {@link #signature} and {@link #signatureMethod} fields. - * @param requestUrl The full URL including paramters - * @param requestMethod The REST verb GET, PUT, POST, DELETE - * @throws GeneralSecurityException general security exception - */ - public void computeSignature(String requestMethod, GenericUrl requestUrl) - throws GeneralSecurityException - { - OAuthSigner signer = this.signer; - String signatureMethod = this.signatureMethod = signer.getSignatureMethod(); - // oauth_* parameters (except oauth_signature) - TreeMap parameters = new TreeMap(); - putParameterIfValueNotNull(parameters, "oauth_callback", callback); - putParameterIfValueNotNull(parameters, "oauth_consumer_key", consumerKey); - putParameterIfValueNotNull(parameters, "oauth_nonce", nonce); - putParameterIfValueNotNull(parameters, "oauth_signature_method", signatureMethod); - putParameterIfValueNotNull(parameters, "oauth_timestamp", timestamp); - putParameterIfValueNotNull(parameters, "oauth_token", token); - putParameterIfValueNotNull(parameters, "oauth_verifier", verifier); - putParameterIfValueNotNull(parameters, "oauth_version", version); - putParameterIfValueNotNull(parameters, "oauth_session_handle", sessionHandle); - - // parse request URL for query parameters - for (Map.Entry fieldEntry : requestUrl.entrySet()) { - Object value = fieldEntry.getValue(); - if (value != null) { - String name = fieldEntry.getKey(); - if (value instanceof Collection) { - for (Object repeatedValue : (Collection) value) { - putParameter(parameters, name, repeatedValue); - } - } else { - putParameter(parameters, name, value); - } - } - } - // normalize parameters - StringBuilder parametersBuf = new StringBuilder(); - boolean first = true; - for (Map.Entry entry : parameters.entrySet()) { - if (first) { - first = false; - } else { - parametersBuf.append('&'); - } - parametersBuf.append(entry.getKey()); - String value = entry.getValue(); - if (value != null) { - parametersBuf.append('=').append(value); - } - } - String normalizedParameters = parametersBuf.toString(); - // normalize URL, removing any query parameters and possibly port - GenericUrl normalized = new GenericUrl(); - String scheme = requestUrl.getScheme(); - normalized.setScheme(scheme); - if (usingAppFirewall && (requestUrl.getHost().equals(appFirewallHostname))) { - normalized.setHost(XERO_API_HOST); - } else { - normalized.setHost(requestUrl.getHost()); - } - if (usingAppFirewall &&(requestUrl.getRawPath().startsWith(appFirewallUrlPrefix))) { - String modifiedPath = requestUrl.getRawPath().replace(appFirewallUrlPrefix, ""); - normalized.setPathParts(requestUrl.toPathParts(modifiedPath)); - } else { - normalized.setPathParts(requestUrl.getPathParts()); - } - int port = requestUrl.getPort(); - if ("http".equals(scheme) && port == 80 || "https".equals(scheme) && port == 443) { - port = -1; - } - normalized.setPort(port); - String normalizedPath = normalized.build(); - // signature base string - StringBuilder buf = new StringBuilder(); - buf.append(escape(requestMethod)).append('&'); - buf.append(escape(normalizedPath)).append('&'); - buf.append(escape(normalizedParameters)); - String signatureBaseString = buf.toString(); - signature = signer.computeSignature(signatureBaseString); - } - - /** - * Returns the {@code Authorization} header value to use with the OAuth parameter values found in - * the fields. - * @return String - */ - public String getAuthorizationHeader() - { - StringBuilder buf = new StringBuilder("OAuth"); - appendParameter(buf, "realm", realm); - appendParameter(buf, "oauth_callback", callback); - appendParameter(buf, "oauth_consumer_key", consumerKey); - appendParameter(buf, "oauth_nonce", nonce); - appendParameter(buf, "oauth_signature", signature); - appendParameter(buf, "oauth_signature_method", signatureMethod); - appendParameter(buf, "oauth_timestamp", timestamp); - appendParameter(buf, "oauth_token", token); - appendParameter(buf, "oauth_verifier", verifier); - appendParameter(buf, "oauth_version", version); - appendParameter(buf, "oauth_session_handle", sessionHandle); - - return buf.substring(0, buf.length() - 1); - } - - private void appendParameter(StringBuilder buf, String name, String value) - { - if (value != null) - { - buf.append(' ').append(escape(name)).append("=\"").append(escape(value)).append("\","); - } - } - - private void putParameterIfValueNotNull(TreeMap parameters, String key, String value) - { - if (value != null) { - putParameter(parameters, key, value); - } - } - - private void putParameter(TreeMap parameters, String key, Object value) - { - parameters.put(escape(key), value == null ? null : escape(value.toString())); - } - - /** Returns the escaped form of the given value using OAuth escaping rules. - * @param value The string value you wish to escape - * @return String - */ - public static String escape(String value) - { - return ESCAPER.escape(value); - } - - public void initialize(HttpRequest request) throws IOException - { - request.setInterceptor(this); - } - - public void intercept(HttpRequest request) throws IOException - { - computeNonce(); - computeTimestamp(); - try { - computeSignature(request.getRequestMethod(), request.getUrl()); - } catch (GeneralSecurityException e) { - logger.error(e); - IOException io = new IOException(); - io.initCause(e); - throw io; - } - request.getHeaders().setAuthorization(getAuthorizationHeader()); - } - - public void intercept(HttpGet request, GenericUrl url) throws IOException - { - computeNonce(); - computeTimestamp(); - - try { - computeSignature(request.getMethod(), url); - } catch (GeneralSecurityException e) { - logger.error(e); - IOException io = new IOException(); - io.initCause(e); - throw io; - } - request.addHeader("Authorization", getAuthorizationHeader()); - } - - public void intercept(HttpPost request, GenericUrl url) throws IOException - { - computeNonce(); - computeTimestamp(); - - try { - computeSignature(request.getMethod(), url); - } catch (GeneralSecurityException e) { - logger.error(e); - IOException io = new IOException(); - io.initCause(e); - throw io; - }; - request.addHeader("Authorization", getAuthorizationHeader()); - } - - public void intercept(HttpPut request, GenericUrl url) throws IOException - { - computeNonce(); - computeTimestamp(); - - try { - computeSignature(request.getMethod(), url); - } catch (GeneralSecurityException e) { - logger.error(e); - IOException io = new IOException(); - io.initCause(e); - throw io; - } - request.addHeader("Authorization", getAuthorizationHeader()); - } - - public void intercept(HttpDelete request, GenericUrl url) throws IOException - { - computeNonce(); - computeTimestamp(); - - try { - computeSignature(request.getMethod(), url); - } catch (GeneralSecurityException e) { - logger.error(e); - IOException io = new IOException(); - io.initCause(e); - throw io; - } - request.addHeader("Authorization", getAuthorizationHeader()); - } - -} diff --git a/src/main/java/com/xero/api/OAuthRequestResource.java b/src/main/java/com/xero/api/OAuthRequestResource.java deleted file mode 100644 index 7b6c5146..00000000 --- a/src/main/java/com/xero/api/OAuthRequestResource.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright (c) 2015 Xero Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package com.xero.api; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.io.IOUtils; -import org.apache.http.Header; -import org.apache.http.HttpEntity; -import org.apache.http.HttpHeaders; -import org.apache.http.HttpHost; - -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.entity.ByteArrayEntity; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.entity.mime.HttpMultipartMode; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.ContentBody; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.message.BasicHeader; -import org.apache.http.util.EntityUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.api.client.auth.oauth.OAuthSigner; -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.HttpResponse; -import com.xero.api.exception.XeroExceptionHandler; -import com.xero.models.bankfeeds.Statements; - -public class OAuthRequestResource { - private String token; - private String tokenSecret; - private GenericUrl url; - private byte[] requestBody = null; - - public String contentType = null; - public String ifModifiedSince = null; - public String accept = null; - private String body = null; - - private String httpMethod = "GET"; - private String resource; - private int connectTimeout = 20; - private int readTimeout = 20; - private Map params = null; - - private Config config; - private SignerFactory signerFactory; - private String fileName; - final static Logger logger = LogManager.getLogger(OAuthRequestResource.class); - - private OAuthRequestResource(Config config, SignerFactory signerFactory, String resource, String method, Map params) { - this.config = config; - this.signerFactory = signerFactory; - this.resource = resource; - this.httpMethod = method; - this.params = params; - this.connectTimeout = config.getConnectTimeout() * 1000; - this.readTimeout = config.getReadTimeout() * 1000; - } - - public OAuthRequestResource(Config config, SignerFactory signerFactory, String resource, String method, String body, Map params) { - this(config, signerFactory, resource, method, params); - this.body = body; - } - - public OAuthRequestResource(Config config, SignerFactory signerFactory, String resource, String method, String body, Map params, String accept, String contentType) { - this(config, signerFactory, resource, method, params); - this.accept = accept; - this.contentType = contentType; - this.body = body; - } - - public OAuthRequestResource(Config config, SignerFactory signerFactory, String resource, String method, String body, Map params, String accept) { - this(config, signerFactory, resource, method, params); - this.accept = accept; - this.body = body; - } - - public OAuthRequestResource(Config config, SignerFactory signerFactory, String resource, String method, String contentType, byte[] bytes, Map params) { - this(config, signerFactory, resource, method, params); - this.contentType = contentType; - this.requestBody = bytes; - } - - public OAuthRequestResource(Config config, SignerFactory signerFactory, String resource, String method, String contentType, byte[] bytes, Map params, String accept) { - this(config, signerFactory, resource, method, params); - this.contentType = contentType; - this.requestBody = bytes; - this.accept = accept; - } - - public OAuthRequestResource(Config config, SignerFactory signerFactory, String resource, String method, String contentType, File file, Map params) { - this(config, signerFactory, resource, method, params); - this.contentType = contentType; - } - - public final ByteArrayInputStream executefile() throws UnsupportedOperationException, IOException { - CloseableHttpClient httpclient =null; - httpclient = new XeroHttpContext(config,this.accept,this.ifModifiedSince).getHttpClient(); - - if(this.resource.indexOf("https") ==-1) { - this.resource = config.getApiUrl() + this.resource; - } - - url = new GenericUrl(this.resource); - if (this.params != null) { - url.putAll(this.params); - } - - RequestConfig.Builder requestConfig = RequestConfig.custom() - .setConnectTimeout(connectTimeout) - .setConnectionRequestTimeout(readTimeout) - .setSocketTimeout(connectTimeout); - - //Proxy Service Setup - unable to fully test as we don't have a proxy - // server to test against. - if(!"".equals(config.getProxyHost()) && config.getProxyHost() != null) { - int port = (int) (config.getProxyPort() == 80 && config.getProxyHttpsEnabled() ? 443 : config.getProxyPort()); - HttpHost proxy = new HttpHost(config.getProxyHost(), port, config.getProxyHttpsEnabled() ? "https" : "http"); - requestConfig.setProxy(proxy); - } - - HttpGet httpget = new HttpGet(url.toString()); - if (httpMethod == "GET") { - this.createParameters().intercept(httpget,url); - httpget.setConfig(requestConfig.build()); - } - - HttpPost httppost = new HttpPost(url.toString()); - if (httpMethod == "POST") { - httppost.setEntity(new StringEntity(this.body, "utf-8")); - httppost.addHeader("Content-Type", this.contentType); - this.createParameters().intercept(httppost,url); - httppost.setConfig(requestConfig.build()); - } - - HttpPut httpput = new HttpPut(url.toString()); - if (httpMethod == "PUT") { - httpput.setEntity(new StringEntity(this.body, "utf-8")); - httpput.addHeader("Content-Type", this.contentType); - - this.createParameters().intercept(httpput,url); - httpput.setConfig(requestConfig.build()); - } - - HttpEntity entity; - try { - CloseableHttpResponse response = null; - - if (httpMethod == "GET") { - response = httpclient.execute(httpget); - } - - if (httpMethod == "POST") { - response = httpclient.execute(httppost); - } - - if (httpMethod == "PUT") { - response = httpclient.execute(httpput); - } - - try { - entity = response.getEntity(); - - List
httpHeaders = Arrays.asList(response.getAllHeaders()); - for (Header header : httpHeaders) { - if (header.getName() == "Content-Disposition") { - this.fileName = parseFileName(header.getValue()); - } - //System.out.println("Headers.. name,value:"+header.getName() + "," + header.getValue()); - } - - InputStream is = entity.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - - is.close(); - return new ByteArrayInputStream(bytes); - - } finally { - response.close(); - } - } finally { - httpclient.close(); - } - } - - private String parseFileName(String param) - { - String fileName = null; - Pattern regex = Pattern.compile("(?<=filename=\").*?(?=\")"); - Matcher regexMatcher = regex.matcher(param); - if (regexMatcher.find()) { - fileName = regexMatcher.group(); - } - return fileName; - } - - public String getFileName() - { - return this.fileName; - } - - public final Map execute() throws IOException,XeroApiException { - CloseableHttpClient httpclient =null; - - httpclient = new XeroHttpContext(config,this.accept,this.ifModifiedSince).getHttpClient(); - - if(this.resource.indexOf("https") ==-1) { - this.resource = config.getApiUrl() + this.resource; - } - - //params.forEach((k,v)->System.out.println("Key : " + k + " Value : " + v)); - - url = new GenericUrl(this.resource); - if (this.params != null) { - url.putAll(this.params); - } - - RequestConfig.Builder requestConfig = RequestConfig.custom() - .setConnectTimeout(connectTimeout) - .setConnectionRequestTimeout(readTimeout) - .setSocketTimeout(connectTimeout); - - //Proxy Service Setup - unable to fully test as we don't have a proxy - // server to test against. - if(!"".equals(config.getProxyHost()) && config.getProxyHost() != null) { - int port = (int) (config.getProxyPort() == 80 && config.getProxyHttpsEnabled() ? 443 : config.getProxyPort()); - HttpHost proxy = new HttpHost(config.getProxyHost(), port, config.getProxyHttpsEnabled() ? "https" : "http"); - requestConfig.setProxy(proxy); - } - - HttpGet httpget = new HttpGet(url.toString()); - if (httpMethod == "GET") { - this.createParameters().intercept(httpget,url); - httpget.setConfig(requestConfig.build()); - if(logger.isDebugEnabled()){ - logger.debug("------------------ GET : URL -------------------"); - logger.debug(url.toString()); - } - } - - HttpPost httppost = new HttpPost(url.toString()); - if (httpMethod == "POST") { - if(logger.isDebugEnabled()){ - logger.debug("------------------ POST : URL -------------------"); - logger.debug(url.toString()); - logger.debug("------------------ POST : BODY -------------------"); - logger.debug(this.body); - } - if(this.requestBody != null) { - httppost.setEntity(new ByteArrayEntity(this.requestBody)); - } else { - httppost.setEntity(new StringEntity(this.body, "utf-8")); - } - - httppost.addHeader("Content-Type", this.contentType); - this.createParameters().intercept(httppost,url); - httppost.setConfig(requestConfig.build()); - } - - HttpPut httpput = new HttpPut(url.toString()); - if (httpMethod == "PUT") { - if(logger.isDebugEnabled()){ - logger.debug("------------------ PUT : URL -------------------"); - logger.debug(url.toString()); - logger.debug("------------------ PUT : BODY -------------------"); - logger.debug(this.body); - } - if(this.requestBody != null) { - httpput.setEntity(new ByteArrayEntity(this.requestBody)); - } else { - httpput.setEntity(new StringEntity(this.body, "utf-8")); - } - httpput.addHeader("Content-Type", this.contentType); - this.createParameters().intercept(httpput,url); - httpput.setConfig(requestConfig.build()); - } - - HttpDelete httpdelete = new HttpDelete(url.toString()); - if (httpMethod == "DELETE") { - this.createParameters().intercept(httpdelete,url); - httpdelete.setConfig(requestConfig.build()); - if(logger.isDebugEnabled()){ - logger.debug("------------------ DELETE : URL -------------------"); - logger.debug(url.toString()); - } - } - - HttpEntity entity; - try { - CloseableHttpResponse response = null; - - if (httpMethod == "GET") { - response = httpclient.execute(httpget); - } - - if (httpMethod == "POST") { - response = httpclient.execute(httppost); - } - - if (httpMethod == "PUT") { - response = httpclient.execute(httpput); - } - - if (httpMethod == "DELETE") { - response = httpclient.execute(httpdelete); - } - - try { - String content = ""; - entity = response.getEntity(); - int code = response.getStatusLine().getStatusCode(); - if(logger.isDebugEnabled()){ - logger.debug("------------------ RESPONSE : CODE -------------------"); - logger.debug(code); - } - if(entity != null) { - content = EntityUtils.toString(entity); - if(logger.isDebugEnabled()){ - logger.debug("------------------ RESPONSE : CONTENT -------------------"); - logger.debug(content); - } - } - - if (code == 204) { - if (this.contentType == "application/json") { - content = "{\"Status\": \"DELETED\" }"; - } else { - content = "DELETED"; - } - } - if (code != 200 && code != 201 && code != 202 && code != 204) { - Header rateHeader = response.getFirstHeader("x-rate-limit-problem"); - if (rateHeader != null) { - content += "&rate=" + rateHeader.getValue().toLowerCase(); - } - - XeroApiException e = new XeroApiException(code,content); - throw e; - } - - Map responseMap = new HashMap<>(); - addToMapIfNotNull(responseMap, "content", content); - addToMapIfNotNull(responseMap, "code", code); - - // TODO: ADD LOGGING of Code & Content - if(entity != null) { - EntityUtils.consume(entity); - } - return responseMap; - } finally { - response.close(); - } - } finally { - httpclient.close(); - } - } - - protected void addToMapIfNotNull(Map map, String key, Object value) { - if (value != null) { - map.put(key, value.toString()); - } - } - - public void setMethod(String method) { - this.httpMethod = method; - } - - public void setToken(String token) { - this.token = token; - if(config.getAppType().equals("PRIVATE")) { - this.token = config.getConsumerKey(); - } - } - public void setTokenSecret(String secret) { - this.tokenSecret = secret; - } - - public void setIfModifiedSince(OffsetDateTime modifiedAfter) { - this.ifModifiedSince = modifiedAfter.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")); - } - - public void setIfModifiedSince(Date modifiedAfter) { - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); - this.ifModifiedSince = formatter.format(modifiedAfter); - } - - public OAuthParameters createParameters() - { - OAuthSigner signer = signerFactory.createSigner(tokenSecret); - - OAuthParameters result = new OAuthParameters(); - result.consumerKey = config.getConsumerKey(); - result.usingAppFirewall = config.isUsingAppFirewall(); - result.appFirewallHostname = config.getAppFirewallHostname(); - result.appFirewallUrlPrefix = config.getAppFirewallUrlPrefix(); - result.token = token; - result.signer = signer; - return result; - } - - @Deprecated - public void setProxy(String host, int port, boolean httpsEnabled) { - - } - - public static boolean isJSONValid(String jsonInString ) { - try { - final ObjectMapper mapper = new ObjectMapper(); - mapper.readTree(jsonInString); - return true; - } catch (IOException e) { - return false; - } - } -} \ No newline at end of file diff --git a/src/main/java/com/xero/api/OAuthRequestToken.java b/src/main/java/com/xero/api/OAuthRequestToken.java deleted file mode 100644 index 9bcec103..00000000 --- a/src/main/java/com/xero/api/OAuthRequestToken.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.xero.api; - -import java.io.IOException; -import java.util.HashMap; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.google.api.client.auth.oauth.OAuthCredentialsResponse; -import com.google.api.client.auth.oauth.OAuthSigner; - -public class OAuthRequestToken { - - private String tempToken = null; - private String tempTokenSecret = null; - private OAuthGetTemporaryToken tokenRequest = null; - private Config config; - private SignerFactory signerFactory; - final static Logger logger = LogManager.getLogger(OAuthRequestToken.class); - - public OAuthRequestToken(Config config) { - this(config, new ConfigBasedSignerFactory(config)); - } - - public OAuthRequestToken(Config config, SignerFactory signerFactory) { - this.config = config; - this.signerFactory = signerFactory; - } - - public void execute() throws XeroApiException, IOException { - OAuthSigner signer = signerFactory.createSigner(null); - - if (config.isUsingAppFirewall()) { - tokenRequest = new OAuthGetTemporaryToken(config.getRequestTokenUrl(), config.isUsingAppFirewall(), - config.getAppFirewallHostname(), config.getAppFirewallUrlPrefix()); - } else { - tokenRequest = new OAuthGetTemporaryToken(config.getRequestTokenUrl()); - } - - tokenRequest.setConfig(config); - tokenRequest.signer = signer; - - OAuthCredentialsResponse temporaryTokenResponse = null; - try { - temporaryTokenResponse = tokenRequest.execute(); - tempToken = temporaryTokenResponse.token; - tempTokenSecret = temporaryTokenResponse.tokenSecret; - } catch (XeroApiException e) { - logger.error(e); - throw e; - } catch (IOException e) { - logger.error(e); - throw e; - } - } - - public String getTempToken() { - return tempToken; - } - - public String getTempTokenSecret() { - return tempTokenSecret; - } - - public HashMap getAll() { - HashMap map = new HashMap(); - map.put("tempToken", getTempToken()); - map.put("tempTokenSecret", getTempTokenSecret()); - map.put("sessionHandle", ""); - map.put("tokenTimestamp", ""); - - return map; - } -} diff --git a/src/main/java/com/xero/api/RFC3339DateFormat.java b/src/main/java/com/xero/api/RFC3339DateFormat.java index 0b8ea2ff..a8e0a185 100644 --- a/src/main/java/com/xero/api/RFC3339DateFormat.java +++ b/src/main/java/com/xero/api/RFC3339DateFormat.java @@ -1,8 +1,8 @@ /* - * Xero Fixed Assets API - * This the Xero Fixed Assets API + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 1.1.2 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/com/xero/api/RsaSignerFactory.java b/src/main/java/com/xero/api/RsaSignerFactory.java deleted file mode 100755 index 17ee30c5..00000000 --- a/src/main/java/com/xero/api/RsaSignerFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.xero.api; - -import java.io.*; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.PrivateKey; -import java.util.Collections; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.google.api.client.auth.oauth.OAuthRsaSigner; - -public class RsaSignerFactory implements SignerFactory { - - private OAuthRsaSigner signer = new OAuthRsaSigner(); - final static Logger logger = LogManager.getLogger(RsaSignerFactory.class); - - public RsaSignerFactory(String pathToPrivateKey, String privateKeyPassword) { - try(InputStream privateKeyInputStream = getInputStreamForPath(pathToPrivateKey)) { - signer.privateKey = loadPrivateKey(privateKeyInputStream, privateKeyPassword.toCharArray()); - } catch (IOException ex) { - logger.error(ex); - throw new RuntimeException(ex); - } - } - - public RsaSignerFactory(InputStream privateKeyInputStream, String privateKeyPassword) { - signer.privateKey = loadPrivateKey(privateKeyInputStream, privateKeyPassword.toCharArray()); - } - - @Override - public OAuthRsaSigner createSigner(String tokenSharedSecret) { - return signer; - } - - private static PrivateKey loadPrivateKey(InputStream stream, char[] password) { - PrivateKey oauthKey = null; - try { - KeyStore oauthKeyStore = KeyStore.getInstance("PKCS12"); - oauthKeyStore.load(stream, password); - - for (String alias : Collections.list(oauthKeyStore.aliases())) { - if (oauthKeyStore.isKeyEntry(alias)) { - oauthKey = (PrivateKey) oauthKeyStore.getKey(alias, password); - } - } - } catch (IOException | GeneralSecurityException | RuntimeException ex) { - logger.error(ex); - throw new RuntimeException(ex); - } - - return oauthKey; - } - - private static InputStream getInputStreamForPath(String path) { - File f = new File(path); - if (f.isFile()) { - try { - return new FileInputStream(f); - } catch (FileNotFoundException e) { - logger.info("Could not open file from file system, defaulting to classpath."); - } - } - - return RsaSignerFactory.class.getResourceAsStream(path); - } -} diff --git a/src/main/java/com/xero/api/SignerFactory.java b/src/main/java/com/xero/api/SignerFactory.java deleted file mode 100644 index 5e39e608..00000000 --- a/src/main/java/com/xero/api/SignerFactory.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.xero.api; - -import com.google.api.client.auth.oauth.OAuthSigner; - -public interface SignerFactory { - OAuthSigner createSigner(String tokenSharedSecret); -} diff --git a/src/main/java/com/xero/api/StringUtil.java b/src/main/java/com/xero/api/StringUtil.java index 511a0ae8..c43bc747 100644 --- a/src/main/java/com/xero/api/StringUtil.java +++ b/src/main/java/com/xero/api/StringUtil.java @@ -1,8 +1,8 @@ /* - * Xero Fixed Assets API - * This the Xero Fixed Assets API + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 1.1.2 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public static boolean containsIgnoreCase(String[] array, String value) { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/src/main/java/com/xero/api/XeroApi20.java b/src/main/java/com/xero/api/XeroApi20.java new file mode 100644 index 00000000..99609d13 --- /dev/null +++ b/src/main/java/com/xero/api/XeroApi20.java @@ -0,0 +1,34 @@ +package com.xero.api; + +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; +import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; + +public class XeroApi20 extends DefaultApi20 { + + protected XeroApi20() { + } + + private static class InstanceHolder { + private static final XeroApi20 INSTANCE = new XeroApi20(); + } + + public static XeroApi20 instance() { + return InstanceHolder.INSTANCE; + } + + @Override + public String getAccessTokenEndpoint() { + return "https://identity.xero.com/connect/token"; + } + + @Override + protected String getAuthorizationBaseUrl() { + return "https://login.xero.com/identity/connect/authorize"; + } + + @Override + public ClientAuthentication getClientAuthentication() { + return RequestBodyAuthenticationScheme.instance(); + } +} \ No newline at end of file diff --git a/src/main/java/com/xero/api/XeroApiException.java b/src/main/java/com/xero/api/XeroApiException.java deleted file mode 100644 index a8469e5f..00000000 --- a/src/main/java/com/xero/api/XeroApiException.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.xero.api; - -import com.xero.api.exception.XeroExceptionHandler; -import com.xero.model.ApiException; -import com.xero.models.bankfeeds.Statements; -import com.xero.models.accounting.Error; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - - -public class XeroApiException extends RuntimeException { - - private static final long serialVersionUID = 1L; - private final int responseCode; - private String message; - private Map messageMap = new HashMap(); - private ApiException apiException; - private Error error; - - public XeroApiException(int responseCode) { - super(responseCode + " response."); - this.responseCode = responseCode; - } - - public XeroApiException(int responseCode, String message) { - super(responseCode + " response: " + message); - this.responseCode = responseCode; - this.message = message; - } - - public XeroApiException(int responseCode, Map map) { - super(responseCode + "response"); - this.responseCode = responseCode; - for (Map.Entry entry : map.entrySet()) { - if (this.message == null) { - this.message = entry.getValue() + " - "; - } else { - this.message = this.message + entry.getValue() + " "; - } - } - this.messageMap = map; - } - - // response type XML uses ApiException class to unmarshall - public XeroApiException(int responseCode, String message, ApiException apiException) { - super(responseCode + " response: " + message); - this.responseCode = responseCode; - this.message = message; - this.apiException = apiException; - } - - // response type JSON uses Error class - public XeroApiException(int responseCode, String message, Error error) { - super(responseCode + " response: " + message); - this.responseCode = responseCode; - this.message = message; - this.error = error; - } - - public int getResponseCode() { - return responseCode; - } - - public String getMessage() { - return message; - } - - public Map getMessages() { - return messageMap; - } - - public ApiException getApiException() { - return apiException; - } - - public Error getError() { - return error; - } - -} diff --git a/src/main/java/com/xero/api/XeroClient.java b/src/main/java/com/xero/api/XeroClient.java deleted file mode 100644 index 96c93019..00000000 --- a/src/main/java/com/xero/api/XeroClient.java +++ /dev/null @@ -1,1970 +0,0 @@ -package com.xero.api; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.xero.api.exception.XeroExceptionHandler; -import com.xero.api.jaxb.XeroJAXBMarshaller; -import com.xero.model.*; -import com.xero.models.assets.*; - -import javax.xml.bind.JAXBElement; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.json.simple.parser.ParseException; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URLEncoder; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TimeZone; -import java.util.regex.Pattern; - -import static java.lang.String.format; -import static java.util.Objects.requireNonNull; - -public class XeroClient { - - private XeroExceptionHandler xeroExceptionHandler; - private Config config; - private SignerFactory signerFactory; - private String token = null; - private String tokenSecret = null; - final static Logger logger = LogManager.getLogger(XeroClient.class); - static XeroJAXBMarshaller u = new XeroJAXBMarshaller(); - protected static final DateFormat utcFormatter; - - static { - utcFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); - utcFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); - } - - protected static final Pattern MESSAGE_PATTERN = Pattern.compile("(.*)"); - protected final ObjectFactory objFactory = new ObjectFactory(); - - public XeroClient() { - this(JsonConfig.getInstance()); - this.xeroExceptionHandler = new XeroExceptionHandler(); - } - - public XeroClient(Config config) { - this(config, new ConfigBasedSignerFactory(config)); - this.xeroExceptionHandler = new XeroExceptionHandler(); - } - - public XeroClient(Config config, SignerFactory signerFactory) { - this.config = config; - this.signerFactory = signerFactory; - this.xeroExceptionHandler = new XeroExceptionHandler(); - } - - public void setOAuthToken(String token, String tokenSecret) { - this.token = token; - this.tokenSecret = tokenSecret; - } - - protected Response get(String endPoint) throws IOException { - return get(endPoint, null, null); - } - - protected Response get(String endPoint, Date modifiedAfter, Map params) throws IOException { - //XeroJAXBMarshaller u = new XeroJAXBMarshaller(); - - OAuthRequestResource req = new OAuthRequestResource(config, signerFactory, endPoint, "GET", null, params); - req.setToken(token); - req.setTokenSecret(tokenSecret); - if (modifiedAfter != null) { - req.setIfModifiedSince(modifiedAfter); - } - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return u.unmarshall(r.toString(), Response.class); - } catch (IOException ioe) { - logger.error(ioe); - throw xeroExceptionHandler.convertException(ioe); - } catch (XeroApiException e) { - logger.error(e); - throw this.xeroExceptionHandler.handleBadRequest(e.getMessage(),e.getResponseCode()); - } - } - /* - * Deprecated as of 0.7.0 - instead use getInputStream, then save your file - * to your storage system (local filesystem, S3, etc) - */ - @Deprecated - protected String getFile(String endPoint, - Date modifiedAfter, - Map params, - String accept, - String dirPath) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource(config, signerFactory, endPoint, "GET", null, params, accept); - req.setToken(this.token); - req.setTokenSecret(this.tokenSecret); - - if (modifiedAfter != null) { - req.setIfModifiedSince(modifiedAfter); - } - - String saveFilePath = null; - String fileName = null; - - try { - ByteArrayInputStream input = req.executefile(); - fileName = req.getFileName(); - saveFilePath = dirPath + File.separator + fileName; - - FileOutputStream output = new FileOutputStream(saveFilePath); - - int DEFAULT_BUFFER_SIZE = 1024; - byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; - int n = 0; - - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - - while (n >= 0) { - output.write(buffer, 0, n); - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - } - - input.close(); - output.close(); - - return saveFilePath; - } catch (IOException ioe) { - logger.error(ioe); - throw xeroExceptionHandler.convertException(ioe); - } catch (XeroApiException e) { - logger.error(e); - throw this.xeroExceptionHandler.handleBadRequest(e.getMessage(),e.getResponseCode()); - } - } - - protected ByteArrayInputStream getInputStream(String endPoint, - Date modifiedAfter, - Map params, - String accept) throws IOException { - OAuthRequestResource req = new OAuthRequestResource(config, signerFactory, endPoint, "GET", null, params, accept); - req.setToken(token); - req.setTokenSecret(tokenSecret); - if (modifiedAfter != null) { - req.setIfModifiedSince(modifiedAfter); - } - - try { - ByteArrayInputStream byteStream = req.executefile(); - return byteStream; - } catch (IOException ioe) { - logger.error(ioe); - throw xeroExceptionHandler.convertException(ioe); - } catch (XeroApiException e) { - logger.error(e); - throw this.xeroExceptionHandler.handleBadRequest(e.getMessage(),e.getResponseCode()); - } - } - - protected Response put(String endPoint, JAXBElement object) { - //XeroJAXBMarshaller u = new XeroJAXBMarshaller(); - - String contents = u.marshall(object); - - OAuthRequestResource req = new OAuthRequestResource(config, signerFactory, endPoint, "PUT", contents, null); - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return u.unmarshall(r.toString(), Response.class); - } catch (IOException ioe) { - logger.error(ioe); - throw xeroExceptionHandler.convertException(ioe); - } catch (XeroApiException e) { - logger.error(e); - throw this.xeroExceptionHandler.handleBadRequest(e.getMessage(),e.getResponseCode()); - } - } - - protected Response put(String endPoint, String contentType, byte[] bytes) throws IOException { - return put(endPoint, contentType, bytes, null); - } - - protected Response put(String endPoint, String contentType, byte[] bytes, Map params) throws IOException { - //XeroJAXBMarshaller u = new XeroJAXBMarshaller(); - - OAuthRequestResource req = new OAuthRequestResource(config, signerFactory, endPoint, "PUT", contentType, bytes, params); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return u.unmarshall(r.toString(), Response.class); - } catch (IOException ioe) { - logger.error(ioe); - throw xeroExceptionHandler.convertException(ioe); - } catch (XeroApiException e) { - logger.error(e); - throw this.xeroExceptionHandler.handleBadRequest(e.getMessage(),e.getResponseCode()); - } - } - - protected Response put(String endPoint, JAXBElement object, Map params) { - //XeroJAXBMarshaller u = new XeroJAXBMarshaller(); - String contents = u.marshall(object); - - OAuthRequestResource req = new OAuthRequestResource(config, signerFactory, endPoint, "PUT", contents, params); - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return u.unmarshall(r.toString(), Response.class); - } catch (IOException ioe) { - logger.error(ioe); - throw xeroExceptionHandler.convertException(ioe); - } catch (XeroApiException e) { - logger.error(e); - throw this.xeroExceptionHandler.handleBadRequest(e.getMessage(),e.getResponseCode()); - } - } - - protected Response put(String endPoint, String contentType, File file) throws IOException { - //XeroJAXBMarshaller u = new XeroJAXBMarshaller(); - - OAuthRequestResource req = new OAuthRequestResource(config, signerFactory, endPoint, "PUT", contentType, file, null); - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return u.unmarshall(r.toString(), Response.class); - } catch (IOException ioe) { - logger.error(ioe); - throw xeroExceptionHandler.convertException(ioe); - } catch (XeroApiException e) { - logger.error(e); - throw this.xeroExceptionHandler.handleBadRequest(e.getMessage(),e.getResponseCode()); - } - } - - protected Response post(String endPoint, JAXBElement object) throws IOException { - //XeroJAXBMarshaller u = new XeroJAXBMarshaller(); - - String contents = u.marshall(object); - OAuthRequestResource req = new OAuthRequestResource(config, signerFactory, endPoint, "POST", contents, null); - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return u.unmarshall(r.toString(), Response.class); - } catch (IOException ioe) { - logger.error(ioe); - throw xeroExceptionHandler.convertException(ioe); - } catch (XeroApiException e) { - logger.error(e); - throw this.xeroExceptionHandler.handleBadRequest(e.getMessage(),e.getResponseCode()); - } - } - - protected Response post(String endPoint, JAXBElement object, Map params) throws IOException { - //XeroJAXBMarshaller u = new XeroJAXBMarshaller(); - - String contents = u.marshall(object); - OAuthRequestResource req = new OAuthRequestResource(config, signerFactory, endPoint, "POST", contents, params); - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return u.unmarshall(r.toString(), Response.class); - } catch (IOException ioe) { - logger.error(ioe); - throw xeroExceptionHandler.convertException(ioe); - } catch (XeroApiException e) { - logger.error(e); - throw this.xeroExceptionHandler.handleBadRequest(e.getMessage(),e.getResponseCode()); - } - } - - protected Response delete(String endPoint) throws IOException { - //XeroJAXBMarshaller u = new XeroJAXBMarshaller(); - - OAuthRequestResource req = new OAuthRequestResource(config, signerFactory, endPoint, "DELETE", null, null); - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return u.unmarshall(r.toString(), Response.class); - } catch (IOException ioe) { - logger.error(ioe); - throw xeroExceptionHandler.convertException(ioe); - } catch (XeroApiException e) { - logger.error(e); - throw this.xeroExceptionHandler.handleBadRequest(e.getMessage(),e.getResponseCode()); - } - } - - protected void addToMapIfNotNull(Map map, String key, Object value) { - if (value != null) { - map.put(key, value.toString()); - } - } - - protected T singleResult(List list) { - if (list.isEmpty()) { - return null; - } - if (list.size() > 1) { - throw new IllegalStateException("Got multiple results for query"); - } - return list.get(0); - } - - //ACCOUNTS - public List getAccounts() throws IOException { - Response responseObj = get("Accounts"); - if (responseObj.getAccounts() == null) { - ArrayOfAccount array = new ArrayOfAccount(); - return array.getAccount(); - } else { - return responseObj.getAccounts().getAccount(); - } - } - - public List getAccounts(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("Accounts", modifiedAfter, params); - if (responseObj.getAccounts() == null) { - ArrayOfAccount array = new ArrayOfAccount(); - return array.getAccount(); - } else { - return responseObj.getAccounts().getAccount(); - } - } - - public List createAccounts(List objects) throws IOException { - ArrayOfAccount array = new ArrayOfAccount(); - array.getAccount().addAll(objects); - return put("Accounts", objFactory.createAccounts(array)).getAccounts().getAccount(); - } - - public List updateAccount(List objects) throws IOException { - ArrayOfAccount array = new ArrayOfAccount(); - array.getAccount().addAll(objects); - return post("Accounts", objFactory.createAccounts(array)).getAccounts().getAccount(); - } - - public Account getAccount(String id) throws IOException { - return singleResult(get("Accounts/" + id).getAccounts().getAccount()); - } - - public String deleteAccount(String id) throws IOException { - return delete("Accounts/" + id).getStatus(); - } - - //BANK TRANSACTION - public List getBankTransactions() throws IOException { - Response responseObj = get("BankTransactions"); - if (responseObj.getBankTransactions() == null) { - ArrayOfBankTransaction array = new ArrayOfBankTransaction(); - return array.getBankTransaction(); - } else { - return responseObj.getBankTransactions().getBankTransaction(); - } - } - - public List getBankTransactions(Date modifiedAfter, String where, String order) throws IOException { - return getBankTransactions(modifiedAfter, where, order, null); - } - - public List getBankTransactions(Date modifiedAfter, String where, String order, String page) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "page", page); - - Response responseObj = get("BankTransactions", modifiedAfter, params); - if (responseObj.getBankTransactions() == null) { - ArrayOfBankTransaction array = new ArrayOfBankTransaction(); - return array.getBankTransaction(); - } else { - return responseObj.getBankTransactions().getBankTransaction(); - } - } - - - public List getBankTransactions(Date modifiedAfter, String where, String order, String page, String unitdp) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "page", page); - addToMapIfNotNull(params, "unitdp", unitdp); - - Response responseObj = get("BankTransactions", modifiedAfter, params); - if (responseObj.getBankTransactions() == null) { - ArrayOfBankTransaction array = new ArrayOfBankTransaction(); - return array.getBankTransaction(); - } else { - return responseObj.getBankTransactions().getBankTransaction(); - } - } - - public List createBankTransactions(List bankTransactions) throws IOException { - ArrayOfBankTransaction array = new ArrayOfBankTransaction(); - array.getBankTransaction().addAll(bankTransactions); - return put("BankTransactions", objFactory.createBankTransactions(array)).getBankTransactions().getBankTransaction(); - } - - public List createBankTransactions(List bankTransactions, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - - ArrayOfBankTransaction array = new ArrayOfBankTransaction(); - array.getBankTransaction().addAll(bankTransactions); - return put("BankTransactions", objFactory.createBankTransactions(array), params).getBankTransactions().getBankTransaction(); - } - - public List updateBankTransactions(List bankTransactions) throws IOException { - ArrayOfBankTransaction array = new ArrayOfBankTransaction(); - array.getBankTransaction().addAll(bankTransactions); - return post("BankTransactions", objFactory.createBankTransactions(array)) - .getBankTransactions() - .getBankTransaction(); - } - - public List updateBankTransactions(List bankTransactions, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - - ArrayOfBankTransaction array = new ArrayOfBankTransaction(); - array.getBankTransaction().addAll(bankTransactions); - return post("BankTransactions", objFactory.createBankTransactions(array), params) - .getBankTransactions() - .getBankTransaction(); - } - - public BankTransaction getBankTransaction(String id) throws IOException { - return singleResult(get("BankTransactions/" + id).getBankTransactions().getBankTransaction()); - } - - public BankTransaction getBankTransaction(String id, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - return singleResult(get("BankTransactions/" + id, null, params).getBankTransactions().getBankTransaction()); - } - - //BANK TRANSFERS - public List getBankTransfers() throws IOException { - Response responseObj = get("BankTransfers"); - if (responseObj.getBankTransfers() == null) { - ArrayOfBankTransfer array = new ArrayOfBankTransfer(); - return array.getBankTransfer(); - } else { - return responseObj.getBankTransfers().getBankTransfer(); - } - } - - public List getBankTransfers(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - Response responseObj = get("BankTransfers", modifiedAfter, params); - if (responseObj.getBankTransfers() == null) { - ArrayOfBankTransfer array = new ArrayOfBankTransfer(); - return array.getBankTransfer(); - } else { - return responseObj.getBankTransfers().getBankTransfer(); - } - } - - public List createBankTransfers(List bankTransfers) throws IOException { - ArrayOfBankTransfer array = new ArrayOfBankTransfer(); - array.getBankTransfer().addAll(bankTransfers); - return put("BankTransfers", objFactory.createBankTransfers(array)).getBankTransfers().getBankTransfer(); - } - - public BankTransfer getBankTransfer(String id) throws IOException { - return singleResult(get("BankTransfers/" + id).getBankTransfers().getBankTransfer()); - } - - //BRANDING THEMES - public List getBrandingThemes() throws IOException { - Response responseObj = get("BrandingThemes"); - if (responseObj.getBrandingThemes() == null) { - ArrayOfBrandingTheme array = new ArrayOfBrandingTheme(); - return array.getBrandingTheme(); - } else { - return responseObj.getBrandingThemes().getBrandingTheme(); - } - } - - public List getBrandingThemes(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - Response responseObj = get("BrandingThemes", modifiedAfter, params); - if (responseObj.getBrandingThemes() == null) { - ArrayOfBrandingTheme array = new ArrayOfBrandingTheme(); - return array.getBrandingTheme(); - } else { - return responseObj.getBrandingThemes().getBrandingTheme(); - } - } - - public BrandingTheme getBrandingTheme(String id) throws IOException { - return singleResult(get("BrandingThemes/" + id).getBrandingThemes().getBrandingTheme()); - } - - //CONTACT - public List getContacts() throws IOException { - Response responseObj = get("Contacts"); - if (responseObj.getContacts() == null) { - ArrayOfContact array = new ArrayOfContact(); - return array.getContact(); - } else { - return responseObj.getContacts().getContact(); - } - } - - public List getContacts(Date modifiedAfter, String where, String order) throws IOException { - return getContacts(modifiedAfter, where, order, null, null); - } - - public List getContacts(Date modifiedAfter, String where, String order, String page) throws IOException { - return getContacts(modifiedAfter, where, order, page, null); - } - - public List getContacts(Date modifiedAfter, String where, String order, String page, - Boolean includeArchived) throws IOException { - Map params = new HashMap<>(); - this.addToMapIfNotNull(params, "Where", where); - this.addToMapIfNotNull(params, "order", order); - this.addToMapIfNotNull(params, "page", page); - this.addToMapIfNotNull(params, "includeArchived", includeArchived); - Response responseObj = this.get("Contacts", modifiedAfter, params); - if (responseObj.getContacts() == null) { - ArrayOfContact array = new ArrayOfContact(); - return array.getContact(); - } else { - return responseObj.getContacts().getContact(); - } - } - - public List createContact(List contacts) throws IOException { - ArrayOfContact array = new ArrayOfContact(); - array.getContact().addAll(contacts); - return put("Contacts", objFactory.createContacts(array)).getContacts().getContact(); - } - - public List updateContact(List contacts) throws IOException { - ArrayOfContact array = new ArrayOfContact(); - array.getContact().addAll(contacts); - return post("Contacts", objFactory.createContacts(array)).getContacts().getContact(); - } - - public Contact getContact(String id) throws IOException { - return singleResult(get("Contacts/" + id).getContacts().getContact()); - } - - //ContactGroups - public List getContactGroups() throws IOException { - Response responseObj = get("ContactGroups"); - if (responseObj.getContactGroups() == null) { - ArrayOfContactGroup array = new ArrayOfContactGroup(); - return array.getContactGroup(); - } else { - return responseObj.getContactGroups().getContactGroup(); - } - } - - public List getContactGroups(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("ContactGroups", modifiedAfter, params); - if (responseObj.getContactGroups() == null) { - ArrayOfContactGroup array = new ArrayOfContactGroup(); - return array.getContactGroup(); - } else { - return responseObj.getContactGroups().getContactGroup(); - } - } - - public List createContactGroups(List ContactGroups) throws IOException { - ArrayOfContactGroup array = new ArrayOfContactGroup(); - array.getContactGroup().addAll(ContactGroups); - return put("ContactGroups", objFactory.createContactGroups(array)).getContactGroups().getContactGroup(); - } - - public List updateContactGroup(List objects) throws IOException { - ArrayOfContactGroup array = new ArrayOfContactGroup(); - array.getContactGroup().addAll(objects); - return post("ContactGroups", objFactory.createContactGroups(array)).getContactGroups().getContactGroup(); - } - - public ContactGroup getContactGroup(String id) throws IOException { - return singleResult(get("ContactGroups/" + id).getContactGroups().getContactGroup()); - } - - public List deleteContactGroup(ContactGroup object) throws IOException { - object.setStatus(ContactGroupStatus.DELETED); - - ArrayOfContactGroup array = new ArrayOfContactGroup(); - array.getContactGroup().add(object); - return post("ContactGroups", objFactory.createContactGroups(array)).getContactGroups().getContactGroup(); - } - - // ContactGroup Contacts - public List createContactGroupContacts(List objects, String id) throws IOException { - ArrayOfContact array = new ArrayOfContact(); - array.getContact().addAll(objects); - return put("ContactGroups/" + id + "/Contacts", objFactory.createContacts(array)).getContacts().getContact(); - } - - public String deleteSingleContactFromContactGroup(String ContactGroupId, String ContactId) throws IOException { - System.out.println(ContactGroupId); - System.out.println(ContactId); - - return delete("ContactGroups/" + ContactGroupId + "/Contacts/" + ContactId).getStatus(); - } - - public String deleteAllContactsFromContactGroup(String ContactGroupId) throws IOException { - return delete("ContactGroups/" + ContactGroupId + "/Contacts").getStatus(); - } - - //CreditNotes - public List getCreditNotes() throws IOException { - Response responseObj = get("CreditNotes"); - if (responseObj.getCreditNotes() == null) { - ArrayOfCreditNote array = new ArrayOfCreditNote(); - return array.getCreditNote(); - } else { - return responseObj.getCreditNotes().getCreditNote(); - } - } - - public List getCreditNotes(Date modifiedAfter, String where, String order) throws IOException { - return getCreditNotes(modifiedAfter, where, order, null); - } - - public List getCreditNotes(Date modifiedAfter, String where, String order, String page) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "page", page); - - Response responseObj = get("CreditNotes", modifiedAfter, params); - if (responseObj.getCreditNotes() == null) { - ArrayOfCreditNote array = new ArrayOfCreditNote(); - return array.getCreditNote(); - } else { - return responseObj.getCreditNotes().getCreditNote(); - } - } - - public List createCreditNotes(List objects) throws IOException { - ArrayOfCreditNote array = new ArrayOfCreditNote(); - array.getCreditNote().addAll(objects); - return put("CreditNote", objFactory.createCreditNotes(array)).getCreditNotes().getCreditNote(); - } - - - public List createCreditNotes(List objects, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - - ArrayOfCreditNote array = new ArrayOfCreditNote(); - array.getCreditNote().addAll(objects); - return put("CreditNote", objFactory.createCreditNotes(array),params).getCreditNotes().getCreditNote(); - } - - public List updateCreditNote(List objects) throws IOException { - ArrayOfCreditNote array = new ArrayOfCreditNote(); - array.getCreditNote().addAll(objects); - return post("CreditNotes", objFactory.createCreditNotes(array)).getCreditNotes().getCreditNote(); - } - - public CreditNote getCreditNote(String id) throws IOException { - return singleResult(get("CreditNotes/" + id).getCreditNotes().getCreditNote()); - } - - @Deprecated - public String getCreditNotePdf(String id, String dirPath) throws IOException { - return getFile("CreditNotes/" + id, null, null, "application/pdf", dirPath); - } - - public ByteArrayInputStream getCreditNotePdfContent(String id) throws IOException { - return getInputStream("CreditNotes/" + id, null, null, "application/pdf"); - } - - public List createCreditNoteAllocations(List objects, String id) throws IOException { - ArrayOfAllocation array = new ArrayOfAllocation(); - array.getAllocation().addAll(objects); - return put("CreditNotes/" + id + "/Allocations", objFactory.createAllocations(array)) - .getAllocations() - .getAllocation(); - } - - - //CURRENCY - public List getCurrencies() throws IOException { - Response responseObj = get("Currencies"); - if (responseObj.getCurrencies() == null) { - ArrayOfCurrency array = new ArrayOfCurrency(); - return array.getCurrency(); - } else { - return responseObj.getCurrencies().getCurrency(); - } - } - - public List getCurrencies(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("Currencies", modifiedAfter, params); - if (responseObj.getCurrencies() == null) { - ArrayOfCurrency array = new ArrayOfCurrency(); - return array.getCurrency(); - } else { - return responseObj.getCurrencies().getCurrency(); - } - } - - public Currency getCurrency(String id) throws IOException { - return singleResult(get("Currencies/" + id).getCurrencies().getCurrency()); - } - - public List createCurrencies(List objects) { - ArrayOfCurrency array = new ArrayOfCurrency(); - array.getCurrency().addAll(objects); - return put("Currencies", objFactory.createCurrencies(array)).getCurrencies().getCurrency(); - } - - //EMPLOYEES - public List getEmployees() throws IOException { - Response responseObj = get("Employees"); - if (responseObj.getEmployees() == null) { - ArrayOfEmployee array = new ArrayOfEmployee(); - return array.getEmployee(); - } else { - return responseObj.getEmployees().getEmployee(); - } - } - - public List getEmployees(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("Employees", modifiedAfter, params); - if (responseObj.getEmployees() == null) { - ArrayOfEmployee array = new ArrayOfEmployee(); - return array.getEmployee(); - } else { - return responseObj.getEmployees().getEmployee(); - } - } - - public List createEmployees(List objects) throws IOException { - ArrayOfEmployee array = new ArrayOfEmployee(); - array.getEmployee().addAll(objects); - return put("Employee", objFactory.createEmployees(array)).getEmployees().getEmployee(); - } - - public List updateEmployee(List objects) throws IOException { - ArrayOfEmployee array = new ArrayOfEmployee(); - array.getEmployee().addAll(objects); - return post("Employees", objFactory.createEmployees(array)).getEmployees().getEmployee(); - } - - public Employee getEmployee(String id) throws IOException { - return singleResult(get("Employees/" + id).getEmployees().getEmployee()); - } - - //EXPENSE CLAIMS - public List getExpenseClaims() throws IOException { - Response responseObj = get("ExpenseClaims"); - if (responseObj.getExpenseClaims() == null) { - ArrayOfExpenseClaim array = new ArrayOfExpenseClaim(); - return array.getExpenseClaim(); - } else { - return responseObj.getExpenseClaims().getExpenseClaim(); - } - } - - public List getExpenseClaims(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("ExpenseClaims", modifiedAfter, params); - if (responseObj.getExpenseClaims() == null) { - ArrayOfExpenseClaim array = new ArrayOfExpenseClaim(); - return array.getExpenseClaim(); - } else { - return responseObj.getExpenseClaims().getExpenseClaim(); - } - } - - public List createExpenseClaims(List objects) throws IOException { - ArrayOfExpenseClaim array = new ArrayOfExpenseClaim(); - array.getExpenseClaim().addAll(objects); - return put("ExpenseClaim", objFactory.createExpenseClaims(array)).getExpenseClaims().getExpenseClaim(); - } - - public List updateExpenseClaim(List objects) throws IOException { - ArrayOfExpenseClaim array = new ArrayOfExpenseClaim(); - array.getExpenseClaim().addAll(objects); - return post("ExpenseClaims", objFactory.createExpenseClaims(array)).getExpenseClaims().getExpenseClaim(); - } - - public ExpenseClaim getExpenseClaim(String id) throws IOException { - return singleResult(get("ExpenseClaims/" + id).getExpenseClaims().getExpenseClaim()); - } - - //INVOICES - public List getInvoices() throws IOException { - Response responseObj = get("Invoices"); - if (responseObj.getInvoices() == null) { - ArrayOfInvoice array = new ArrayOfInvoice(); - return array.getInvoice(); - } else { - return responseObj.getInvoices().getInvoice(); - } - } - - public List getInvoices(Date modifiedAfter, String where, String order) throws IOException { - Map filter = new HashMap<>(); - return getInvoices(modifiedAfter, where, order, null,null,filter); - } - - public List getInvoices(Date modifiedAfter, String where, String order, String page) throws IOException { - Map filter = new HashMap<>(); - return getInvoices(modifiedAfter, where, order, page, null,filter); - } - - public List getInvoices(Date modifiedAfter, String where, String order, String page, String ids) throws IOException { - return getInvoices(modifiedAfter, where, order, page,null, ids); - } - - public List getInvoices(Date modifiedAfter, String where, String order, String page, String unitdp, Map filter) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "page", page); - addToMapIfNotNull(params, "unitdp", unitdp); - for (Map.Entry entry : filter.entrySet()) - { - addToMapIfNotNull(params, entry.getKey(), entry.getValue()); - } - - Response responseObj = get("Invoices", modifiedAfter, params); - if (responseObj.getInvoices() == null) { - ArrayOfInvoice array = new ArrayOfInvoice(); - return array.getInvoice(); - } else { - return responseObj.getInvoices().getInvoice(); - } - } - - @Deprecated - // deprecated as of version 1.0.0 - maintained for backwards compatibility - public List getInvoices(Date modifiedAfter, String where, String order, String page, String unitdp,String ids) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "page", page); - addToMapIfNotNull(params, "Ids", ids); - addToMapIfNotNull(params, "unitdp", unitdp); - - Response responseObj = get("Invoices", modifiedAfter, params); - if (responseObj.getInvoices() == null) { - ArrayOfInvoice array = new ArrayOfInvoice(); - return array.getInvoice(); - } else { - return responseObj.getInvoices().getInvoice(); - } - } - - public List createInvoices(List invoices) throws IOException { - ArrayOfInvoice array = new ArrayOfInvoice(); - array.getInvoice().addAll(invoices); - return put("Invoices", objFactory.createInvoices(array)).getInvoices().getInvoice(); - } - - public List createInvoices(List invoices, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - - ArrayOfInvoice array = new ArrayOfInvoice(); - array.getInvoice().addAll(invoices); - return put("Invoices", objFactory.createInvoices(array), params).getInvoices().getInvoice(); - } - - public List createInvoices(List invoices, String unitdp,Boolean summarizeErrors) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - addToMapIfNotNull(params, "SummarizeErrors", summarizeErrors); - - ArrayOfInvoice array = new ArrayOfInvoice(); - array.getInvoice().addAll(invoices); - return put("Invoices", objFactory.createInvoices(array), params).getInvoices().getInvoice(); - } - - public List updateInvoice(List objects) throws IOException { - ArrayOfInvoice array = new ArrayOfInvoice(); - array.getInvoice().addAll(objects); - return post("Invoices", objFactory.createInvoices(array)).getInvoices().getInvoice(); - } - - public List updateInvoice(List objects, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - - ArrayOfInvoice array = new ArrayOfInvoice(); - array.getInvoice().addAll(objects); - return post("Invoices", objFactory.createInvoices(array), params).getInvoices().getInvoice(); - } - - public Invoice getInvoice(String id) throws IOException { - return singleResult(get("Invoices/" + id).getInvoices().getInvoice()); - } - - public Invoice getInvoice(String id, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - return singleResult(get("Invoices/" + id, null, params).getInvoices().getInvoice()); - } - - @Deprecated - public String getInvoicePdf(String id, String dirPath) throws IOException { - return getFile("Invoices/" + id, null, null, "application/pdf", dirPath); - } - - public ByteArrayInputStream getInvoicePdfContent(String id) throws IOException { - return getInputStream("Invoices/" + id, null, null, "application/pdf"); - } - - public OnlineInvoice getOnlineInvoice(String id) throws IOException { - return singleResult(get("Invoices/" + id + "/OnlineInvoice").getOnlineInvoices().getOnlineInvoice()); - } - - // INVOICE REMINDER - public List getInvoiceReminders() throws IOException { - Response responseObj = get("InvoiceReminders/Settings"); - if (responseObj.getInvoiceReminders() == null) { - ArrayOfInvoiceReminder array = new ArrayOfInvoiceReminder(); - return array.getInvoiceReminder(); - } else { - return responseObj.getInvoiceReminders().getInvoiceReminder(); - } - } - - //ITEMS - public List getItems() throws IOException { - Response responseObj = get("Items"); - if (responseObj.getItems() == null) { - ArrayOfItem array = new ArrayOfItem(); - return array.getItem(); - } else { - return responseObj.getItems().getItem(); - } - } - - public List getItems(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("Items", modifiedAfter, params); - if (responseObj.getItems() == null) { - ArrayOfItem array = new ArrayOfItem(); - return array.getItem(); - } else { - return responseObj.getItems().getItem(); - } - } - - public List getItems(Date modifiedAfter, String where, String order, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "unitdp", unitdp); - - Response responseObj = get("Items", modifiedAfter, params); - if (responseObj.getItems() == null) { - ArrayOfItem array = new ArrayOfItem(); - return array.getItem(); - } else { - return responseObj.getItems().getItem(); - } - } - - public List createItems(List objects) throws IOException { - ArrayOfItem array = new ArrayOfItem(); - array.getItem().addAll(objects); - return put("Items", objFactory.createItems(array)).getItems().getItem(); - } - - public List createItems(List objects, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - - ArrayOfItem array = new ArrayOfItem(); - array.getItem().addAll(objects); - return put("Items", objFactory.createItems(array), params).getItems().getItem(); - } - - public List updateItem(List objects) throws IOException { - ArrayOfItem array = new ArrayOfItem(); - array.getItem().addAll(objects); - return post("Items", objFactory.createItems(array)).getItems().getItem(); - } - - public List updateItem(List objects, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - - ArrayOfItem array = new ArrayOfItem(); - array.getItem().addAll(objects); - return post("Items", objFactory.createItems(array), params).getItems().getItem(); - } - - public Item getItem(String id) throws IOException { - return singleResult(get("Items/" + id).getItems().getItem()); - } - - public Item getItem(String id, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - return singleResult(get("Items/" + id, null, params).getItems().getItem()); - } - - public String deleteItem(String id) throws IOException { - return delete("Items/" + id).getStatus(); - } - - // JOURNALS - public List getJournals() throws IOException { - Response responseObj = get("Journals"); - if (responseObj.getJournals() == null) { - ArrayOfJournal array = new ArrayOfJournal(); - return array.getJournal(); - } else { - return responseObj.getJournals().getJournal(); - } - } - - public List getJournals(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("Journals", modifiedAfter, params); - if (responseObj.getJournals() == null) { - ArrayOfJournal array = new ArrayOfJournal(); - return array.getJournal(); - } else { - return responseObj.getJournals().getJournal(); - } - } - - public List getJournals(Date modifiedAfter, String offset, boolean paymentsOnly) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "offset", offset); - addToMapIfNotNull(params, "paymentsOnly", paymentsOnly); - - Response responseObj = get("Journals", modifiedAfter, params); - if (responseObj.getJournals() == null) { - ArrayOfJournal array = new ArrayOfJournal(); - return array.getJournal(); - } else { - return responseObj.getJournals().getJournal(); - } - } - - public Journal getJournal(String id) throws IOException { - return singleResult(get("Journals/" + id).getJournals().getJournal()); - } - - //LINKED TRANSACTIONS - public List getLinkedTransactions() throws IOException { - Response responseObj = get("LinkedTransactions"); - if (responseObj.getLinkedTransactions() == null) { - ArrayOfLinkedTransaction array = new ArrayOfLinkedTransaction(); - return array.getLinkedTransaction(); - } else { - return responseObj.getLinkedTransactions().getLinkedTransaction(); - } - } - - public List getLinkedTransactions(Date modifiedAfter, String where, String order) - throws IOException { - return getLinkedTransactions(modifiedAfter, where, order, null); - } - - public List getLinkedTransactions(Date modifiedAfter, String where, String order, String page) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "page", page); - - Response responseObj = get("LinkedTransactions", modifiedAfter, params); - if (responseObj.getLinkedTransactions() == null) { - ArrayOfLinkedTransaction array = new ArrayOfLinkedTransaction(); - return array.getLinkedTransaction(); - } else { - return responseObj.getLinkedTransactions().getLinkedTransaction(); - } - } - - public List createLinkedTransactions(List objects) throws IOException { - ArrayOfLinkedTransaction array = new ArrayOfLinkedTransaction(); - array.getLinkedTransaction().addAll(objects); - return put("LinkedTransactions", objFactory.createLinkedTransactions(array)) - .getLinkedTransactions() - .getLinkedTransaction(); - } - - public List updateLinkedTransaction(List objects) throws IOException { - ArrayOfLinkedTransaction array = new ArrayOfLinkedTransaction(); - array.getLinkedTransaction().addAll(objects); - return post("LinkedTransactions", objFactory.createLinkedTransactions(array)) - .getLinkedTransactions() - .getLinkedTransaction(); - } - - public LinkedTransaction getLinkedTransaction(String id) throws IOException { - return singleResult(get("LinkedTransactions/" + id).getLinkedTransactions().getLinkedTransaction()); - } - - public String deleteLinkedTransaction(String id) throws IOException { - return delete("LinkedTransactions/" + id).getStatus(); - } - - //ManualJournals - public List getManualJournals() throws IOException { - Response responseObj = get("ManualJournal"); - if (responseObj.getManualJournals() == null) { - ArrayOfManualJournal array = new ArrayOfManualJournal(); - return array.getManualJournal(); - } else { - return responseObj.getManualJournals().getManualJournal(); - } - } - - public List getManualJournals(Date modifiedAfter, String where, String order) throws IOException { - return getManualJournals(modifiedAfter, where, order, null); - } - - public List getManualJournals(Date modifiedAfter, String where, String order, String page) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "page", page); - - Response responseObj = get("ManualJournals", modifiedAfter, params); - if (responseObj.getManualJournals() == null) { - ArrayOfManualJournal array = new ArrayOfManualJournal(); - return array.getManualJournal(); - } else { - return responseObj.getManualJournals().getManualJournal(); - } - } - - public List createManualJournals(List objects) throws IOException { - ArrayOfManualJournal array = new ArrayOfManualJournal(); - array.getManualJournal().addAll(objects); - return put("ManualJournal", objFactory.createManualjournals(array)).getManualJournals().getManualJournal(); - } - - public List updateManualJournal(List objects) throws IOException { - ArrayOfManualJournal array = new ArrayOfManualJournal(); - array.getManualJournal().addAll(objects); - return post("ManualJournals", objFactory.createManualjournals(array)).getManualJournals().getManualJournal(); - } - - public ManualJournal getManualJournal(String id) throws IOException { - return singleResult(get("ManualJournals/" + id).getManualJournals().getManualJournal()); - } - - //ORGANIZATION - public List getOrganisations() throws IOException { - return get("Organisations").getOrganisations().getOrganisation(); - } - - //OVERPAYMENTS - public List getOverpayments() throws IOException { - Response responseObj = get("Overpayments"); - if (responseObj.getOverpayments() == null) { - ArrayOfOverpayment array = new ArrayOfOverpayment(); - return array.getOverpayment(); - } else { - return responseObj.getOverpayments().getOverpayment(); - } - } - - public List getOverpayments(Date modifiedAfter, String where, String order) throws IOException { - return getOverpayments(modifiedAfter, where, order, null); - } - - public List getOverpayments(Date modifiedAfter, String where, String order, String page) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "page", page); - - Response responseObj = get("Overpayments", modifiedAfter, params); - if (responseObj.getOverpayments() == null) { - ArrayOfOverpayment array = new ArrayOfOverpayment(); - return array.getOverpayment(); - } else { - return responseObj.getOverpayments().getOverpayment(); - } - } - - public List createOverpaymentAllocations(List objects, String id) throws IOException { - ArrayOfAllocation array = new ArrayOfAllocation(); - array.getAllocation().addAll(objects); - return put("Overpayments/" + id + "/Allocations", objFactory.createAllocations(array)) - .getAllocations() - .getAllocation(); - } - - public Overpayment getOverpayment(String id) throws IOException { - return singleResult(get("Overpayments/" + id).getOverpayments().getOverpayment()); - } - - //PAYMENTS - public List getPayments() throws IOException { - Response responseObj = get("Payments"); - if (responseObj.getPayments() == null) { - ArrayOfPayment array = new ArrayOfPayment(); - return array.getPayment(); - } else { - return responseObj.getPayments().getPayment(); - } - } - - public List getPayments(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("Payments", modifiedAfter, params); - if (responseObj.getPayments() == null) { - ArrayOfPayment array = new ArrayOfPayment(); - return array.getPayment(); - } else { - return responseObj.getPayments().getPayment(); - } - } - - public List createPayments(List objects) throws IOException { - ArrayOfPayment array = new ArrayOfPayment(); - array.getPayment().addAll(objects); - return put("Payments", objFactory.createPayments(array)).getPayments().getPayment(); - } - - public List deletePayment(Payment object) throws IOException { - Payment payment = new Payment(); - payment.setStatus(PaymentStatus.DELETED); - - return post("Payments/" + object.getPaymentID(), objFactory.createPayment(payment)).getPayments().getPayment(); - } - - public List deletePayment(List objects) throws IOException { - ArrayOfPayment array = new ArrayOfPayment(); - array.getPayment().addAll(objects); - return post("Payments", objFactory.createPayments(array)).getPayments().getPayment(); - } - - public Payment getPayment(String id) throws IOException { - return singleResult(get("Payments/" + id).getPayments().getPayment()); - } - - //PREPAYMENTS - public List getPrepayments() throws IOException { - Response responseObj = get("Prepayments"); - if (responseObj.getPrepayments() == null) { - ArrayOfPrepayment array = new ArrayOfPrepayment(); - return array.getPrepayment(); - } else { - return responseObj.getPrepayments().getPrepayment(); - } - } - - public List getPrepayments(Date modifiedAfter, String where, String order) throws IOException { - return getPrepayments(modifiedAfter, where, order, null); - } - - public List getPrepayments(Date modifiedAfter, String where, String order, String page) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "page", page); - - Response responseObj = get("Prepayments", modifiedAfter, params); - if (responseObj.getPrepayments() == null) { - ArrayOfPrepayment array = new ArrayOfPrepayment(); - return array.getPrepayment(); - } else { - return responseObj.getPrepayments().getPrepayment(); - } - } - - public List createPrepaymentAllocations(List objects, String id) throws IOException { - ArrayOfAllocation array = new ArrayOfAllocation(); - array.getAllocation().addAll(objects); - return put("Prepayments/" + id + "/Allocations", objFactory.createAllocations(array)) - .getAllocations() - .getAllocation(); - } - - public Prepayment getPrepayment(String id) throws IOException { - return singleResult(get("Prepayments/" + id).getPrepayments().getPrepayment()); - } - - //PURCHASE ORDERS - public List getPurchaseOrders() throws IOException { - Response responseObj = get("PurchaseOrders"); - if (responseObj.getPurchaseOrders() == null) { - ArrayOfPurchaseOrder array = new ArrayOfPurchaseOrder(); - return array.getPurchaseOrder(); - } else { - return responseObj.getPurchaseOrders().getPurchaseOrder(); - } - } - - public List getPurchaseOrders(Date modifiedAfter, String where, String order) throws IOException { - return getPurchaseOrders(modifiedAfter, where, order, null); - } - - public List getPurchaseOrders(Date modifiedAfter, String where, String order, String page) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "page", page); - - Response responseObj = get("PurchaseOrders", modifiedAfter, params); - if (responseObj.getPurchaseOrders() == null) { - ArrayOfPurchaseOrder array = new ArrayOfPurchaseOrder(); - return array.getPurchaseOrder(); - } else { - return responseObj.getPurchaseOrders().getPurchaseOrder(); - } - } - - public List createPurchaseOrders(List objects) throws IOException { - ArrayOfPurchaseOrder array = new ArrayOfPurchaseOrder(); - array.getPurchaseOrder().addAll(objects); - return put("PurchaseOrders", objFactory.createPurchaseOrders(array)).getPurchaseOrders().getPurchaseOrder(); - } - - public List updatePurchaseOrder(List objects) throws IOException { - ArrayOfPurchaseOrder array = new ArrayOfPurchaseOrder(); - array.getPurchaseOrder().addAll(objects); - return post("PurchaseOrders", objFactory.createPurchaseOrders(array)).getPurchaseOrders().getPurchaseOrder(); - } - - public PurchaseOrder getPurchaseOrder(String id) throws IOException { - return singleResult(get("PurchaseOrders/" + id).getPurchaseOrders().getPurchaseOrder()); - } - - @Deprecated - public String getPurchaseOrderPdf(String id, String dirPath) throws IOException { - return getFile("PurchaseOrders/" + id, null, null, "application/pdf", dirPath); - } - - public ByteArrayInputStream getPurchaseOrderPdfContent(String id) throws IOException { - return getInputStream("PurchaseOrders/" + id, null, null, "application/pdf"); - } - - //RECEIPTS - public List getReceipts() throws IOException { - Response responseObj = get("Receipts"); - if (responseObj.getReceipts() == null) { - ArrayOfReceipt array = new ArrayOfReceipt(); - return array.getReceipt(); - } else { - return responseObj.getReceipts().getReceipt(); - } - } - - public List getReceipts(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("Receipts", modifiedAfter, params); - if (responseObj.getReceipts() == null) { - ArrayOfReceipt array = new ArrayOfReceipt(); - return array.getReceipt(); - } else { - return responseObj.getReceipts().getReceipt(); - } - } - - public List createReceipts(List objects) throws IOException { - ArrayOfReceipt array = new ArrayOfReceipt(); - array.getReceipt().addAll(objects); - return put("Receipts", objFactory.createReceipts(array)).getReceipts().getReceipt(); - } - - public List createReceipts(List objects, String unitdp) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "unitdp", unitdp); - - ArrayOfReceipt array = new ArrayOfReceipt(); - array.getReceipt().addAll(objects); - return put("Receipts", objFactory.createReceipts(array),params).getReceipts().getReceipt(); - } - - public List updateReceipt(List objects) throws IOException { - ArrayOfReceipt array = new ArrayOfReceipt(); - array.getReceipt().addAll(objects); - return post("Receipts", objFactory.createReceipts(array)).getReceipts().getReceipt(); - } - - public Receipt getReceipt(String id) throws IOException { - return singleResult(get("Receipts/" + id).getReceipts().getReceipt()); - } - - //REPEATING INVOICES - public List getRepeatingInvoices() throws IOException { - Response responseObj = get("RepeatingInvoices"); - if (responseObj.getRepeatingInvoices() == null) { - ArrayOfRepeatingInvoice array = new ArrayOfRepeatingInvoice(); - return array.getRepeatingInvoice(); - } else { - return responseObj.getRepeatingInvoices().getRepeatingInvoice(); - } - //return get("RepeatingInvoices").getRepeatingInvoices().getRepeatingInvoice(); - } - - public List getRepeatingInvoices(Date modifiedAfter, String where, String order) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("RepeatingInvoices", modifiedAfter, params); - if (responseObj.getRepeatingInvoices() == null) { - ArrayOfRepeatingInvoice array = new ArrayOfRepeatingInvoice(); - return array.getRepeatingInvoice(); - } else { - return responseObj.getRepeatingInvoices().getRepeatingInvoice(); - } - } - - public RepeatingInvoice getRepeatingInvoice(String id) throws IOException { - return singleResult(get("RepeatingInvoices/" + id).getRepeatingInvoices().getRepeatingInvoice()); - } - - //REPORTS - public Report getReport(String id, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "where", where); - addToMapIfNotNull(params, "order", order); - return singleResult(get("reports/" + id, null, params).getReports().getReport()); - } - - public Report getReportAgedPayablesByContact(String contactId, - String where, - String order, - String date, - String fromDate, - String toDate) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "contactID", contactId); - addToMapIfNotNull(params, "date", date); - addToMapIfNotNull(params, "fromDate", fromDate); - addToMapIfNotNull(params, "toDate", toDate); - return singleResult(get("reports/AgedPayablesByContact", null, params).getReports().getReport()); - } - - public Report getReportAgedReceivablesByContact(String contactId, - String where, - String order, - String date, - String fromDate, - String toDate) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "contactID", contactId); - addToMapIfNotNull(params, "date", date); - addToMapIfNotNull(params, "fromDate", fromDate); - addToMapIfNotNull(params, "toDate", toDate); - return singleResult(get("reports/AgedReceivablesByContact", null, params).getReports().getReport()); - } - - public Report getReportBalanceSheet(String where, - String order, - String date, - String trackingOptionId1, - String trackingOptionId2, - boolean standardLayout, - boolean paymentsOnly, - Integer periods, - String timeframe) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "date", date); - addToMapIfNotNull(params, "trackingOptionID1", trackingOptionId1); - addToMapIfNotNull(params, "trackingOptionID2", trackingOptionId2); - addToMapIfNotNull(params, "standardLayout", standardLayout); - addToMapIfNotNull(params, "paymentsOnly", paymentsOnly); - addToMapIfNotNull(params, "periods", periods); - addToMapIfNotNull(params, "timeframe", timeframe); - return singleResult(get("reports/BalanceSheet", null, params).getReports().getReport()); - } - - public Report getReportBalanceSheet(String where, - String order, - String date, - String trackingOptionId1, - String trackingOptionId2, - boolean standardLayout, - boolean paymentsOnly) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "date", date); - addToMapIfNotNull(params, "trackingOptionID1", trackingOptionId1); - addToMapIfNotNull(params, "trackingOptionID2", trackingOptionId2); - addToMapIfNotNull(params, "standardLayout", standardLayout); - addToMapIfNotNull(params, "paymentsOnly", paymentsOnly); - return singleResult(get("reports/BalanceSheet", null, params).getReports().getReport()); - } - - - public Report getReportBankStatement(String accountId, String where, String order, String fromDate, String toDate) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "bankAccountID", accountId); - addToMapIfNotNull(params, "where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "fromDate", fromDate); - addToMapIfNotNull(params, "toDate", toDate); - return singleResult(get("reports/BankStatement", null, params).getReports().getReport()); - } - - public Report getReportBudgetSummary(String where, String order, String date, Integer periods, Integer timeframe) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "date", date); - addToMapIfNotNull(params, "timeframe", timeframe); - addToMapIfNotNull(params, "periods", periods); - return singleResult(get("reports/BudgetSummary", null, params).getReports().getReport()); - } - - public Report getExecutiveSummary(String where, String order, String date) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "date", date); - return singleResult(get("reports/ExecutiveSummary", null, params).getReports().getReport()); - } - - public Report getReportProfitLoss(String where, - String order, - String fromDate, - String toDate, - String trackingCategoryId, - String trackingOptionId1, - String trackingCategoryId2, - String trackingOptionId2, - boolean standardLayout, - boolean paymentsOnly) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "fromDate", fromDate); - addToMapIfNotNull(params, "toDate", toDate); - addToMapIfNotNull(params, "trackingCategoryID", trackingCategoryId); - addToMapIfNotNull(params, "trackingOptionID1", trackingOptionId1); - addToMapIfNotNull(params, "trackingCategoryID2", trackingCategoryId2); - addToMapIfNotNull(params, "trackingOptionID2", trackingOptionId2); - addToMapIfNotNull(params, "standardLayout", standardLayout); - addToMapIfNotNull(params, "paymentsOnly", paymentsOnly); - return singleResult(get("reports/ProfitAndLoss", null, params).getReports().getReport()); - } - - public Report getReportProfitLoss(String where, - String order, - String fromDate, - String toDate, - String trackingCategoryId, - String trackingOptionId1, - String trackingCategoryId2, - String trackingOptionId2, - boolean standardLayout, - boolean paymentsOnly, - Integer periods, - String timeframe) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "fromDate", fromDate); - addToMapIfNotNull(params, "toDate", toDate); - addToMapIfNotNull(params, "trackingCategoryID", trackingCategoryId); - addToMapIfNotNull(params, "trackingOptionID1", trackingOptionId1); - addToMapIfNotNull(params, "trackingCategoryID2", trackingCategoryId2); - addToMapIfNotNull(params, "trackingOptionID2", trackingOptionId2); - addToMapIfNotNull(params, "standardLayout", standardLayout); - addToMapIfNotNull(params, "paymentsOnly", paymentsOnly); - addToMapIfNotNull(params, "periods", periods); - addToMapIfNotNull(params, "timeframe", timeframe); - return singleResult(get("reports/ProfitAndLoss", null, params).getReports().getReport()); - } - - public Report getReportTrialBalance(String date, boolean paymentsOnly) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "date", date); - addToMapIfNotNull(params, "paymentsOnly", paymentsOnly); - - return singleResult(this.get("reports/TrialBalance", null, params).getReports().getReport()); - } - - //TAX RATES - public List getTaxRates() throws IOException { - Response responseObj = get("TaxRates"); - if (responseObj.getTaxRates() == null) { - ArrayOfTaxRate array = new ArrayOfTaxRate(); - return array.getTaxRate(); - } else { - return responseObj.getTaxRates().getTaxRate(); - } - } - - public List getTaxRates(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("TaxRates", modifiedAfter, params); - if (responseObj.getTaxRates() == null) { - ArrayOfTaxRate array = new ArrayOfTaxRate(); - return array.getTaxRate(); - } else { - return responseObj.getTaxRates().getTaxRate(); - } - } - - public List createTaxRates(List objects) throws IOException { - ArrayOfTaxRate array = new ArrayOfTaxRate(); - array.getTaxRate().addAll(objects); - return put("TaxRates", objFactory.createTaxRates(array)).getTaxRates().getTaxRate(); - } - - public List updateTaxRate(List objects) throws IOException { - ArrayOfTaxRate array = new ArrayOfTaxRate(); - array.getTaxRate().addAll(objects); - return post("TaxRates", objFactory.createTaxRates(array)).getTaxRates().getTaxRate(); - } - - public TaxRate getTaxRate(String id) throws IOException { - return singleResult(get("TaxRates/" + id).getTaxRates().getTaxRate()); - } - - //TRACKING CATEGORIES - public List getTrackingCategories() throws IOException { - Response responseObj = get("TrackingCategories"); - if (responseObj.getTrackingCategories() == null) { - ArrayOfTrackingCategory array = new ArrayOfTrackingCategory(); - return array.getTrackingCategory(); - } else { - return responseObj.getTrackingCategories().getTrackingCategory(); - } - } - - public List getTrackingCategories(Date modifiedAfter, String where, String order, - Boolean includeArchived) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - addToMapIfNotNull(params, "includeArchived", includeArchived); - - Response responseObj = get("TrackingCategories", modifiedAfter, params); - if (responseObj.getTrackingCategories() == null) { - ArrayOfTrackingCategory array = new ArrayOfTrackingCategory(); - return array.getTrackingCategory(); - } else { - return responseObj.getTrackingCategories().getTrackingCategory(); - } - } - - public List createTrackingCategories(List objects) throws IOException { - ArrayOfTrackingCategory array = new ArrayOfTrackingCategory(); - array.getTrackingCategory().addAll(objects); - return put("TrackingCategories", objFactory.createTrackingCategories(array)) - .getTrackingCategories() - .getTrackingCategory(); - } - - public List createTrackingCategories(List objects, boolean summarizeErrors) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "summarizeErrors", summarizeErrors); - - ArrayOfTrackingCategory array = new ArrayOfTrackingCategory(); - array.getTrackingCategory().addAll(objects); - return put("TrackingCategories", objFactory.createTrackingCategories(array), params) - .getTrackingCategories() - .getTrackingCategory(); - } - - public List updateTrackingCategory(List objects) throws IOException { - ArrayOfTrackingCategory array = new ArrayOfTrackingCategory(); - array.getTrackingCategory().addAll(objects); - return post("TrackingCategories", objFactory.createTrackingCategories(array)) - .getTrackingCategories() - .getTrackingCategory(); - } - - public List updateTrackingCategory(List objects, boolean summarizeErrors) - throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "summarizeErrors", summarizeErrors); - - ArrayOfTrackingCategory array = new ArrayOfTrackingCategory(); - array.getTrackingCategory().addAll(objects); - return post("TrackingCategories", objFactory.createTrackingCategories(array)) - .getTrackingCategories() - .getTrackingCategory(); - } - - public TrackingCategory getTrackingCategory(String id) throws IOException { - return singleResult(get("TrackingCategories/" + id).getTrackingCategories().getTrackingCategory()); - } - - public String deleteTrackingCategory(String id) throws IOException { - return delete("TrackingCategories/" + id).getStatus(); - } - - // TRACK CATEGORY OPTIONS - public List createTrackingCategoryOption(List objects, String id) - throws IOException { - ArrayOfTrackingCategoryOption array = new ArrayOfTrackingCategoryOption(); - array.getOption().addAll(objects); - return put("TrackingCategories/" + id + "/Options", objFactory.createTrackingCategoryOptions(array)) - .getOptions() - .getOption(); - } - - public List createTrackingCategoryOption(List objects, - String id, - boolean summarizeErrors) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "summarizeErrors", summarizeErrors); - System.out.println("SIZE " + objects.size()); - - ArrayOfTrackingCategoryOption array = new ArrayOfTrackingCategoryOption(); - array.getOption().addAll(objects); - return put("TrackingCategories/" + id + "/Options", objFactory.createTrackingCategoryOptions(array), params) - .getOptions() - .getOption(); - } - - public TrackingCategoryOption updateTrackingCategoryOption(TrackingCategoryOption object, - String TrackingCategoryID, - String TrackingOptionID) throws IOException { - ArrayOfTrackingCategoryOption array = new ArrayOfTrackingCategoryOption(); - array.getOption().add(object); - return post("TrackingCategories/" + TrackingCategoryID + "/Options/" + TrackingOptionID, - objFactory.createTrackingCategoryOptions(array)).getOptions().getOption().get(0); - } - - public TrackingCategoryOption updateTrackingCategoryOption(TrackingCategoryOption object, - String TrackingCategoryID, - String TrackingOptionID, - boolean summarizeErrors) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "summarizeErrors", summarizeErrors); - - ArrayOfTrackingCategoryOption array = new ArrayOfTrackingCategoryOption(); - array.getOption().add(object); - return post("TrackingCategories/" + TrackingCategoryID + "/Options/" + TrackingOptionID, - objFactory.createTrackingCategoryOptions(array)).getOptions().getOption().get(0); - } - - public String deleteTrackingCategoryOption(String TrackingCategoryID, String TrackingOptionID) throws IOException { - return delete("TrackingCategories/" + TrackingCategoryID + "/Options/" + TrackingOptionID).getStatus(); - } - - // USERS - public List getUsers() throws IOException { - Response responseObj = get("Users"); - if (responseObj.getUsers() == null) { - ArrayOfUser array = new ArrayOfUser(); - return array.getUser(); - } else { - return responseObj.getUsers().getUser(); - } - } - - public List getUsers(Date modifiedAfter, String where, String order) throws IOException { - Map params = new HashMap<>(); - addToMapIfNotNull(params, "Where", where); - addToMapIfNotNull(params, "order", order); - - Response responseObj = get("Users", modifiedAfter, params); - if (responseObj.getUsers() == null) { - ArrayOfUser array = new ArrayOfUser(); - return array.getUser(); - } else { - return responseObj.getUsers().getUser(); - } - } - - public User getUser(String id) throws IOException { - return singleResult(get("Users/" + id).getUsers().getUser()); - } - - // ATTACHMENTS - public List getAttachments(String endpoint, String guid) throws IOException { - return get(endpoint + "/" + guid + "/Attachments/", null, null).getAttachments().getAttachment(); - } - - public Attachment createAttachment(String endpoint, String guid, String filename, String contentType, byte[] bytes) - throws IOException { - return createAttachment(endpoint, guid, filename, contentType, bytes, false); - } - - public Attachment createAttachment( - final String endpoint, - final String guid, - final String filename, - final String contentType, - final byte[] bytes, - final boolean includeOnline) throws IOException { - - requireNonNull(endpoint, "endpoint must not be null"); - requireNonNull(guid, "guid must not be null"); - requireNonNull(filename, "filename must not be null"); - requireNonNull(contentType, "contentType must not be null"); - requireNonNull(bytes, "bytes must not be null"); - - final HashMap params = new HashMap(); - if (includeOnline) { - params.put("IncludeOnline", Boolean.toString(true)); - } - - final String alphaNumericFileName = normalizeFileNameForURI(filename); - return singleResult( - put( - format("%s/%s/Attachments/%s",endpoint, guid, alphaNumericFileName), - contentType, - bytes, - params - ).getAttachments().getAttachment()); - } - - - /** - * Normalizes file name with respect to https://tools.ietf.org/html/rfc3986#section-2.3 - * - * @param fileName the name of the file you are posting or putting to the API - * @return file name which does not contain invalid URI characters - */ - protected String normalizeFileNameForURI(final String fileName) { - return fileName - .trim() - .replaceAll(" ", "_") - .replaceAll("[^\\p{Alnum}\\-_.~]", ""); - } - - public String getAttachmentContent(String endpoint, String guid, String filename, String accept, String dirPath) - throws IOException { - String encodedFileName = URLEncoder.encode(filename, "UTF-8").replace("+", "%20"); - return getFile(endpoint + "/" + guid + "/Attachments/" + encodedFileName, null, null, accept, dirPath); - } - - public ByteArrayInputStream getAttachmentContent(String endpoint, String guid, String filename, String accept) - throws IOException { - String encodedFileName = URLEncoder.encode(filename, "UTF-8").replace("+", "%20"); - return getInputStream(endpoint + "/" + guid + "/Attachments/" + encodedFileName, null, null, accept); - } - - public ByteArrayInputStream getAttachmentContentById(String endpoint, String guid, String attachmentid, String accept) - throws IOException { - return getInputStream(endpoint + "/" + guid + "/Attachments/" + attachmentid, null, null, accept); - } - - //Assets - public Assets getAssets() throws XeroApiException, ParseException { - - try { - Map params = new HashMap(); - - params.put("Status","REGISTERED"); - String resource = "https://api.xero.com/assets.xro/1.0/Assets"; - String response = this.get2(resource, null, params); - - TypeReference typeRef = new TypeReference() {}; - ApiClient apiClient = new ApiClient(); - - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.convertException(e); - } - } - - protected String get2(String resource, Date modifiedAfter, Map params) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource(config, signerFactory, resource, "GET", null, params,"application/json"); - req.setToken(token); - req.setTokenSecret(tokenSecret); - if (modifiedAfter != null) { - req.setIfModifiedSince(modifiedAfter); - } - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } -} diff --git a/src/main/java/com/xero/api/XeroClientException.java b/src/main/java/com/xero/api/XeroClientException.java deleted file mode 100644 index bc40aa5a..00000000 --- a/src/main/java/com/xero/api/XeroClientException.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.xero.api; - -/** - * Exception thrown by Xero Java API if there is an error which is not related - * to remote API calls (like for example no config). - * - * @author GideonLeGrange gideon@legrange.me - */ -public class XeroClientException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = 1L; - /** - * Create new exception. - * - * @param message Error message - */ - public XeroClientException(String message) { - super(message); - } - - /** - * Create new exception. - * - * @param message Error message - * @param cause Original exception causing this error. - */ - public XeroClientException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/src/main/java/com/xero/api/XeroHttpContext.java b/src/main/java/com/xero/api/XeroHttpContext.java deleted file mode 100644 index 51c358a8..00000000 --- a/src/main/java/com/xero/api/XeroHttpContext.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.xero.api; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; -import java.security.cert.CertificateException; -import java.util.ArrayList; -import java.util.List; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManagerFactory; - -import org.apache.http.Header; -import org.apache.http.HttpHeaders; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.message.BasicHeader; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class XeroHttpContext { - private Config config; - private String accept; - private String ifModifiedSince = null; - final static Logger logger = LogManager.getLogger(XeroHttpContext.class); - - public XeroHttpContext(Config config) - { - this.config = config; - } - - public XeroHttpContext(Config config,String accept, String ifModifiedSince) - { - this.config = config; - this.accept = accept; - this.ifModifiedSince = ifModifiedSince; - } - - public CloseableHttpClient getHttpClient() throws FileNotFoundException, IOException - { - CloseableHttpClient httpclient = null; - - Header acceptHeader = new BasicHeader( HttpHeaders.ACCEPT, this.accept != null ? this.accept : config.getAccept()); - Header userAgentHeader = new BasicHeader( HttpHeaders.USER_AGENT, config.getUserAgent()); - - List
headers = new ArrayList
(); - headers.add(acceptHeader); - headers.add(userAgentHeader); - - if(logger.isDebugEnabled()){ - logger.debug("------------------ HEADER : USER AGENT -------------------"); - logger.debug(userAgentHeader); - logger.debug("------------------ HEADER : ACCEPT -------------------"); - logger.debug(acceptHeader); - } - - if(this.ifModifiedSince != null) { - Header modifiedHeader = new BasicHeader( HttpHeaders.IF_MODIFIED_SINCE, this.ifModifiedSince); - headers.add(modifiedHeader); - if(logger.isDebugEnabled()){ - logger.debug("------------------ HEADER : IF MODIFIED SINCE -------------------"); - logger.debug(modifiedHeader); - } - } - - if ((config.getKeyStorePath() == null || config.getKeyStorePath().length() == 0) && (config.getKeyStorePassword() == null || config.getKeyStorePassword().length() == 0)) - { - if(logger.isTraceEnabled()){ - logger.trace("You must use Java 1.8 to skip setting the Key Store Path & Key Store Password in config.json"); - } - httpclient = HttpClients.custom().setDefaultHeaders(headers).build(); - - } else { - if(logger.isTraceEnabled()){ - logger.trace("Key Store Path & Key Store Password in config.json will be used to set the SSLContext and force TLS 1.2"); - } - - KeyStore keyStore = null; - try(FileInputStream in = new FileInputStream(config.getKeyStorePath())) { - keyStore = KeyStore.getInstance("JKS"); - keyStore.load(in, config.getKeyStorePassword().toCharArray()); - } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException e1) { - logger.error(e1); - } - - TrustManagerFactory tmf = null; - try { - tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - tmf.init(keyStore); - } catch (NoSuchAlgorithmException | KeyStoreException e) { - logger.error(e); - } - - SSLContext ctx = null; - try { - ctx = SSLContext.getInstance("TLS"); - ctx.init(null, tmf.getTrustManagers(), new SecureRandom()); - } catch (NoSuchAlgorithmException | KeyManagementException e) { - logger.error(e); - } - - SSLContext.setDefault(ctx); - - SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( - ctx, - new String[] { "TLSv1.2" }, - new String[] {"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256","TLS_RSA_WITH_AES_128_CBC_SHA256","TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256","TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256","TLS_DHE_RSA_WITH_AES_128_CBC_SHA256","TLS_DHE_DSS_WITH_AES_128_CBC_SHA256","TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA","TLS_RSA_WITH_AES_128_CBC_SHA","TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA","TLS_ECDH_RSA_WITH_AES_128_CBC_SHA","TLS_DHE_RSA_WITH_AES_128_CBC_SHA","TLS_DHE_DSS_WITH_AES_128_CBC_SHA","TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA","TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA","TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA","TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA","TLS_EMPTY_RENEGOTIATION_INFO_SCSV"}, - SSLConnectionSocketFactory.getDefaultHostnameVerifier()); - - httpclient = HttpClients.custom() - .setSSLSocketFactory(sslsf) - .setDefaultHeaders(headers) - .build(); - } - - return httpclient; - } -} \ No newline at end of file diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index d61ad406..d9c4d91b 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -52,9 +52,22 @@ import com.xero.models.accounting.Users; import com.fasterxml.jackson.core.type.TypeReference; -import com.xero.api.exception.XeroExceptionHandler; -import com.xero.model.*; -import com.xero.api.*; +import com.google.api.client.http.GenericUrl; +import com.google.api.client.http.HttpContent; +import com.google.api.client.http.InputStreamContent; +import com.google.api.client.http.HttpMethods; +import com.google.api.client.http.HttpResponse; +import com.google.api.client.json.Json; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.ArrayList; + +//import com.xero.api.exception.XeroExceptionHandler; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; @@ -63,51 +76,23 @@ import org.apache.logging.log4j.Logger; import java.io.ByteArrayInputStream; -import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.util.TimeZone; import java.util.regex.Pattern; import javax.ws.rs.core.UriBuilder; + public class AccountingApi { private ApiClient apiClient; - private XeroExceptionHandler xeroExceptionHandler; - private Config config; - private SignerFactory signerFactory; - private String token = null; - private String tokenSecret = null; - final static Logger logger = LogManager.getLogger(XeroClient.class); - protected static final DateFormat utcFormatter; - - static { - utcFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); - utcFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); - } - - protected static final Pattern MESSAGE_PATTERN = Pattern.compile("(.*)"); - protected final ObjectFactory objFactory = new ObjectFactory(); - - - public AccountingApi(Config config) { - this(config, new ConfigBasedSignerFactory(config)); - this.xeroExceptionHandler = new XeroExceptionHandler(); - } - public AccountingApi(Config config, SignerFactory signerFactory) { - this.config = config; - this.signerFactory = signerFactory; - this.xeroExceptionHandler = new XeroExceptionHandler(); + public AccountingApi() { + this(new ApiClient()); } public AccountingApi(ApiClient apiClient) { - this(JsonConfig.getInstance()); - this.xeroExceptionHandler = new XeroExceptionHandler(); this.apiClient = apiClient; } @@ -119,2666 +104,7600 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } - public void setOAuthToken(String token, String tokenSecret) { - this.token = token; - this.tokenSecret = tokenSecret; - } - - - protected String DATA(String url, String body, Map params, String method) throws IOException { - return this.DATA(url,body,params,method,null, "application/json"); - } - - protected String DATA(String url, String body, Map params, String method, OffsetDateTime ifModifiedSince) throws IOException { - return this.DATA(url,body,params,method,ifModifiedSince,"application/json"); - } - - protected String DATA(String url, String body, Map params, String method, String contentType) throws IOException { - return this.DATA(url,body,params,method,null,contentType); - } - - protected String DATA(String url, String body, Map params, String method, OffsetDateTime ifModifiedSince, String contentType) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - contentType, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - if (ifModifiedSince != null) { - req.setIfModifiedSince(ifModifiedSince); - } - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - protected String DATA(String url, String body, Map params, String method, String xeroApplicationId, String xeroTenantId, String xeroUserId) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - null, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - //if (ifModifiedSince != null) { - // req.setIfModifiedSince(ifModifiedSince); - //} - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - - protected ByteArrayInputStream FILE(String url, String body, Map params, String method) throws IOException { - return this.FILE(url,body,params,method,"application/octet-stream"); - } - - protected ByteArrayInputStream FILE(String url, String body, Map params, String method, String accept) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - accept, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - ByteArrayInputStream resp = req.executefile(); - return resp; - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - protected String FILE(String url, String body, Map params, String method, byte[] byteBody) throws IOException { - return this.FILE(url,body,params,method,byteBody,"application/octet-stream"); - } - - protected String FILE(String url, String body, Map params, String method, byte[] byteBody, String contentType) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - contentType, - byteBody, - params, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } + /** + * Allows you to create a new chart of accounts + *

200 - Success - created new Account and return response of type Accounts array with new Account + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param account Request of type Account + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts createAccount(String xeroTenantId, Account account) throws IOException { + HttpResponse response = createAccountForHttpResponse(xeroTenantId, account); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } /** * Allows you to create a new chart of accounts *

200 - Success - created new Account and return response of type Accounts array with new Account *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant * @param account Request of type Account + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts createAccount(Account account) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Accounts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public Accounts createAccount(String xeroTenantId, Account account, Map params) throws IOException { + HttpResponse response = createAccountForHttpResponse(xeroTenantId, account, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(account); + public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account account) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); + }// verify the required parameter 'account' is set + if (account == null) { + throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(account); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createAccountForHttpResponse(String xeroTenantId, java.io.InputStream account, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); + }// verify the required parameter 'account' is set + if (account == null) { + throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = account == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, account); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account account, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); + }// verify the required parameter 'account' is set + if (account == null) { + throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(account); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create Attachment on Account *

200 - Success - return response of type Attachments array of Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param fileName Name of the attachment * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createAccountAttachmentByFileName(UUID accountID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create Attachment on Account + *

200 - Success - return response of type Attachments array of Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param fileName Name of the attachment + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "PUT", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create a spend or receive money transaction *

200 - Success - return response of type BankTransactions array with new BankTransaction *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactions The bankTransactions parameter * @param summarizeErrors response format that shows validation errors for each bank transaction * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions createBankTransaction(BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransactions"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (summarizeErrors != null) { - addToMapIfNotNull(params, "SummarizeErrors", summarizeErrors); + public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + HttpResponse response = createBankTransactionForHttpResponse(xeroTenantId, bankTransactions, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with new BankTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactions The bankTransactions parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Map params) throws IOException { + HttpResponse response = createBankTransactionForHttpResponse(xeroTenantId, bankTransactions, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - strBody = apiClient.getObjectMapper().writeValueAsString(bankTransactions); + } - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, java.io.InputStream bankTransactions, Boolean summarizeErrors, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = bankTransactions == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, BankTransactions bankTransactions, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to createa an Attachment on BankTransaction by Filename *

200 - Success - return response of Attachments array of Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param fileName The name of the file being attached * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransactionAttachmentByFileName(UUID bankTransactionID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to createa an Attachment on BankTransaction by Filename + *

200 - Success - return response of Attachments array of Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param fileName The name of the file being attached + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "PUT", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create history record for a bank transactions *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBankTransactionHistoryRecord(UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransactions/{BankTransactionID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(xeroTenantId, bankTransactionID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create history record for a bank transactions + *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(xeroTenantId, bankTransactionID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a bank transfers + *

200 - Success - return response of BankTransfers array of one BankTransfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransfers The bankTransfers parameter + * @return BankTransfers + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers) throws IOException { + HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to create a bank transfers *

200 - Success - return response of BankTransfers array of one BankTransfer *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransfers The bankTransfers parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers createBankTransfer(BankTransfers bankTransfers) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransfers"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers, Map params) throws IOException { + HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(bankTransfers); + public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankTransfers bankTransfers) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); + }// verify the required parameter 'bankTransfers' is set + if (bankTransfers == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, java.io.InputStream bankTransfers, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); + }// verify the required parameter 'bankTransfers' is set + if (bankTransfers == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = bankTransfers == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransfers); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankTransfers bankTransfers, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); + }// verify the required parameter 'bankTransfers' is set + if (bankTransfers == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param fileName The name of the file being attached to a Bank Transfer * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransferAttachmentByFileName(UUID bankTransferID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param fileName The name of the file being attached to a Bank Transfer + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "PUT", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** *

200 - Success - return response HistoryRecords array with the newly created HistoryRecord for a Bank Transfer *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBankTransferHistoryRecord(UUID bankTransferID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransfers/{BankTransferID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBankTransferHistoryRecordForHttpResponse(xeroTenantId, bankTransferID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + *

200 - Success - return response HistoryRecords array with the newly created HistoryRecord for a Bank Transfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createBankTransferHistoryRecordForHttpResponse(xeroTenantId, bankTransferID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Create one or many BatchPayments for invoices + *

200 - Success - return response of type BatchPayments array of BatchPayment objects + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects + * @return BatchPayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments) throws IOException { + HttpResponse response = createBatchPaymentForHttpResponse(xeroTenantId, batchPayments); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Create one or many BatchPayments for invoices *

200 - Success - return response of type BatchPayments array of BatchPayment objects *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public BatchPayments createBatchPayment(BatchPayments batchPayments) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BatchPayments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments, Map params) throws IOException { + HttpResponse response = createBatchPaymentForHttpResponse(xeroTenantId, batchPayments, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(batchPayments); + public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, BatchPayments batchPayments) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); + }// verify the required parameter 'batchPayments' is set + if (batchPayments == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, java.io.InputStream batchPayments, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); + }// verify the required parameter 'batchPayments' is set + if (batchPayments == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = batchPayments == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, batchPayments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, BatchPayments batchPayments, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); + }// verify the required parameter 'batchPayments' is set + if (batchPayments == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create a history record for a Batch Payment *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param batchPaymentID Unique identifier for BatchPayment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBatchPaymentHistoryRecord(UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BatchPayments/{BatchPaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BatchPayments/{BatchPaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(xeroTenantId, batchPaymentID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create a history record for a Batch Payment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param batchPaymentID Unique identifier for BatchPayment + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(xeroTenantId, batchPaymentID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BatchPaymentID", batchPaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BatchPaymentID", batchPaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BatchPaymentID", batchPaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allow for the creation of new custom payment service for specified Branding Theme *

200 - Success - return response of type PaymentServices array with newly created PaymentService *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param brandingThemeID Unique identifier for a Branding Theme * @param paymentService The paymentService parameter * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices createBrandingThemePaymentServices(UUID brandingThemeID, PaymentService paymentService) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { + HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, paymentService); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allow for the creation of new custom payment service for specified Branding Theme + *

200 - Success - return response of type PaymentServices array with newly created PaymentService + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param brandingThemeID Unique identifier for a Branding Theme + * @param paymentService The paymentService parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService, Map params) throws IOException { + HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, paymentService, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(paymentService); + public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'paymentService' is set + if (paymentService == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, java.io.InputStream paymentService, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'paymentService' is set + if (paymentService == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = paymentService == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentService); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'paymentService' is set + if (paymentService == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + *

200 - Success - return response of type Contacts array with newly created Contact + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param contact The contact parameter + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts createContact(String xeroTenantId, Contact contact) throws IOException { + HttpResponse response = createContactForHttpResponse(xeroTenantId, contact); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** *

200 - Success - return response of type Contacts array with newly created Contact *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant * @param contact The contact parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts createContact(Contact contact) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public Contacts createContact(String xeroTenantId, Contact contact, Map params) throws IOException { + HttpResponse response = createContactForHttpResponse(xeroTenantId, contact, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(contact); + public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact contact) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); + }// verify the required parameter 'contact' is set + if (contact == null) { + throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(contact); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createContactForHttpResponse(String xeroTenantId, java.io.InputStream contact, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); + }// verify the required parameter 'contact' is set + if (contact == null) { + throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = contact == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contact); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact contact, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); + }// verify the required parameter 'contact' is set + if (contact == null) { + throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contact); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** *

200 - Success - return response of type Attachments array with an newly created Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param fileName Name for the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createContactAttachmentByFileName(UUID contactID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - - String response = this.FILE(url, strBody, params, "PUT", body); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } + public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** - * Allows you to create a contact group - *

200 - Success - return response of type Contact Groups array of newly created Contact Group - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param contactGroups The contactGroups parameter + *

200 - Success - return response of type Attachments array with an newly created Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param fileName Name for the file you are attaching + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a contact group + *

200 - Success - return response of type Contact Groups array of newly created Contact Group + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroups an array of contact groups with names specified + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups) throws IOException { + HttpResponse response = createContactGroupForHttpResponse(xeroTenantId, contactGroups); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a contact group + *

200 - Success - return response of type Contact Groups array of newly created Contact Group + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroups an array of contact groups with names specified + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups createContactGroup(ContactGroups contactGroups) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ContactGroups"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups, Map params) throws IOException { + HttpResponse response = createContactGroupForHttpResponse(xeroTenantId, contactGroups, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(contactGroups); + public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, ContactGroups contactGroups) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, java.io.InputStream contactGroups, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = contactGroups == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, ContactGroups contactGroups, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to add Contacts to a Contract Group *

200 - Success - return response of type Contacts array of added Contacts *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group - * @param contacts The contacts parameter + * @param contacts an array of contacts with ContactID to be added to ContactGroup * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts createContactGroupContacts(UUID contactGroupID, Contacts contacts) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { + HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to add Contacts to a Contract Group + *

200 - Success - return response of type Contacts array of added Contacts + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param contacts an array of contacts with ContactID to be added to ContactGroup + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts, Map params) throws IOException { + HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(contacts); + public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, java.io.InputStream contacts, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = contacts == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Contacts contacts, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to retrieve a history records of an Contact *

200 - Success - return response of type History Records array of newly created History Record for a specific Contact *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createContactHistory(UUID contactID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts/{ContactID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createContactHistoryForHttpResponse(xeroTenantId, contactID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to retrieve a history records of an Contact + *

200 - Success - return response of type History Records array of newly created History Record for a specific Contact + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createContactHistoryForHttpResponse(xeroTenantId, contactID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create a credit note *

200 - Success - return response of type Credit Notes array of newly created CreditNote *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNotes an array of Credit Notes with a single CreditNote object. * @param summarizeErrors shows validation errors for each credit note - * @param creditNotes The creditNotes parameter * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes createCreditNote(Boolean summarizeErrors, CreditNotes creditNotes) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (summarizeErrors != null) { - addToMapIfNotNull(params, "SummarizeErrors", summarizeErrors); + public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + HttpResponse response = createCreditNoteForHttpResponse(xeroTenantId, creditNotes, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a credit note + *

200 - Success - return response of type Credit Notes array of newly created CreditNote + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNotes an array of Credit Notes with a single CreditNote object. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Map params) throws IOException { + HttpResponse response = createCreditNoteForHttpResponse(xeroTenantId, creditNotes, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - strBody = apiClient.getObjectMapper().writeValueAsString(creditNotes); + } - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, java.io.InputStream creditNotes, Boolean summarizeErrors, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = creditNotes == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditNotes creditNotes, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create Allocation on CreditNote *

200 - Success - return response of type Allocations array with newly created Allocation for specific Credit Note *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note - * @param allocations The allocations parameter + * @param allocations an array of Allocations with single Allocation object defined. * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createCreditNoteAllocation(UUID creditNoteID, Allocations allocations) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes/{CreditNoteID}/Allocations"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Allocations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { + HttpResponse response = createCreditNoteAllocationForHttpResponse(xeroTenantId, creditNoteID, allocations); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create Allocation on CreditNote + *

200 - Success - return response of type Allocations array with newly created Allocation for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param allocations an array of Allocations with single Allocation object defined. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Allocations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations, Map params) throws IOException { + HttpResponse response = createCreditNoteAllocationForHttpResponse(xeroTenantId, creditNoteID, allocations, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(allocations); + public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream allocations, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = allocations == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, Allocations allocations, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create Attachments on CreditNote by file name *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param fileName Name of the file you are attaching to Credit Note * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createCreditNoteAttachmentByFileName(UUID creditNoteID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create Attachments on CreditNote by file name + *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param fileName Name of the file you are attaching to Credit Note + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "PUT", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to retrieve a history records of an CreditNote *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Credit Note *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createCreditNoteHistory(UUID creditNoteID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes/{CreditNoteID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to retrieve a history records of an CreditNote + *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency + * @param xeroTenantId Xero identifier for Tenant + * @param currencies The currencies parameter + * @return Currencies + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Currencies createCurrency(String xeroTenantId, Currencies currencies) throws IOException { + HttpResponse response = createCurrencyForHttpResponse(xeroTenantId, currencies); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency + * @param xeroTenantId Xero identifier for Tenant * @param currencies The currencies parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Currencies * @throws IOException if an error occurs while attempting to invoke the API **/ - public Currencies createCurrency(Currencies currencies) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Currencies"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public Currencies createCurrency(String xeroTenantId, Currencies currencies, Map params) throws IOException { + HttpResponse response = createCurrencyForHttpResponse(xeroTenantId, currencies, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(currencies); + public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencies currencies) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); + }// verify the required parameter 'currencies' is set + if (currencies == null) { + throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, java.io.InputStream currencies, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); + }// verify the required parameter 'currencies' is set + if (currencies == null) { + throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = currencies == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, currencies); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencies currencies, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); + }// verify the required parameter 'currencies' is set + if (currencies == null) { + throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create new employees used in Xero payrun + *

200 - Success - return response of type Employees array with new Employee + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param employees The employees parameter + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees createEmployee(String xeroTenantId, Employees employees) throws IOException { + HttpResponse response = createEmployeeForHttpResponse(xeroTenantId, employees); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to create new employees used in Xero payrun *

200 - Success - return response of type Employees array with new Employee *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param employees The employees parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees createEmployee(Employees employees) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Employees"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public Employees createEmployee(String xeroTenantId, Employees employees, Map params) throws IOException { + HttpResponse response = createEmployeeForHttpResponse(xeroTenantId, employees, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(employees); + public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees employees) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, java.io.InputStream employees, String mediaType) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = employees == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees employees, Map params) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to retrieve expense claims *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param expenseClaims The expenseClaims parameter * @param summarizeErrors shows validation errors for each expense claim * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims createExpenseClaim(ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ExpenseClaims"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (summarizeErrors != null) { - addToMapIfNotNull(params, "SummarizeErrors", summarizeErrors); + public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve expense claims + *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaims The expenseClaims parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Map params) throws IOException { + HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - strBody = apiClient.getObjectMapper().writeValueAsString(expenseClaims); + } - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, java.io.InputStream expenseClaims, Boolean summarizeErrors, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = expenseClaims == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, ExpenseClaims expenseClaims, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create a history records of an ExpenseClaim *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims + * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createExpenseClaimHistory(UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create a history records of an ExpenseClaim + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create any sales invoices or purchase bills *

200 - Success - return response of type Invoices array with newly created Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoices The invoices parameter * @param summarizeErrors shows validation errors for each invoice * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices createInvoice(Invoices invoices, Boolean summarizeErrors) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (summarizeErrors != null) { - addToMapIfNotNull(params, "SummarizeErrors", summarizeErrors); + public Invoices createInvoice(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + HttpResponse response = createInvoiceForHttpResponse(xeroTenantId, invoices, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create any sales invoices or purchase bills + *

200 - Success - return response of type Invoices array with newly created Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoices The invoices parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices createInvoice(String xeroTenantId, Invoices invoices, Map params) throws IOException { + HttpResponse response = createInvoiceForHttpResponse(xeroTenantId, invoices, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - strBody = apiClient.getObjectMapper().writeValueAsString(invoices); + } - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, java.io.InputStream invoices, Boolean summarizeErrors, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = invoices == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices invoices, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create an Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of type Attachments array with newly created Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param fileName Name of the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createInvoiceAttachmentByFileName(UUID invoiceID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create an Attachment on invoices or purchase bills by it's filename + *

200 - Success - return response of type Attachments array with newly created Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param fileName Name of the file you are attaching + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "PUT", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to retrieve a history records of an invoice *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createInvoiceHistory(UUID invoiceID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to retrieve a history records of an invoice + *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create an item + *

200 - Success - return response of type Items array with newly created Item + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param items The items parameter + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items createItem(String xeroTenantId, Items items) throws IOException { + HttpResponse response = createItemForHttpResponse(xeroTenantId, items); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to create an item *

200 - Success - return response of type Items array with newly created Item *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param items The items parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items createItem(Items items) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Items"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public Items createItem(String xeroTenantId, Items items, Map params) throws IOException { + HttpResponse response = createItemForHttpResponse(xeroTenantId, items, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(items); + public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(items); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createItemForHttpResponse(String xeroTenantId, java.io.InputStream items, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = items == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(items); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create a history record for items *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items + * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createItemHistory(UUID itemID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Items/{ItemID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createItemHistoryForHttpResponse(xeroTenantId, itemID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create a history record for items + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createItemHistoryForHttpResponse(xeroTenantId, itemID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactions The linkedTransactions parameter + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { + HttpResponse response = createLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactions); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to create linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactions The linkedTransactions parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions createLinkedTransaction(LinkedTransactions linkedTransactions) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/LinkedTransactions"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions, Map params) throws IOException { + HttpResponse response = createLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactions, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(linkedTransactions); + public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, java.io.InputStream linkedTransactions, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = linkedTransactions == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, LinkedTransactions linkedTransactions, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a manual journal + *

200 - Success - return response of type ManualJournals array with newly created ManualJournal + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournals The manualJournals parameter + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals) throws IOException { + HttpResponse response = createManualJournalForHttpResponse(xeroTenantId, manualJournals); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to create a manual journal *

200 - Success - return response of type ManualJournals array with newly created ManualJournal *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param manualJournals The manualJournals parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals createManualJournal(ManualJournals manualJournals) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ManualJournals"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals, Map params) throws IOException { + HttpResponse response = createManualJournalForHttpResponse(xeroTenantId, manualJournals, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(manualJournals); + public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, ManualJournals manualJournals) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, java.io.InputStream manualJournals, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = manualJournals == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, ManualJournals manualJournals, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create a specified Attachment on ManualJournal by file name *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param fileName The name of the file being attached to a ManualJournal * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createManualJournalAttachmentByFileName(UUID manualJournalID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create a specified Attachment on ManualJournal by file name + *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param fileName The name of the file being attached to a ManualJournal + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "PUT", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to retrieve Allocations for overpayments *

200 - Success - return response of type Allocations array with all Allocation for Overpayments *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment * @param allocations The allocations parameter * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createOverpaymentAllocation(UUID overpaymentID, Allocations allocations) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Overpayments/{OverpaymentID}/Allocations"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/Allocations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { + HttpResponse response = createOverpaymentAllocationForHttpResponse(xeroTenantId, overpaymentID, allocations); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to retrieve Allocations for overpayments + *

200 - Success - return response of type Allocations array with all Allocation for Overpayments + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @param allocations The allocations parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Allocations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations, Map params) throws IOException { + HttpResponse response = createOverpaymentAllocationForHttpResponse(xeroTenantId, overpaymentID, allocations, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(allocations); + public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, java.io.InputStream allocations, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = allocations == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, Allocations allocations, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create history records of an Overpayment *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Overpayments *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Overpayments + * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createOverpaymentHistory(UUID overpaymentID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Overpayments/{OverpaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create history records of an Overpayment + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Overpayments + *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create payments for invoices and credit notes + *

200 - Success - return response of type Payments array for newly created Payment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param payments The payments parameter + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments createPayment(String xeroTenantId, Payments payments) throws IOException { + HttpResponse response = createPaymentForHttpResponse(xeroTenantId, payments); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to create payments for invoices and credit notes *

200 - Success - return response of type Payments array for newly created Payment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param payments The payments parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments createPayment(Payments payments) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Payments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public Payments createPayment(String xeroTenantId, Payments payments, Map params) throws IOException { + HttpResponse response = createPaymentForHttpResponse(xeroTenantId, payments, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(payments); + public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments payments) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createPaymentForHttpResponse(String xeroTenantId, java.io.InputStream payments, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = payments == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments payments, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create a history record for a payment *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Payments + * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPaymentHistory(UUID paymentID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Payments/{PaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPaymentHistoryForHttpResponse(xeroTenantId, paymentID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create a history record for a payment + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments + *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Payments + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createPaymentHistoryForHttpResponse(xeroTenantId, paymentID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + + /** + * Allows you to create payment services + *

200 - Success - return response of type PaymentServices array for newly created PaymentService + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param paymentServices The paymentServices parameter + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices) throws IOException { + HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + /** * Allows you to create payment services *

200 - Success - return response of type PaymentServices array for newly created PaymentService *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param paymentServices The paymentServices parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices createPaymentService(PaymentServices paymentServices) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/PaymentServices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices, Map params) throws IOException { + HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(paymentServices); + public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, PaymentServices paymentServices) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); + }// verify the required parameter 'paymentServices' is set + if (paymentServices == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, java.io.InputStream paymentServices, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); + }// verify the required parameter 'paymentServices' is set + if (paymentServices == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = paymentServices == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentServices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, PaymentServices paymentServices, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); + }// verify the required parameter 'paymentServices' is set + if (paymentServices == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create an Allocation for prepayments *

200 - Success - return response of type Allocations array of Allocation for all Prepayment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID The prepaymentID parameter * @param allocations The allocations parameter * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createPrepaymentAllocation(UUID prepaymentID, Allocations allocations) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Prepayments/{PrepaymentID}/Allocations"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/Allocations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { + HttpResponse response = createPrepaymentAllocationForHttpResponse(xeroTenantId, prepaymentID, allocations); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create an Allocation for prepayments + *

200 - Success - return response of type Allocations array of Allocation for all Prepayment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID The prepaymentID parameter + * @param allocations The allocations parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Allocations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations, Map params) throws IOException { + HttpResponse response = createPrepaymentAllocationForHttpResponse(xeroTenantId, prepaymentID, allocations, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(allocations); + public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, java.io.InputStream allocations, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = allocations == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, Allocations allocations, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create a history record for an Prepayment *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PrePayment *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims + * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID Unique identifier for a PrePayment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPrepaymentHistory(UUID prepaymentID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Prepayments/{PrepaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); - - String response = this.DATA(url, strBody, params, "PUT"); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } + public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** - * Allows you to create purchase orders + * Allows you to create a history record for an Prepayment + *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PrePayment + *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID Unique identifier for a PrePayment + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create purchase orders *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrders The purchaseOrders parameter * @param summarizeErrors shows validation errors for each purchase order. * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders createPurchaseOrder(PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/PurchaseOrders"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (summarizeErrors != null) { - addToMapIfNotNull(params, "SummarizeErrors", summarizeErrors); + public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + HttpResponse response = createPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrders, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create purchase orders + *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrders The purchaseOrders parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Map params) throws IOException { + HttpResponse response = createPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrders, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - strBody = apiClient.getObjectMapper().writeValueAsString(purchaseOrders); + } - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, java.io.InputStream purchaseOrders, Boolean summarizeErrors, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = purchaseOrders == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, PurchaseOrders purchaseOrders, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create HistoryRecord for purchase orders *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PurchaseOrder *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPurchaseOrderHistory(UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create HistoryRecord for purchase orders + *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PurchaseOrder + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create draft expense claim receipts for any user + *

200 - Success - return response of type Receipts array for newly created Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receipts The receipts parameter + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts createReceipt(String xeroTenantId, Receipts receipts) throws IOException { + HttpResponse response = createReceiptForHttpResponse(xeroTenantId, receipts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to create draft expense claim receipts for any user *

200 - Success - return response of type Receipts array for newly created Receipt *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param receipts The receipts parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts createReceipt(Receipts receipts) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Receipts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public Receipts createReceipt(String xeroTenantId, Receipts receipts, Map params) throws IOException { + HttpResponse response = createReceiptForHttpResponse(xeroTenantId, receipts, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(receipts); + public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts receipts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createReceiptForHttpResponse(String xeroTenantId, java.io.InputStream receipts, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = receipts == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts receipts, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create Attachment on expense claim receipts by file name *

200 - Success - return response of type Attachments array with newly created Attachment for a specified Receipt *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param fileName The name of the file being attached to the Receipt * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createReceiptAttachmentByFileName(UUID receiptID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create Attachment on expense claim receipts by file name + *

200 - Success - return response of type Attachments array with newly created Attachment for a specified Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param fileName The name of the file being attached to the Receipt + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "PUT", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to retrieve a history records of an Receipt *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createReceiptHistory(UUID receiptID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Receipts/{ReceiptID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createReceiptHistoryForHttpResponse(xeroTenantId, receiptID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to retrieve a history records of an Receipt + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts + *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createReceiptHistoryForHttpResponse(xeroTenantId, receiptID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create attachment on repeating invoices by file name *

200 - Success - return response of type Attachments array with updated Attachment for a specified Repeating Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param fileName The name of the file being attached to a Repeating Invoice * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createRepeatingInvoiceAttachmentByFileName(UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create attachment on repeating invoices by file name + *

200 - Success - return response of type Attachments array with updated Attachment for a specified Repeating Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param fileName The name of the file being attached to a Repeating Invoice + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "PUT", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create history for a repeating invoice *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createRepeatingInvoiceHistory(UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create history for a repeating invoice + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(historyRecords); + public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + + /** + * Allows you to create Tax Rates + *

200 - Success - return response of type TaxRates array newly created TaxRate + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param taxRates The taxRates parameter + * @return TaxRates + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { + HttpResponse response = createTaxRateForHttpResponse(xeroTenantId, taxRates); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + /** * Allows you to create Tax Rates *

200 - Success - return response of type TaxRates array newly created TaxRate *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param taxRates The taxRates parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates createTaxRate(TaxRates taxRates) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/TaxRates"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { + HttpResponse response = createTaxRateForHttpResponse(xeroTenantId, taxRates, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(taxRates); + public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, java.io.InputStream taxRates, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = taxRates == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create tracking categories + *

200 - Success - return response of type TrackingCategories array of newly created TrackingCategory + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategory The trackingCategory parameter + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory) throws IOException { + HttpResponse response = createTrackingCategoryForHttpResponse(xeroTenantId, trackingCategory); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to create tracking categories *

200 - Success - return response of type TrackingCategories array of newly created TrackingCategory *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategory The trackingCategory parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories createTrackingCategory(TrackingCategory trackingCategory) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/TrackingCategories"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory, Map params) throws IOException { + HttpResponse response = createTrackingCategoryForHttpResponse(xeroTenantId, trackingCategory, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(trackingCategory); + public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, TrackingCategory trackingCategory) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, java.io.InputStream trackingCategory, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = trackingCategory == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, TrackingCategory trackingCategory, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); } + + /** * Allows you to create options for a specified tracking category *

200 - Success - return response of type TrackingOptions array of options for a specified category *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @param trackingOption The trackingOption parameter * @return TrackingOptions * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingOptions createTrackingOptions(UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}/Options"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { + HttpResponse response = createTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOption); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to create options for a specified tracking category + *

200 - Success - return response of type TrackingOptions array of options for a specified category + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param trackingOption The trackingOption parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TrackingOptions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption, Map params) throws IOException { + HttpResponse response = createTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOption, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(trackingOption); + public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); + }// verify the required parameter 'trackingOption' is set + if (trackingOption == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); - String response = this.DATA(url, strBody, params, "PUT"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, java.io.InputStream trackingOption, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); + }// verify the required parameter 'trackingOption' is set + if (trackingOption == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = trackingOption == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingOption); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); + }// verify the required parameter 'trackingOption' is set + if (trackingOption == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to delete a chart of accounts + *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for retrieving single object + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to delete a chart of accounts *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for retrieving single object + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts deleteAccount(UUID accountID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Accounts/{AccountID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Accounts deleteAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { + HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); - - String response = this.DATA(url, strBody, params, "DELETE"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); } + + /** * Allows you to delete a specific Contact from a Contract Group *

204 - Success - return response 204 no content *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group * @param contactID Unique identifier for a Contact * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteContactGroupContact(UUID contactGroupID, UUID contactID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID.toString()); - uriVariables.put("ContactID", contactID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "DELETE"); - - - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } + public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { + deleteContactGroupContactForHttpResponse(xeroTenantId, contactGroupID, contactID); } + /** - * Allows you to delete all Contacts from a Contract Group - *

200 - Success - return response 204 no content + * Allows you to delete a specific Contact from a Contract Group + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group + * @param contactID Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteContactGroupContacts(UUID contactGroupID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID, Map params) throws IOException { + deleteContactGroupContactForHttpResponse(xeroTenantId, contactGroupID, contactID, params); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"); - - String response = this.DATA(url, strBody, params, "DELETE"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId, UUID contactGroupID, UUID contactID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); } - } - /** - * Allows you to delete a specified item + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + + /** + * Allows you to delete all Contacts from a Contract Group + *

200 - Success - return response 204 no content + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID) throws IOException { + deleteContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID); + } + + /** + * Allows you to delete all Contacts from a Contract Group + *

200 - Success - return response 204 no content + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { + deleteContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, params); + } + + public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + + /** + * Allows you to delete a specified item + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteItem(String xeroTenantId, UUID itemID) throws IOException { + deleteItemForHttpResponse(xeroTenantId, itemID); + } + + /** + * Allows you to delete a specified item *

204 - Success - return response 204 no content *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteItem(UUID itemID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Items/{ItemID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public void deleteItem(String xeroTenantId, UUID itemID, Map params) throws IOException { + deleteItemForHttpResponse(xeroTenantId, itemID, params); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); - - String response = this.DATA(url, strBody, params, "DELETE"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + + /** + * Allows you to delete a specified linked transactions (billable expenses) + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { + deleteLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); } + /** * Allows you to delete a specified linked transactions (billable expenses) *

204 - Success - return response 204 no content *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteLinkedTransaction(UUID linkedTransactionID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { + deleteLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, params); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); - - String response = this.DATA(url, strBody, params, "DELETE"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); } + + /** * Allows you to update a specified payment for invoices and credit notes *

200 - Success - return response of type Payments array for updated Payment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment * @param payments The payments parameter * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments deletePayment(UUID paymentID, Payments payments) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Payments/{PaymentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { + HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update a specified payment for invoices and credit notes + *

200 - Success - return response of type Payments array for updated Payment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @param payments The payments parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments, Map params) throws IOException { + HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(payments); + public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, java.io.InputStream payments, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = payments == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, Payments payments, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to delete tracking categories + *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { + HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to delete tracking categories *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories deleteTrackingCategory(UUID trackingCategoryID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); - - String response = this.DATA(url, strBody, params, "DELETE"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + + /** + * Allows you to delete a specified option for a specified tracking category + *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param trackingOptionID Unique identifier for a Tracking Option + * @return TrackingOptions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { + HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to delete a specified option for a specified tracking category *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @param trackingOptionID Unique identifier for a Tracking Option + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TrackingOptions * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingOptions deleteTrackingOptions(UUID trackingCategoryID, UUID trackingOptionID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, Map params) throws IOException { + HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID.toString()); - uriVariables.put("TrackingOptionID", trackingOptionID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); + }// verify the required parameter 'trackingOptionID' is set + if (trackingOptionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + uriVariables.put("TrackingOptionID", trackingOptionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"); - - String response = this.DATA(url, strBody, params, "DELETE"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); + }// verify the required parameter 'trackingOptionID' is set + if (trackingOptionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + uriVariables.put("TrackingOptionID", trackingOptionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); } + + /** * Allows you to email a copy of invoice to related Contact *

204 - Success - return response 204 no content *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param requestEmpty The requestEmpty parameter * @throws IOException if an error occurs while attempting to invoke the API **/ - public void emailInvoice(UUID invoiceID, RequestEmpty requestEmpty) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}/Email"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Email"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { + emailInvoiceForHttpResponse(xeroTenantId, invoiceID, requestEmpty); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to email a copy of invoice to related Contact + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param requestEmpty The requestEmpty parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty, Map params) throws IOException { + emailInvoiceForHttpResponse(xeroTenantId, invoiceID, requestEmpty, params); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(requestEmpty); + public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); + }// verify the required parameter 'requestEmpty' is set + if (requestEmpty == null) { + throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - + HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream requestEmpty, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); + }// verify the required parameter 'requestEmpty' is set + if (requestEmpty == null) { + throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = requestEmpty == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, requestEmpty); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); + }// verify the required parameter 'requestEmpty' is set + if (requestEmpty == null) { + throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a single chart of accounts + *

200 - Success - return response of type Accounts array with one Account + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for retrieving single object + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts getAccount(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a single chart of accounts *

200 - Success - return response of type Accounts array with one Account + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for retrieving single object + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccount(UUID accountID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Accounts/{AccountID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Accounts getAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { + HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachment on Account by Filename + *

200 - Success - return response of attachment for Account as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param fileName Name of the attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { + HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachment on Account by Filename *

200 - Success - return response of attachment for Account as binary data + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param fileName Name of the attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getAccountAttachmentByFileName(UUID accountID, String fileName, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve specific Attachment on Account + *

200 - Success - return response of attachment for Account as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param attachmentID Unique identifier for Attachment object + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve specific Attachment on Account *

200 - Success - return response of attachment for Account as binary data + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param attachmentID Unique identifier for Attachment object * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getAccountAttachmentById(UUID accountID, UUID attachmentID, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID.toString()); - uriVariables.put("AttachmentID", attachmentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getAccountAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getAccountAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments for accounts + *

200 - Success - return response of type Attachments array of Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachments for accounts *

200 - Success - return response of type Attachments array of Attachment + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getAccountAttachments(UUID accountID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Accounts/{AccountID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments getAccountAttachments(String xeroTenantId, UUID accountID, Map params) throws IOException { + HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve the full chart of accounts *

200 - Success - return response of type Accounts array with 0 to n Account + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccounts(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Accounts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); + public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getAccountsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve the full chart of accounts + *

200 - Success - return response of type Accounts array with 0 to n Account + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts getAccounts(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getAccountsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAccountsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getAccountsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve a single spend or receive money transaction *

200 - Success - return response of type BankTransactions array with a specific BankTransaction + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions getBankTransaction(UUID bankTransactionID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransactions/{BankTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to retrieve a single spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with a specific BankTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - String response = this.DATA(url, strBody, params, "GET"); + public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on BankTransaction by Filename + *

200 - Success - return response of attachment for BankTransaction as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param fileName The name of the file being attached + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { + HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachments on BankTransaction by Filename *

200 - Success - return response of attachment for BankTransaction as binary data + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param fileName The name of the file being attached * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransactionAttachmentByFileName(UUID bankTransactionID, String fileName, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on a specific BankTransaction + *

200 - Success - return response of attachment for BankTransaction as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param attachmentID Xero generated unique identifier for an attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachments on a specific BankTransaction *

200 - Success - return response of attachment for BankTransaction as binary data + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param attachmentID Xero generated unique identifier for an attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransactionAttachmentById(UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID.toString()); - uriVariables.put("AttachmentID", attachmentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve any attachments to bank transactions + *

200 - Success - return response of type Attachments array with 0 to n Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve any attachments to bank transactions *

200 - Success - return response of type Attachments array with 0 to n Attachment + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransactionAttachments(UUID bankTransactionID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve any spend or receive money transactions *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -2787,774 +7706,1966 @@ public Attachments getBankTransactionAttachments(UUID bankTransactionID) throws * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions getBankTransactions(OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransactions"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (page != null) { - addToMapIfNotNull(params, "page", page); - }if (unitdp != null) { - addToMapIfNotNull(params, "unitdp", unitdp); + public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any spend or receive money transactions + *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions getBankTransactions(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve history from a bank transactions + *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve history from a bank transactions *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransactionsHistory(UUID bankTransactionID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransactions/{BankTransactionID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve any bank transfers + *

200 - Success - return response of BankTransfers array with one BankTransfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @return BankTransfers + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve any bank transfers *

200 - Success - return response of BankTransfers array with one BankTransfer + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfer(UUID bankTransferID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransfers/{BankTransferID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on BankTransfer by file name + *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param fileName The name of the file being attached to a Bank Transfer + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { + HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachments on BankTransfer by file name *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param fileName The name of the file being attached to a Bank Transfer * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransferAttachmentByFileName(UUID bankTransferID, String fileName, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on BankTransfer + *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachments on BankTransfer *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransferAttachmentById(UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID.toString()); - uriVariables.put("AttachmentID", attachmentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments from bank transfers + *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachments from bank transfers *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransferAttachments(UUID bankTransferID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransfers/{BankTransferID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve history from a bank transfers + *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve history from a bank transfers *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransferHistory(UUID bankTransferID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransfers/{BankTransferID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve all bank transfers *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfers(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransfers"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); + public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve all bank transfers + *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransfers + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransfers getBankTransfers(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve history from a Batch Payment *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + * @param xeroTenantId Xero identifier for Tenant * @param batchPaymentID Unique identifier for BatchPayment * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBatchPaymentHistory(UUID batchPaymentID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BatchPayments/{BatchPaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BatchPayments/{BatchPaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } + public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID) throws IOException { + HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** - * Retrieve either one or many BatchPayments for invoices - *

200 - Success - return response of type BatchPayments array of BatchPayment objects - * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * Allows you to retrieve history from a Batch Payment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + * @param xeroTenantId Xero identifier for Tenant + * @param batchPaymentID Unique identifier for BatchPayment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID, Map params) throws IOException { + HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, UUID batchPaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); + }// verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BatchPaymentID", batchPaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, UUID batchPaymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); + }// verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BatchPaymentID", batchPaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Retrieve either one or many BatchPayments for invoices + *

200 - Success - return response of type BatchPayments array of BatchPayment objects + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public BatchPayments getBatchPayments(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BatchPayments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); + public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Retrieve either one or many BatchPayments for invoices + *

200 - Success - return response of type BatchPayments array of BatchPayment objects + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BatchPayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BatchPayments getBatchPayments(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specific BrandingThemes + *

200 - Success - return response of type BrandingThemes with one BrandingTheme + * @param xeroTenantId Xero identifier for Tenant + * @param brandingThemeID Unique identifier for a Branding Theme + * @return BrandingThemes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID) throws IOException { + HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specific BrandingThemes *

200 - Success - return response of type BrandingThemes with one BrandingTheme + * @param xeroTenantId Xero identifier for Tenant * @param brandingThemeID Unique identifier for a Branding Theme + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return BrandingThemes * @throws IOException if an error occurs while attempting to invoke the API **/ - public BrandingThemes getBrandingTheme(UUID brandingThemeID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BrandingThemes/{BrandingThemeID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID brandingThemeID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve the Payment services for a Branding Theme + *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService + * @param xeroTenantId Xero identifier for Tenant + * @param brandingThemeID Unique identifier for a Branding Theme + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID) throws IOException { + HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve the Payment services for a Branding Theme *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService + * @param xeroTenantId Xero identifier for Tenant * @param brandingThemeID Unique identifier for a Branding Theme + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices getBrandingThemePaymentServices(UUID brandingThemeID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + + /** + * Allows you to retrieve all the BrandingThemes + *

200 - Success - return response of type BrandingThemes + * @param xeroTenantId Xero identifier for Tenant + * @return BrandingThemes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BrandingThemes getBrandingThemes(String xeroTenantId) throws IOException { + HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + /** * Allows you to retrieve all the BrandingThemes *

200 - Success - return response of type BrandingThemes + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return BrandingThemes * @throws IOException if an error occurs while attempting to invoke the API **/ - public BrandingThemes getBrandingThemes() throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BrandingThemes"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public BrandingThemes getBrandingThemes(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Contacts array with a unique Contact + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts getContact(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve, add and update contacts in a Xero organisation *

200 - Success - return response of type Contacts array with a unique Contact + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContact(UUID contactID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts/{ContactID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Contacts getContact(String xeroTenantId, UUID contactID, Map params) throws IOException { + HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on Contacts by file name + *

200 - Success - return response of attachment for Contact as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param fileName Name for the file you are attaching + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { + HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachments on Contacts by file name *

200 - Success - return response of attachment for Contact as binary data + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param fileName Name for the file you are attaching * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getContactAttachmentByFileName(UUID contactID, String fileName, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on Contacts + *

200 - Success - return response of attachment for Contact as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachments on Contacts *

200 - Success - return response of attachment for Contact as binary data + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getContactAttachmentById(UUID contactID, UUID attachmentID, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID.toString()); - uriVariables.put("AttachmentID", attachmentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getContactAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getContactAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Attachments array with 0 to N Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getContactAttachments(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve, add and update contacts in a Xero organisation *

200 - Success - return response of type Attachments array with 0 to N Attachment + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getContactAttachments(UUID contactID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts/{ContactID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments getContactAttachments(String xeroTenantId, UUID contactID, Map params) throws IOException { + HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve CISSettings for a contact in a Xero organisation + *

200 - Success - return response of type CISSettings for a specific Contact + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @return CISSettings + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve CISSettings for a contact in a Xero organisation *

200 - Success - return response of type CISSettings for a specific Contact + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return CISSettings * @throws IOException if an error occurs while attempting to invoke the API **/ - public CISSettings getContactCISSettings(UUID contactID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts/{ContactID}/CISSettings"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/CISSettings"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID, Map params) throws IOException { + HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/CISSettings"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/CISSettings"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a unique Contract Group by ID + *

200 - Success - return response of type Contact Groups array with a specific Contact Group + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) throws IOException { + HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a unique Contract Group by ID *

200 - Success - return response of type Contact Groups array with a specific Contact Group + * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroup(UUID contactGroupID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ContactGroups/{ContactGroupID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { + HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroup"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroup"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve the ContactID and Name of all the contacts in a contact group *

200 - Success - return response of type Contact Groups array of Contact Group + * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroups(String where, String order) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ContactGroups"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); + public ContactGroups getContactGroups(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve the ContactID and Name of all the contacts in a contact group + *

200 - Success - return response of type Contact Groups array of Contact Group + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups getContactGroups(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET"); + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve a history records of an Contact *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getContactHistory(UUID contactID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts/{ContactID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to retrieve a history records of an Contact + *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID, Map params) throws IOException { + HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - String response = this.DATA(url, strBody, params, "GET"); + public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactHistory"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Contacts array with 0 to N Contact - * @param ifModifiedSince Only records created or modified since this timestamp will be returned + + public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactHistory"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Contacts array with 0 to N Contact + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @param ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. @@ -3563,266 +9674,700 @@ public HistoryRecords getContactHistory(UUID contactID) throws IOException { * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContacts(OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (ids != null) { - addToMapIfNotNull(params, "IDs", ids); - }if (page != null) { - addToMapIfNotNull(params, "page", page); - }if (includeArchived != null) { - addToMapIfNotNull(params, "includeArchived", includeArchived); + public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + HttpResponse response = getContactsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, page, includeArchived); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Contacts array with 0 to N Contact + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts getContacts(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getContactsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (ids != null) { + String key = "IDs"; + Object value = ids; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (includeArchived != null) { + String key = "includeArchived"; + Object value = includeArchived; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getContactsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specific credit note + *

200 - Success - return response of type Credit Notes array with a unique CreditNote + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specific credit note *

200 - Success - return response of type Credit Notes array with a unique CreditNote + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNote(UUID creditNoteID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes/{CreditNoteID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNote"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNote"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Credit Note as PDF files + *

200 - Success - return response of binary data from the Attachment to a Credit Note + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { + HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Credit Note as PDF files *

200 - Success - return response of binary data from the Attachment to a Credit Note + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAsPdf(UUID creditNoteID, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes/{CreditNoteID}/pdf"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/pdf"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public File getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType, Map params) throws IOException { + HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/pdf"); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID creditNoteID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/pdf"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on CreditNote by file name + *

200 - Success - return response of attachment for Credit Note as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param fileName Name of the file you are attaching to Credit Note + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { + HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachments on CreditNote by file name *

200 - Success - return response of attachment for Credit Note as binary data + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param fileName Name of the file you are attaching to Credit Note * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAttachmentByFileName(UUID creditNoteID, String fileName, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on CreditNote + *

200 - Success - return response of attachment for Credit Note as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachments on CreditNote *

200 - Success - return response of attachment for Credit Note as binary data + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAttachmentById(UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID.toString()); - uriVariables.put("AttachmentID", attachmentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments for credit notes + *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachments for credit notes *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getCreditNoteAttachments(UUID creditNoteID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an CreditNote + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a history records of an CreditNote *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getCreditNoteHistory(UUID creditNoteID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes/{CreditNoteID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve any credit notes *

200 - Success - return response of type Credit Notes array of CreditNote + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -3830,503 +10375,1311 @@ public HistoryRecords getCreditNoteHistory(UUID creditNoteID) throws IOException * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNotes(OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (page != null) { - addToMapIfNotNull(params, "page", page); + public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any credit notes + *

200 - Success - return response of type Credit Notes array of CreditNote + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes getCreditNotes(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } if (page != null) { + String key = "page"; + Object value = page; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve currencies for your organisation *

200 - Success - return response of type Currencies array with all Currencies + * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @return Currencies * @throws IOException if an error occurs while attempting to invoke the API **/ - public Currencies getCurrencies(String where, String order) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Currencies"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); + public Currencies getCurrencies(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve currencies for your organisation + *

200 - Success - return response of type Currencies array with all Currencies + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Currencies + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Currencies getCurrencies(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET"); + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specific employee used in Xero payrun + *

200 - Success - return response of type Employees array with specified Employee + * @param xeroTenantId Xero identifier for Tenant + * @param employeeID Unique identifier for a Employee + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees getEmployee(String xeroTenantId, UUID employeeID) throws IOException { + HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specific employee used in Xero payrun *

200 - Success - return response of type Employees array with specified Employee + * @param xeroTenantId Xero identifier for Tenant * @param employeeID Unique identifier for a Employee + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployee(UUID employeeID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Employees/{EmployeeID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Employees/{EmployeeID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Employees getEmployee(String xeroTenantId, UUID employeeID, Map params) throws IOException { + HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("EmployeeID", employeeID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getEmployeeForHttpResponse(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"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("EmployeeID", employeeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Map params) 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"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("EmployeeID", employeeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve employees used in Xero payrun *

200 - Success - return response of type Employees array with all Employee + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployees(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Employees"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); + public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve employees used in Xero payrun + *

200 - Success - return response of type Employees array with all Employee + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees getEmployees(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve a specified expense claim *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim + * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims getExpenseClaim(UUID expenseClaimID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } + public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID) throws IOException { + HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** - * Allows you to retrieve a history records of an ExpenseClaim - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim + * Allows you to retrieve a specified expense claim + *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim + * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim - * @return HistoryRecords + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getExpenseClaimHistory(UUID expenseClaimID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an ExpenseClaim + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID) throws IOException { + HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an ExpenseClaim + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve expense claims *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims getExpenseClaims(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ExpenseClaims"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); + public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve expense claims + *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims getExpenseClaims(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified sales invoice or purchase bill + *

200 - Success - return response of type Invoices array with specified Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices getInvoice(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified sales invoice or purchase bill *

200 - Success - return response of type Invoices array with specified Invoices + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices getInvoice(UUID invoiceID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Invoices getInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve invoices or purchase bills as PDF files + *

200 - Success - return response of byte array pdf version of specified Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { + HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve invoices or purchase bills as PDF files *

200 - Success - return response of byte array pdf version of specified Invoices + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getInvoiceAsPdf(UUID invoiceID, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}/pdf"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/pdf"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public File getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType, Map params) throws IOException { + HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/pdf"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID invoiceID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/pdf"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + + /** + * Allows you to retrieve Attachment on invoices or purchase bills by it's filename + *

200 - Success - return response of attachment for Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param fileName Name of the file you are attaching + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { + HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + /** * Allows you to retrieve Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of attachment for Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param fileName Name of the file you are attaching * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getInvoiceAttachmentByFileName(UUID invoiceID, String fileName, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID + *

200 - Success - return response of attachment for Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param attachmentID Unique identifier for an Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID *

200 - Success - return response of attachment for Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param attachmentID Unique identifier for an Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getInvoiceAttachmentById(UUID invoiceID, UUID attachmentID, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - uriVariables.put("AttachmentID", attachmentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + + /** + * Allows you to retrieve Attachments on invoices or purchase bills + *

200 - Success - return response of type Attachments array of Attachments for specified Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + /** * Allows you to retrieve Attachments on invoices or purchase bills *

200 - Success - return response of type Attachments array of Attachments for specified Invoices + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getInvoiceAttachments(UUID invoiceID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an invoice + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a history records of an invoice *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getInvoiceHistory(UUID invoiceID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve invoice reminder settings + *

200 - Success - return response of Invoice Reminders + * @param xeroTenantId Xero identifier for Tenant + * @return InvoiceReminders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws IOException { + HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve invoice reminder settings *

200 - Success - return response of Invoice Reminders + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return InvoiceReminders * @throws IOException if an error occurs while attempting to invoke the API **/ - public InvoiceReminders getInvoiceReminders() throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/InvoiceReminders/Settings"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public InvoiceReminders getInvoiceReminders(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/InvoiceReminders/Settings"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/InvoiceReminders/Settings"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve any sales invoices or purchase bills *

200 - Success - return response of type Invoices array with all Invoices + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -4341,126 +11694,354 @@ public InvoiceReminders getInvoiceReminders() throws IOException { * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices getInvoices(OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (ids != null) { - addToMapIfNotNull(params, "IDs", ids); - }if (invoiceNumbers != null) { - addToMapIfNotNull(params, "InvoiceNumbers", invoiceNumbers); - }if (contactIDs != null) { - addToMapIfNotNull(params, "ContactIDs", contactIDs); - }if (statuses != null) { - addToMapIfNotNull(params, "Statuses", statuses); - }if (page != null) { - addToMapIfNotNull(params, "page", page); - }if (includeArchived != null) { - addToMapIfNotNull(params, "includeArchived", includeArchived); - }if (createdByMyApp != null) { - addToMapIfNotNull(params, "createdByMyApp", createdByMyApp); - }if (unitdp != null) { - addToMapIfNotNull(params, "unitdp", unitdp); - } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any sales invoices or purchase bills + *

200 - Success - return response of type Invoices array with all Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices getInvoices(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (ids != null) { + String key = "IDs"; + Object value = ids; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (invoiceNumbers != null) { + String key = "InvoiceNumbers"; + Object value = invoiceNumbers; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (contactIDs != null) { + String key = "ContactIDs"; + Object value = contactIDs; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (statuses != null) { + String key = "Statuses"; + Object value = statuses; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (includeArchived != null) { + String key = "includeArchived"; + Object value = includeArchived; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (createdByMyApp != null) { + String key = "createdByMyApp"; + Object value = createdByMyApp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified item + *

200 - Success - return response of type Items array with specified Item + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items getItem(String xeroTenantId, UUID itemID) throws IOException { + HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified item *

200 - Success - return response of type Items array with specified Item + * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items getItem(UUID itemID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Items/{ItemID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Items getItem(String xeroTenantId, UUID itemID, Map params) throws IOException { + HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve history for items *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item + * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getItemHistory(UUID itemID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Items/{ItemID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } + public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws IOException { + HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + + /** + * Allows you to retrieve history for items + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID, Map params) throws IOException { + HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItemHistory"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItemHistory"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + /** * Allows you to retrieve any items *

200 - Success - return response of type Items array with all Item + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -4468,146 +12049,382 @@ public HistoryRecords getItemHistory(UUID itemID) throws IOException { * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items getItems(OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Items"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (unitdp != null) { - addToMapIfNotNull(params, "unitdp", unitdp); + public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpResponse response = getItemsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any items + *

200 - Success - return response of type Items array with all Item + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items getItems(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getItemsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getItemsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getItemsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified journals. + *

200 - Success - return response of type Journals array with specified Journal + * @param xeroTenantId Xero identifier for Tenant + * @param journalID Unique identifier for a Journal + * @return Journals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Journals getJournal(String xeroTenantId, UUID journalID) throws IOException { + HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified journals. *

200 - Success - return response of type Journals array with specified Journal + * @param xeroTenantId Xero identifier for Tenant * @param journalID Unique identifier for a Journal + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Journals * @throws IOException if an error occurs while attempting to invoke the API **/ - public Journals getJournal(UUID journalID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Journals/{JournalID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Journals/{JournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Journals getJournal(String xeroTenantId, UUID journalID, Map params) throws IOException { + HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("JournalID", journalID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournal"); + }// verify the required parameter 'journalID' is set + if (journalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("JournalID", journalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals/{JournalID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournal"); + }// verify the required parameter 'journalID' is set + if (journalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("JournalID", journalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals/{JournalID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve any journals. *

200 - Success - return response of type Journals array with all Journals + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned * @param paymentsOnly Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. * @return Journals * @throws IOException if an error occurs while attempting to invoke the API **/ - public Journals getJournals(OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Journals"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (offset != null) { - addToMapIfNotNull(params, "offset", offset); - }if (paymentsOnly != null) { - addToMapIfNotNull(params, "paymentsOnly", paymentsOnly); + public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { + HttpResponse response = getJournalsForHttpResponse(xeroTenantId, ifModifiedSince, offset, paymentsOnly); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any journals. + *

200 - Success - return response of type Journals array with all Journals + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Journals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Journals getJournals(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getJournalsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getJournalsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals"); + if (offset != null) { + String key = "offset"; + Object value = offset; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getJournalsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { + HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions getLinkedTransaction(UUID linkedTransactionID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { + HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Retrieve linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant * @param page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. * @param linkedTransactionID The Xero identifier for an Linked Transaction * @param sourceTransactionID Filter by the SourceTransactionID. Get all the linked transactions created from a particular ACCPAY invoice @@ -4617,194 +12434,526 @@ public LinkedTransactions getLinkedTransaction(UUID linkedTransactionID) throws * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions getLinkedTransactions(Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/LinkedTransactions"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (page != null) { - addToMapIfNotNull(params, "page", page); - }if (linkedTransactionID != null) { - addToMapIfNotNull(params, "LinkedTransactionID", linkedTransactionID); - }if (sourceTransactionID != null) { - addToMapIfNotNull(params, "SourceTransactionID", sourceTransactionID); - }if (contactID != null) { - addToMapIfNotNull(params, "ContactID", contactID); - }if (status != null) { - addToMapIfNotNull(params, "Status", status); - }if (targetTransactionID != null) { - addToMapIfNotNull(params, "TargetTransactionID", targetTransactionID); - } - - String response = this.DATA(url, strBody, params, "GET"); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { + HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Retrieve linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions getLinkedTransactions(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + if (page != null) { + String key = "page"; + Object value = page; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (linkedTransactionID != null) { + String key = "LinkedTransactionID"; + Object value = linkedTransactionID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (sourceTransactionID != null) { + String key = "SourceTransactionID"; + Object value = sourceTransactionID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (contactID != null) { + String key = "ContactID"; + Object value = contactID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (targetTransactionID != null) { + String key = "TargetTransactionID"; + Object value = targetTransactionID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified manual journals + *

200 - Success - return response of type ManualJournals array with a specified ManualJournals + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID) throws IOException { + HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified manual journals *

200 - Success - return response of type ManualJournals array with a specified ManualJournals + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals getManualJournal(UUID manualJournalID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ManualJournals/{ManualJournalID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { + HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournal"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournal"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve specified Attachment on ManualJournal by file name + *

200 - Success - return response of attachment for Manual Journal as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param fileName The name of the file being attached to a ManualJournal + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { + HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve specified Attachment on ManualJournal by file name *

200 - Success - return response of attachment for Manual Journal as binary data + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param fileName The name of the file being attached to a ManualJournal * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getManualJournalAttachmentByFileName(UUID manualJournalID, String fileName, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve specified Attachment on ManualJournals + *

200 - Success - return response of attachment for Manual Journal as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve specified Attachment on ManualJournals *

200 - Success - return response of attachment for Manual Journal as binary data + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getManualJournalAttachmentById(UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID.toString()); - uriVariables.put("AttachmentID", attachmentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachment for manual journals + *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID) throws IOException { + HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Attachment for manual journals *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getManualJournalAttachments(UUID manualJournalID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { + HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenantId, UUID manualJournalID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve any manual journals *

200 - Success - return response of type ManualJournals array with a all ManualJournals + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -4812,214 +12961,534 @@ public Attachments getManualJournalAttachments(UUID manualJournalID) throws IOEx * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals getManualJournals(OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ManualJournals"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (page != null) { - addToMapIfNotNull(params, "page", page); + public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any manual journals + *

200 - Success - return response of type ManualJournals array with a all ManualJournals + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals getManualJournals(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a URL to an online invoice + *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @return OnlineInvoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a URL to an online invoice *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return OnlineInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public OnlineInvoices getOnlineInvoice(UUID invoiceID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}/OnlineInvoice"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/OnlineInvoice"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/OnlineInvoice"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/OnlineInvoice"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. *

200 - Success - return response of type Organisation array with specified Organisation + * @param xeroTenantId Xero identifier for Tenant * @param organisationID The organisationID parameter * @return CISOrgSetting * @throws IOException if an error occurs while attempting to invoke the API **/ - public CISOrgSetting getOrganisationCISSettings(UUID organisationID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Organisation/{OrganisationID}/CISSettings"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Organisation/{OrganisationID}/CISSettings"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OrganisationID", organisationID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); + public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID) throws IOException { + HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + /** + * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. + *

200 - Success - return response of type Organisation array with specified Organisation + * @param xeroTenantId Xero identifier for Tenant + * @param organisationID The organisationID parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return CISOrgSetting + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID, Map params) throws IOException { + HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantId, UUID organisationID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); + }// verify the required parameter 'organisationID' is set + if (organisationID == null) { + throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OrganisationID", organisationID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation/{OrganisationID}/CISSettings"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantId, UUID organisationID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); + }// verify the required parameter 'organisationID' is set + if (organisationID == null) { + throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OrganisationID", organisationID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation/{OrganisationID}/CISSettings"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Organisation details + *

200 - Success - return response of type Organisation array with all Organisation + * @param xeroTenantId Xero identifier for Tenant + * @return Organisations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Organisations getOrganisations(String xeroTenantId) throws IOException { + HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve Organisation details *

200 - Success - return response of type Organisation array with all Organisation + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Organisations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Organisations getOrganisations() throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Organisation"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public Organisations getOrganisations(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - String response = this.DATA(url, strBody, params, "GET"); + public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified overpayments + *

200 - Success - return response of type Overpayments array with specified Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @return Overpayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID) throws IOException { + HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified overpayments *

200 - Success - return response of type Overpayments array with specified Overpayments + * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Overpayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Overpayments getOverpayment(UUID overpaymentID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Overpayments/{OverpaymentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { + HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID overpaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayment"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayment"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an Overpayment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID) throws IOException { + HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a history records of an Overpayment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments + * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getOverpaymentHistory(UUID overpaymentID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Overpayments/{OverpaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { + HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve overpayments *

200 - Success - return response of type Overpayments array with all Overpayments + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -5028,250 +13497,642 @@ public HistoryRecords getOverpaymentHistory(UUID overpaymentID) throws IOExcepti * @return Overpayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Overpayments getOverpayments(OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Overpayments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (page != null) { - addToMapIfNotNull(params, "page", page); - }if (unitdp != null) { - addToMapIfNotNull(params, "unitdp", unitdp); + public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve overpayments + *

200 - Success - return response of type Overpayments array with all Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Overpayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Overpayments getOverpayments(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified payment for invoices and credit notes + *

200 - Success - return response of type Payments array for specified Payment + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments getPayment(String xeroTenantId, UUID paymentID) throws IOException { + HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified payment for invoices and credit notes *

200 - Success - return response of type Payments array for specified Payment + * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments getPayment(UUID paymentID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Payments/{PaymentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Payments getPayment(String xeroTenantId, UUID paymentID, Map params) throws IOException { + HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + + /** + * Allows you to retrieve history records of a payment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) throws IOException { + HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + /** * Allows you to retrieve history records of a payment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments + * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPaymentHistory(UUID paymentID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Payments/{PaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID, Map params) throws IOException { + HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve payment services + *

200 - Success - return response of type PaymentServices array for all PaymentService + * @param xeroTenantId Xero identifier for Tenant + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices getPaymentServices(String xeroTenantId) throws IOException { + HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve payment services *

200 - Success - return response of type PaymentServices array for all PaymentService + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices getPaymentServices() throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/PaymentServices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public PaymentServices getPaymentServices(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve payments for invoices and credit notes *

200 - Success - return response of type Payments array for all Payments + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments getPayments(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Payments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); + public Payments getPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve payments for invoices and credit notes + *

200 - Success - return response of type Payments array for all Payments + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments getPayments(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified prepayments + *

200 - Success - return response of type Prepayments array for a specified Prepayment + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID Unique identifier for a PrePayment + * @return Prepayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID) throws IOException { + HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified prepayments *

200 - Success - return response of type Prepayments array for a specified Prepayment + * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID Unique identifier for a PrePayment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Prepayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Prepayments getPrepayment(UUID prepaymentID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Prepayments/{PrepaymentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { + HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayment"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayment"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an Prepayment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID Unique identifier for a PrePayment + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID) throws IOException { + HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a history records of an Prepayment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment + * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID Unique identifier for a PrePayment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPrepaymentHistory(UUID prepaymentID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Prepayments/{PrepaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { + HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve prepayments *

200 - Success - return response of type Prepayments array for all Prepayment + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -5280,114 +14141,294 @@ public HistoryRecords getPrepaymentHistory(UUID prepaymentID) throws IOException * @return Prepayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Prepayments getPrepayments(OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Prepayments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (page != null) { - addToMapIfNotNull(params, "page", page); - }if (unitdp != null) { - addToMapIfNotNull(params, "unitdp", unitdp); + public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve prepayments + *

200 - Success - return response of type Prepayments array for all Prepayment + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Prepayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Prepayments getPrepayments(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified purchase orders + *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID) throws IOException { + HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified purchase orders *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders getPurchaseOrder(UUID purchaseOrderID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { + HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve history for PurchaseOrder *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPurchaseOrderHistory(UUID purchaseOrderID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } + public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID) throws IOException { + HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** - * Allows you to retrieve purchase orders - *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder + * Allows you to retrieve history for PurchaseOrder + *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { + HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve purchase orders + *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param status Filter by purchase order status * @param dateFrom Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 @@ -5397,230 +14438,604 @@ public HistoryRecords getPurchaseOrderHistory(UUID purchaseOrderID) throws IOExc * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders getPurchaseOrders(OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/PurchaseOrders"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (status != null) { - addToMapIfNotNull(params, "Status", status); - }if (dateFrom != null) { - addToMapIfNotNull(params, "DateFrom", dateFrom); - }if (dateTo != null) { - addToMapIfNotNull(params, "DateTo", dateTo); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (page != null) { - addToMapIfNotNull(params, "page", page); + public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { + HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve purchase orders + *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders getPurchaseOrders(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + if (status != null) { + String key = "Status"; + Object value = status; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (dateFrom != null) { + String key = "DateFrom"; + Object value = dateFrom; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (dateTo != null) { + String key = "DateTo"; + Object value = dateTo; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve a specified draft expense claim receipts *

200 - Success - return response of type Receipts array for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts getReceipt(UUID receiptID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Receipts/{ReceiptID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Receipts getReceipt(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to retrieve a specified draft expense claim receipts + *

200 - Success - return response of type Receipts array for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts getReceipt(String xeroTenantId, UUID receiptID, Map params) throws IOException { + HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - String response = this.DATA(url, strBody, params, "GET"); + public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipt"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipt"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve Attachments on expense claim receipts by file name *

200 - Success - return response of attachment for Receipt as binary data + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param fileName The name of the file being attached to the Receipt * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getReceiptAttachmentByFileName(UUID receiptID, String fileName, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { + HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on expense claim receipts by file name + *

200 - Success - return response of attachment for Receipt as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param fileName The name of the file being attached to the Receipt + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + /** * Allows you to retrieve Attachments on expense claim receipts by ID *

200 - Success - return response of attachment for Receipt as binary data + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getReceiptAttachmentById(UUID receiptID, UUID attachmentID, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID.toString()); - uriVariables.put("AttachmentID", attachmentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on expense claim receipts by ID + *

200 - Success - return response of attachment for Receipt as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getReceiptAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getReceiptAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + /** * Allows you to retrieve Attachments for expense claim receipts *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getReceiptAttachments(UUID receiptID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Receipts/{ReceiptID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments for expense claim receipts + *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID, Map params) throws IOException { + HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve a history records of an Receipt *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getReceiptHistory(UUID receiptID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Receipts/{ReceiptID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to retrieve a history records of an Receipt + *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID, Map params) throws IOException { + HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - String response = this.DATA(url, strBody, params, "GET"); + public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve draft expense claim receipts for any user *

200 - Success - return response of type Receipts array for all Receipt + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -5628,259 +15043,681 @@ public HistoryRecords getReceiptHistory(UUID receiptID) throws IOException { * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts getReceipts(OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Receipts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (unitdp != null) { - addToMapIfNotNull(params, "unitdp", unitdp); + public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve draft expense claim receipts for any user + *

200 - Success - return response of type Receipts array for all Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts getReceipts(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified repeating invoice + *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @return RepeatingInvoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified repeating invoice *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public RepeatingInvoices getRepeatingInvoice(UUID repeatingInvoiceID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve specified attachment on repeating invoices by file name *

200 - Success - return response of attachment for Repeating Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param fileName The name of the file being attached to a Repeating Invoice * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getRepeatingInvoiceAttachmentByFileName(UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve specified attachment on repeating invoices by file name + *

200 - Success - return response of attachment for Repeating Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param fileName The name of the file being attached to a Repeating Invoice + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified Attachments on repeating invoices + *

200 - Success - return response of attachment for Repeating Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified Attachments on repeating invoices *

200 - Success - return response of attachment for Repeating Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getRepeatingInvoiceAttachmentById(UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID.toString()); - uriVariables.put("AttachmentID", attachmentID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET", contentType); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public File getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve Attachments on repeating invoice *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getRepeatingInvoiceAttachments(UUID repeatingInvoiceID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to retrieve Attachments on repeating invoice + *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - String response = this.DATA(url, strBody, params, "GET"); + public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve history for a repeating invoice + *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve history for a repeating invoice *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getRepeatingInvoiceHistory(UUID repeatingInvoiceID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve any repeating invoices *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public RepeatingInvoices getRepeatingInvoices(String where, String order) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/RepeatingInvoices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); + public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any repeating invoices + *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return RepeatingInvoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET"); + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve report for AgedPayablesByContact *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param contactId Unique identifier for a Contact * @param date The date of the Aged Payables By Contact report * @param fromDate The from date of the Aged Payables By Contact report @@ -5888,141 +15725,417 @@ public RepeatingInvoices getRepeatingInvoices(String where, String order) throws * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportAgedPayablesByContact(UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Reports/AgedPayablesByContact"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (contactId != null) { - addToMapIfNotNull(params, "contactId", contactId); - }if (date != null) { - addToMapIfNotNull(params, "date", date); - }if (fromDate != null) { - addToMapIfNotNull(params, "fromDate", fromDate); - }if (toDate != null) { - addToMapIfNotNull(params, "toDate", toDate); + public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for AgedPayablesByContact + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param contactId Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { + HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); + }// verify the required parameter 'contactId' is set + if (contactId == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedPayablesByContact"); + if (contactId != null) { + String key = "contactId"; + Object value = contactId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (fromDate != null) { + String key = "fromDate"; + Object value = fromDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET"); + } if (toDate != null) { + String key = "toDate"; + Object value = toDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTenantId, UUID contactId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); + }// verify the required parameter 'contactId' is set + if (contactId == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedPayablesByContact"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'contactId' to the map of query params + allParams.put("contactId", contactId); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for AgedReceivablesByContact + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param contactId Unique identifier for a Contact + * @param date The date of the Aged Receivables By Contact report + * @param fromDate The from date of the Aged Receivables By Contact report + * @param toDate The to date of the Aged Receivables By Contact report + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve report for AgedReceivablesByContact *

200 - Success - return response of type ReportWithRows - * @param contactId Unique identifier for a Contact - * @param date The date of the Aged Receivables By Contact report - * @param fromDate The from date of the Aged Receivables By Contact report - * @param toDate The to date of the Aged Receivables By Contact report + * @param xeroTenantId Xero identifier for Tenant + * @param contactId Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { + HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); + }// verify the required parameter 'contactId' is set + if (contactId == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedReceivablesByContact"); + if (contactId != null) { + String key = "contactId"; + Object value = contactId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (fromDate != null) { + String key = "fromDate"; + Object value = fromDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (toDate != null) { + String key = "toDate"; + Object value = toDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xeroTenantId, UUID contactId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); + }// verify the required parameter 'contactId' is set + if (contactId == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedReceivablesByContact"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'contactId' to the map of query params + allParams.put("contactId", contactId); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for BAS only valid for AU orgs + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param reportID Unique identifier for a Report * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportAgedReceivablesByContact(UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Reports/AgedReceivablesByContact"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (contactId != null) { - addToMapIfNotNull(params, "contactId", contactId); - }if (date != null) { - addToMapIfNotNull(params, "date", date); - }if (fromDate != null) { - addToMapIfNotNull(params, "fromDate", fromDate); - }if (toDate != null) { - addToMapIfNotNull(params, "toDate", toDate); - } - - String response = this.DATA(url, strBody, params, "GET"); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } + public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) throws IOException { + HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve report for BAS only valid for AU orgs *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param reportID Unique identifier for a Report + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBASorGST(String reportID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Reports/{ReportID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Reports/{ReportID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID, Map params) throws IOException { + HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReportID", reportID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String reportID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); + }// verify the required parameter 'reportID' is set + if (reportID == null) { + throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReportID", reportID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/{ReportID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String reportID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); + }// verify the required parameter 'reportID' is set + if (reportID == null) { + throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReportID", reportID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/{ReportID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for BAS only valid for AU orgs + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws IOException { + HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve report for BAS only valid for AU orgs *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBASorGSTList() throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Reports"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public ReportWithRows getReportBASorGSTList(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - String response = this.DATA(url, strBody, params, "GET"); + public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve report for BalanceSheet *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param date The date of the Balance Sheet report * @param periods The number of periods for the Balance Sheet report * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) @@ -6033,146 +16146,450 @@ public ReportWithRows getReportBASorGSTList() throws IOException { * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBalanceSheet(String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Reports/BalanceSheet"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (date != null) { - addToMapIfNotNull(params, "date", date); - }if (periods != null) { - addToMapIfNotNull(params, "periods", periods); - }if (timeframe != null) { - addToMapIfNotNull(params, "timeframe", timeframe); - }if (trackingOptionID1 != null) { - addToMapIfNotNull(params, "trackingOptionID1", trackingOptionID1); - }if (trackingOptionID2 != null) { - addToMapIfNotNull(params, "trackingOptionID2", trackingOptionID2); - }if (standardLayout != null) { - addToMapIfNotNull(params, "standardLayout", standardLayout); - }if (paymentsOnly != null) { - addToMapIfNotNull(params, "paymentsOnly", paymentsOnly); - } - - String response = this.DATA(url, strBody, params, "GET"); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for BalanceSheet + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBalanceSheet(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BalanceSheet"); + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (periods != null) { + String key = "periods"; + Object value = periods; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingOptionID1 != null) { + String key = "trackingOptionID1"; + Object value = trackingOptionID1; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingOptionID2 != null) { + String key = "trackingOptionID2"; + Object value = trackingOptionID2; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (standardLayout != null) { + String key = "standardLayout"; + Object value = standardLayout; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BalanceSheet"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve report for BankSummary *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Bank Summary report e.g. 2018-03-31 * @param period The number of periods to compare (integer between 1 and 12) * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBankSummary(LocalDate date, Integer period, Integer timeframe) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Reports/BankSummary"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (date != null) { - addToMapIfNotNull(params, "date", date); - }if (period != null) { - addToMapIfNotNull(params, "period", period); - }if (timeframe != null) { - addToMapIfNotNull(params, "timeframe", timeframe); + public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, date, period, timeframe); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for BankSummary + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBankSummary(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BankSummary"); + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (period != null) { + String key = "period"; + Object value = period; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET"); + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BankSummary"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve report for Budget Summary *

200 - success- return a Report with Rows object + * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Bank Summary report e.g. 2018-03-31 * @param period The number of periods to compare (integer between 1 and 12) * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBudgetSummary(LocalDate date, Integer period, Integer timeframe) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Reports/BudgetSummary"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (date != null) { - addToMapIfNotNull(params, "date", date); - }if (period != null) { - addToMapIfNotNull(params, "period", period); - }if (timeframe != null) { - addToMapIfNotNull(params, "timeframe", timeframe); + public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, date, period, timeframe); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for Budget Summary + *

200 - success- return a Report with Rows object + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBudgetSummary(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BudgetSummary"); + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (period != null) { + String key = "period"; + Object value = period; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET"); + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BudgetSummary"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve report for ExecutiveSummary *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Bank Summary report e.g. 2018-03-31 * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportExecutiveSummary(LocalDate date) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Reports/ExecutiveSummary"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (date != null) { - addToMapIfNotNull(params, "date", date); + public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate date) throws IOException { + HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, date); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for ExecutiveSummary + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportExecutiveSummary(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId, LocalDate date) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ExecutiveSummary"); + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET"); + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ExecutiveSummary"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve report for ProfitAndLoss *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param fromDate The from date for the ProfitAndLoss report e.g. 2018-03-31 * @param toDate The to date for the ProfitAndLoss report e.g. 2018-03-31 * @param periods The number of periods to compare (integer between 1 and 12) @@ -6186,1300 +16603,3897 @@ public ReportWithRows getReportExecutiveSummary(LocalDate date) throws IOExcepti * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportProfitAndLoss(LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Reports/ProfitAndLoss"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (fromDate != null) { - addToMapIfNotNull(params, "fromDate", fromDate); - }if (toDate != null) { - addToMapIfNotNull(params, "toDate", toDate); - }if (periods != null) { - addToMapIfNotNull(params, "periods", periods); - }if (timeframe != null) { - addToMapIfNotNull(params, "timeframe", timeframe); - }if (trackingCategoryID != null) { - addToMapIfNotNull(params, "trackingCategoryID", trackingCategoryID); - }if (trackingCategoryID2 != null) { - addToMapIfNotNull(params, "trackingCategoryID2", trackingCategoryID2); - }if (trackingOptionID != null) { - addToMapIfNotNull(params, "trackingOptionID", trackingOptionID); - }if (trackingOptionID2 != null) { - addToMapIfNotNull(params, "trackingOptionID2", trackingOptionID2); - }if (standardLayout != null) { - addToMapIfNotNull(params, "standardLayout", standardLayout); - }if (paymentsOnly != null) { - addToMapIfNotNull(params, "paymentsOnly", paymentsOnly); - } - - String response = this.DATA(url, strBody, params, "GET"); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for ProfitAndLoss + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportProfitAndLoss(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ProfitAndLoss"); + if (fromDate != null) { + String key = "fromDate"; + Object value = fromDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (toDate != null) { + String key = "toDate"; + Object value = toDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (periods != null) { + String key = "periods"; + Object value = periods; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingCategoryID != null) { + String key = "trackingCategoryID"; + Object value = trackingCategoryID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingCategoryID2 != null) { + String key = "trackingCategoryID2"; + Object value = trackingCategoryID2; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingOptionID != null) { + String key = "trackingOptionID"; + Object value = trackingOptionID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingOptionID2 != null) { + String key = "trackingOptionID2"; + Object value = trackingOptionID2; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (standardLayout != null) { + String key = "standardLayout"; + Object value = standardLayout; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ProfitAndLoss"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve report for TenNinetyNine *

200 - Success - return response of type Reports + * @param xeroTenantId Xero identifier for Tenant * @param reportYear The year of the 1099 report * @return Reports * @throws IOException if an error occurs while attempting to invoke the API **/ - public Reports getReportTenNinetyNine(String reportYear) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Reports/TenNinetyNine"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (reportYear != null) { - addToMapIfNotNull(params, "reportYear", reportYear); + public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) throws IOException { + HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, reportYear); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for TenNinetyNine + *

200 - Success - return response of type Reports + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Reports + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Reports getReportTenNinetyNine(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, String reportYear) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TenNinetyNine"); + if (reportYear != null) { + String key = "reportYear"; + Object value = reportYear; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET"); + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TenNinetyNine"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve report for TrialBalance *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Trial Balance report e.g. 2018-03-31 * @param paymentsOnly Return cash only basis for the Trial Balance report * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportTrialBalance(LocalDate date, Boolean paymentsOnly) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Reports/TrialBalance"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (date != null) { - addToMapIfNotNull(params, "date", date); - }if (paymentsOnly != null) { - addToMapIfNotNull(params, "paymentsOnly", paymentsOnly); + public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, date, paymentsOnly); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for TrialBalance + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportTrialBalance(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TrialBalance"); + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET"); + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TrialBalance"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve Tax Rates *

200 - Success - return response of type TaxRates array with TaxRates + * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @param taxType Filter by tax type * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates getTaxRates(String where, String order, String taxType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/TaxRates"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (taxType != null) { - addToMapIfNotNull(params, "TaxType", taxType); + public TaxRates getTaxRates(String xeroTenantId, String where, String order, String taxType) throws IOException { + HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, where, order, taxType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Tax Rates + *

200 - Success - return response of type TaxRates array with TaxRates + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TaxRates + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TaxRates getTaxRates(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, String where, String order, String taxType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (taxType != null) { + String key = "TaxType"; + Object value = taxType; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET"); + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve tracking categories and options *

200 - Success - return response of type TrackingCategories array of TrackingCategory + * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @param includeArchived e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories getTrackingCategories(String where, String order, Boolean includeArchived) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/TrackingCategories"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); - }if (includeArchived != null) { - addToMapIfNotNull(params, "includeArchived", includeArchived); + public TrackingCategories getTrackingCategories(String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { + HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, where, order, includeArchived); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve tracking categories and options + *

200 - Success - return response of type TrackingCategories array of TrackingCategory + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories getTrackingCategories(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET"); + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (includeArchived != null) { + String key = "includeArchived"; + Object value = includeArchived; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve tracking categories and options for specified category + *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { + HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve tracking categories and options for specified category *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories getTrackingCategory(UUID trackingCategoryID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified user + *

200 - Success - return response of type Users array of specified User + * @param xeroTenantId Xero identifier for Tenant + * @param userID Unique identifier for a User + * @return Users + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Users getUser(String xeroTenantId, UUID userID) throws IOException { + HttpResponse response = getUserForHttpResponse(xeroTenantId, userID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to retrieve a specified user *

200 - Success - return response of type Users array of specified User + * @param xeroTenantId Xero identifier for Tenant * @param userID Unique identifier for a User + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Users * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUser(UUID userID) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Users/{UserID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Users/{UserID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Users getUser(String xeroTenantId, UUID userID, Map params) throws IOException { + HttpResponse response = getUserForHttpResponse(xeroTenantId, userID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("UserID", userID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUser"); + }// verify the required parameter 'userID' is set + if (userID == null) { + throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("UserID", userID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users/{UserID}"); - - String response = this.DATA(url, strBody, params, "GET"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUser"); + }// verify the required parameter 'userID' is set + if (userID == null) { + throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("UserID", userID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users/{UserID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to retrieve users *

200 - Success - return response of type Users array of all User + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Users * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUsers(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Users"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (where != null) { - addToMapIfNotNull(params, "where", where); - }if (order != null) { - addToMapIfNotNull(params, "order", order); + public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getUsersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve users + *

200 - Success - return response of type Users array of all User + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Users + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Users getUsers(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getUsersForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getUsersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } - - String response = this.DATA(url, strBody, params, "GET", ifModifiedSince); + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getUsersForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); } + + /** * Allows you to update a chart of accounts *

200 - Success - update existing Account and return response of type Accounts array with updated Account *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for retrieving single object * @param accounts Request of type Accounts array with one Account * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts updateAccount(UUID accountID, Accounts accounts) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Accounts/{AccountID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { + HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update a chart of accounts + *

200 - Success - update existing Account and return response of type Accounts array with updated Account + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for retrieving single object + * @param accounts Request of type Accounts array with one Account + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts, Map params) throws IOException { + HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(accounts); + public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); + }// verify the required parameter 'accounts' is set + if (accounts == null) { + throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, java.io.InputStream accounts, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); + }// verify the required parameter 'accounts' is set + if (accounts == null) { + throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = accounts == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, accounts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, Accounts accounts, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); + }// verify the required parameter 'accounts' is set + if (accounts == null) { + throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update Attachment on Account by Filename *

200 - Success - return response of type Attachments array of Attachment *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param fileName Name of the attachment * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateAccountAttachmentByFileName(UUID accountID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update Attachment on Account by Filename + *

200 - Success - return response of type Attachments array of Attachment + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param fileName Name of the attachment + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "POST", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update a single spend or receive money transaction *

200 - Success - return response of type BankTransactions array with updated BankTransaction *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param bankTransactions The bankTransactions parameter * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions updateBankTransaction(UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransactions/{BankTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { + HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update a single spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with updated BankTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param bankTransactions The bankTransactions parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions, Map params) throws IOException { + HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(bankTransactions); + public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, java.io.InputStream bankTransactions, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = bankTransactions == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update an Attachment on BankTransaction by Filename *

200 - Success - return response of Attachments array of Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param fileName The name of the file being attached * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransactionAttachmentByFileName(UUID bankTransactionID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update an Attachment on BankTransaction by Filename + *

200 - Success - return response of Attachments array of Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param fileName The name of the file being attached + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "POST", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param fileName The name of the file being attached to a Bank Transfer * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransferAttachmentByFileName(UUID bankTransferID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param fileName The name of the file being attached to a Bank Transfer + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "POST", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** *

200 - Success - return response of type Contacts array with an updated Contact *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact - * @param contacts The contacts parameter + * @param contacts an array of Contacts containing single Contact object with properties to update * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts updateContact(UUID contactID, Contacts contacts) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts/{ContactID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { + HttpResponse response = updateContactForHttpResponse(xeroTenantId, contactID, contacts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + *

200 - Success - return response of type Contacts array with an updated Contact + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param contacts an array of Contacts containing single Contact object with properties to update + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts, Map params) throws IOException { + HttpResponse response = updateContactForHttpResponse(xeroTenantId, contactID, contacts, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(contacts); + public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, java.io.InputStream contacts, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = contacts == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, Contacts contacts, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** *

200 - Success - return response of type Attachments array with an updated Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param fileName Name for the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateContactAttachmentByFileName(UUID contactID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + *

200 - Success - return response of type Attachments array with an updated Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param fileName Name for the file you are attaching + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "POST", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update a Contract Group *

200 - Success - return response of type Contact Groups array of updated Contact Group *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group - * @param contactGroups The contactGroups parameter + * @param contactGroups an array of Contact groups with Name of specific group to update * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups updateContactGroup(UUID contactGroupID, ContactGroups contactGroups) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ContactGroups/{ContactGroupID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { + HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update a Contract Group + *

200 - Success - return response of type Contact Groups array of updated Contact Group + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param contactGroups an array of Contact groups with Name of specific group to update + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups, Map params) throws IOException { + HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(contactGroups); + public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, java.io.InputStream contactGroups, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = contactGroups == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update a specific credit note *

200 - Success - return response of type Credit Notes array with updated CreditNote *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note - * @param creditNotes The creditNotes parameter + * @param creditNotes an array of Credit Notes containing credit note details to update * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes updateCreditNote(UUID creditNoteID, CreditNotes creditNotes) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes/{CreditNoteID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { + HttpResponse response = updateCreditNoteForHttpResponse(xeroTenantId, creditNoteID, creditNotes); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update a specific credit note + *

200 - Success - return response of type Credit Notes array with updated CreditNote + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param creditNotes an array of Credit Notes containing credit note details to update + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes, Map params) throws IOException { + HttpResponse response = updateCreditNoteForHttpResponse(xeroTenantId, creditNoteID, creditNotes, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(creditNotes); + public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream creditNotes, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = creditNotes == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update Attachments on CreditNote by file name *

200 - Success - return response of type Attachments array with updated Attachment for specific Credit Note *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param fileName Name of the file you are attaching to Credit Note * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateCreditNoteAttachmentByFileName(UUID creditNoteID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update Attachments on CreditNote by file name + *

200 - Success - return response of type Attachments array with updated Attachment for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param fileName Name of the file you are attaching to Credit Note + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "POST", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update a specific employee used in Xero payrun + *

200 - Success - return response of type Employees array with updated Employee + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param employeeID Unique identifier for a Employee + * @param employees The employees parameter + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees) throws IOException { + HttpResponse response = updateEmployeeForHttpResponse(xeroTenantId, employeeID, employees); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to update a specific employee used in Xero payrun *

200 - Success - return response of type Employees array with updated Employee *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param employeeID Unique identifier for a Employee * @param employees The employees parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees updateEmployee(UUID employeeID, Employees employees) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Employees/{EmployeeID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Employees/{EmployeeID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees, Map params) throws IOException { + HttpResponse response = updateEmployeeForHttpResponse(xeroTenantId, employeeID, employees, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Employees employees) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); + } + // 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); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("EmployeeID", employeeID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, java.io.InputStream employees, String mediaType) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); + } + // 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); + + HttpContent content = employees == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Employees employees, Map params) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("EmployeeID", employeeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } - - strBody = apiClient.getObjectMapper().writeValueAsString(employees); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - String response = this.DATA(url, strBody, params, "POST"); + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } /** * Allows you to update specified expense claims *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim * @param expenseClaims The expenseClaims parameter * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims updateExpenseClaim(UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { + HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update specified expense claims + *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param expenseClaims The expenseClaims parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims, Map params) throws IOException { + HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(expenseClaims); + public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, java.io.InputStream expenseClaims, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = expenseClaims == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update a specified sales invoices or purchase bills *

200 - Success - return response of type Invoices array with updated Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param invoices The invoices parameter * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices updateInvoice(UUID invoiceID, Invoices invoices) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { + HttpResponse response = updateInvoiceForHttpResponse(xeroTenantId, invoiceID, invoices); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update a specified sales invoices or purchase bills + *

200 - Success - return response of type Invoices array with updated Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param invoices The invoices parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices, Map params) throws IOException { + HttpResponse response = updateInvoiceForHttpResponse(xeroTenantId, invoiceID, invoices, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(invoices); + public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream invoices, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = invoices == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Invoices invoices, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of type Attachments array with updated Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param fileName Name of the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateInvoiceAttachmentByFileName(UUID invoiceID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update Attachment on invoices or purchase bills by it's filename + *

200 - Success - return response of type Attachments array with updated Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param fileName Name of the file you are attaching + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "POST", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to udpate a specified item *

200 - Success - return response of type Items array with updated Item *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @param items The items parameter * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items updateItem(UUID itemID, Items items) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Items/{ItemID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Items updateItem(String xeroTenantId, UUID itemID, Items items) throws IOException { + HttpResponse response = updateItemForHttpResponse(xeroTenantId, itemID, items); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to udpate a specified item + *

200 - Success - return response of type Items array with updated Item + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @param items The items parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items updateItem(String xeroTenantId, UUID itemID, Items items, Map params) throws IOException { + HttpResponse response = updateItemForHttpResponse(xeroTenantId, itemID, items, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(items); + public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, Items items) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(items); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, java.io.InputStream items, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = items == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, Items items, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(items); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update a specified linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with updated LinkedTransaction *

400 - Success - return response of type LinkedTransactions array with updated LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactionID Unique identifier for a LinkedTransaction * @param linkedTransactions The linkedTransactions parameter * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions updateLinkedTransaction(UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { + HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update a specified linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with updated LinkedTransaction + *

400 - Success - return response of type LinkedTransactions array with updated LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @param linkedTransactions The linkedTransactions parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions, Map params) throws IOException { + HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(linkedTransactions); + public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, java.io.InputStream linkedTransactions, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = linkedTransactions == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update a specified manual journal *

200 - Success - return response of type ManualJournals array with an updated ManualJournal *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param manualJournals The manualJournals parameter * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals updateManualJournal(UUID manualJournalID, ManualJournals manualJournals) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ManualJournals/{ManualJournalID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { + HttpResponse response = updateManualJournalForHttpResponse(xeroTenantId, manualJournalID, manualJournals); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update a specified manual journal + *

200 - Success - return response of type ManualJournals array with an updated ManualJournal + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param manualJournals The manualJournals parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals, Map params) throws IOException { + HttpResponse response = updateManualJournalForHttpResponse(xeroTenantId, manualJournalID, manualJournals, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(manualJournals); + public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, java.io.InputStream manualJournals, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = manualJournals == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update a specified Attachment on ManualJournal by file name *

200 - Success - return response of type Attachments array with an update Attachment for a ManualJournals *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param fileName The name of the file being attached to a ManualJournal * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateManualJournalAttachmentByFileName(UUID manualJournalID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update a specified Attachment on ManualJournal by file name + *

200 - Success - return response of type Attachments array with an update Attachment for a ManualJournals + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param fileName The name of the file being attached to a ManualJournal + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "POST", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update a specified purchase order *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder * @param purchaseOrders The purchaseOrders parameter * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders updatePurchaseOrder(UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { + HttpResponse response = updatePurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, purchaseOrders); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update a specified purchase order + *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @param purchaseOrders The purchaseOrders parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders, Map params) throws IOException { + HttpResponse response = updatePurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, purchaseOrders, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(purchaseOrders); + public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, java.io.InputStream purchaseOrders, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = purchaseOrders == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to retrieve a specified draft expense claim receipts *

200 - Success - return response of type Receipts array for updated Receipt *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param receipts The receipts parameter * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts updateReceipt(UUID receiptID, Receipts receipts) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Receipts/{ReceiptID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { + HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to retrieve a specified draft expense claim receipts + *

200 - Success - return response of type Receipts array for updated Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param receipts The receipts parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts, Map params) throws IOException { + HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(receipts); + public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, java.io.InputStream receipts, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = receipts == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Receipts receipts, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update Attachment on expense claim receipts by file name *

200 - Success - return response of type Attachments array with updated Attachment for a specified Receipt *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param fileName The name of the file being attached to the Receipt * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateReceiptAttachmentByFileName(UUID receiptID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update Attachment on expense claim receipts by file name + *

200 - Success - return response of type Attachments array with updated Attachment for a specified Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param fileName The name of the file being attached to the Receipt + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "POST", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update specified attachment on repeating invoices by file name *

200 - Success - return response of type Attachments array with specified Attachment for a specified Repeating Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param fileName The name of the file being attached to a Repeating Invoice * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateRepeatingInvoiceAttachmentByFileName(UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } + public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID.toString()); - uriVariables.put("FileName", fileName.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + /** + * Allows you to update specified attachment on repeating invoices by file name + *

200 - Success - return response of type Attachments array with specified Attachment for a specified Repeating Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param fileName The name of the file being attached to a Repeating Invoice + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - + public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); - String response = this.FILE(url, strBody, params, "POST", body); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update Tax Rates + *

200 - Success - return response of type TaxRates array updated TaxRate + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param taxRates The taxRates parameter + * @return TaxRates + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { + HttpResponse response = updateTaxRateForHttpResponse(xeroTenantId, taxRates); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + /** * Allows you to update Tax Rates *

200 - Success - return response of type TaxRates array updated TaxRate *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param taxRates The taxRates parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates updateTaxRate(TaxRates taxRates) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/TaxRates"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { + HttpResponse response = updateTaxRateForHttpResponse(xeroTenantId, taxRates, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(taxRates); + public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); - String response = this.DATA(url, strBody, params, "POST"); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); + public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, java.io.InputStream taxRates, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = taxRates == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } + + /** * Allows you to update tracking categories *

200 - Success - return response of type TrackingCategories array of updated TrackingCategory *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @param trackingCategory The trackingCategory parameter * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories updateTrackingCategory(UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { + HttpResponse response = updateTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, trackingCategory); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - - strBody = apiClient.getObjectMapper().writeValueAsString(trackingCategory); + /** + * Allows you to update tracking categories + *

200 - Success - return response of type TrackingCategories array of updated TrackingCategory + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param trackingCategory The trackingCategory parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory, Map params) throws IOException { + HttpResponse response = updateTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, trackingCategory, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - String response = this.DATA(url, strBody, params, "POST"); + public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } - protected void addToMapIfNotNull(Map map, String key, Object value) { - if (value != null) { - map.put(key, value.toString()); + public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, java.io.InputStream trackingCategory, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = trackingCategory == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); } -} +} diff --git a/src/main/java/com/xero/api/client/AssetApi.java b/src/main/java/com/xero/api/client/AssetApi.java deleted file mode 100644 index a587e3b0..00000000 --- a/src/main/java/com/xero/api/client/AssetApi.java +++ /dev/null @@ -1,417 +0,0 @@ -package com.xero.api.client; - -import com.xero.api.ApiClient; - -import com.xero.models.assets.Asset; -import com.xero.models.assets.AssetType; -import com.xero.models.assets.Assets; -import com.xero.models.assets.Setting; -import java.util.UUID; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.xero.api.exception.XeroExceptionHandler; -import com.xero.model.*; -import com.xero.api.*; - -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TimeZone; -import java.util.regex.Pattern; - -import javax.ws.rs.core.UriBuilder; - -public class AssetApi { - private ApiClient apiClient; - private XeroExceptionHandler xeroExceptionHandler; - private Config config; - private SignerFactory signerFactory; - private String token = null; - private String tokenSecret = null; - final static Logger logger = LogManager.getLogger(XeroClient.class); - protected static final DateFormat utcFormatter; - - static { - utcFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); - utcFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); - } - - protected static final Pattern MESSAGE_PATTERN = Pattern.compile("(.*)"); - protected final ObjectFactory objFactory = new ObjectFactory(); - - - public AssetApi(Config config) { - this(config, new ConfigBasedSignerFactory(config)); - this.xeroExceptionHandler = new XeroExceptionHandler(); - } - - public AssetApi(Config config, SignerFactory signerFactory) { - this.config = config; - this.signerFactory = signerFactory; - this.xeroExceptionHandler = new XeroExceptionHandler(); - } - - public AssetApi(ApiClient apiClient) { - this(JsonConfig.getInstance()); - this.xeroExceptionHandler = new XeroExceptionHandler(); - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public void setOAuthToken(String token, String tokenSecret) { - this.token = token; - this.tokenSecret = tokenSecret; - } - - - protected String DATA(String url, String body, Map params, String method) throws IOException { - return this.DATA(url,body,params,method,null, "application/json"); - } - - protected String DATA(String url, String body, Map params, String method, OffsetDateTime ifModifiedSince) throws IOException { - return this.DATA(url,body,params,method,ifModifiedSince,"application/json"); - } - - protected String DATA(String url, String body, Map params, String method, String contentType) throws IOException { - return this.DATA(url,body,params,method,null,contentType); - } - - protected String DATA(String url, String body, Map params, String method, OffsetDateTime ifModifiedSince, String contentType) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - contentType, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - if (ifModifiedSince != null) { - req.setIfModifiedSince(ifModifiedSince); - } - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - protected String DATA(String url, String body, Map params, String method, String xeroApplicationId, String xeroTenantId, String xeroUserId) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - null, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - //if (ifModifiedSince != null) { - // req.setIfModifiedSince(ifModifiedSince); - //} - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - - protected ByteArrayInputStream FILE(String url, String body, Map params, String method) throws IOException { - return this.FILE(url,body,params,method,"application/octet-stream"); - } - - protected ByteArrayInputStream FILE(String url, String body, Map params, String method, String accept) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - accept, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - ByteArrayInputStream resp = req.executefile(); - return resp; - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - protected String FILE(String url, String body, Map params, String method, byte[] byteBody) throws IOException { - return this.FILE(url,body,params,method,byteBody,"application/octet-stream"); - } - - protected String FILE(String url, String body, Map params, String method, byte[] byteBody, String contentType) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - contentType, - byteBody, - params, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - /** - * adds a fixed asset - * Adds an asset to the system - *

200 - return single object - create new asset - *

400 - invalid input, object invalid - * @param asset Fixed asset to add - * @return Asset - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Asset createAsset(Asset asset) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Assets"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - - - strBody = apiClient.getObjectMapper().writeValueAsString(asset); - - String response = this.DATA(url, strBody, params, "POST"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * adds a fixed asset type - * Adds an fixed asset type to the system - *

200 - results single object - created fixed type - *

400 - invalid input, object invalid - *

409 - a type already exists - * @param assetType Asset type to add - * @return AssetType - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public AssetType createAssetType(AssetType assetType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/AssetTypes"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - - - strBody = apiClient.getObjectMapper().writeValueAsString(assetType); - - String response = this.DATA(url, strBody, params, "POST"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * retrieves fixed asset by id - * By passing in the appropriate asset id, you can search for a specific fixed asset in the system - *

200 - search results matching criteria - *

400 - bad input parameter - * @param id fixed asset id for single object - * @return Asset - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Asset getAssetById(UUID id) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Assets/{id}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Assets/{id}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("id", id.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches fixed asset settings - * By passing in the appropriate options, you can search for available fixed asset types in the system - *

200 - search results matching criteria - *

400 - bad input parameter - * @return Setting - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Setting getAssetSettings() throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Settings"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches fixed asset types - * By passing in the appropriate options, you can search for available fixed asset types in the system - *

200 - search results matching criteria - *

400 - bad input parameter - * @return List<AssetType> - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public List getAssetTypes() throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/AssetTypes"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference> typeRef = new TypeReference>() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches fixed asset - * By passing in the appropriate options, you can search for available fixed asset in the system - *

200 - search results matching criteria - *

400 - bad input parameter - * @param status Required when retrieving a collection of assets. See Asset Status Codes - * @param page Results are paged. This specifies which page of the results to return. The default page is 1. - * @param pageSize The number of records returned per page. By default the number of records returned is 10. - * @param orderBy Requests can be ordered by AssetType, AssetName, AssetNumber, PurchaseDate and PurchasePrice. If the asset status is DISPOSED it also allows DisposalDate and DisposalPrice. - * @param sortDirection ASC or DESC - * @param filterBy A string that can be used to filter the list to only return assets containing the text. Checks it against the AssetName, AssetNumber, Description and AssetTypeName fields. - * @return Assets - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Assets getAssets(String status, Integer page, Integer pageSize, String orderBy, String sortDirection, String filterBy) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Assets"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (status != null) { - addToMapIfNotNull(params, "status", status); - }if (page != null) { - addToMapIfNotNull(params, "page", page); - }if (pageSize != null) { - addToMapIfNotNull(params, "pageSize", pageSize); - }if (orderBy != null) { - addToMapIfNotNull(params, "orderBy", orderBy); - }if (sortDirection != null) { - addToMapIfNotNull(params, "sortDirection", sortDirection); - }if (filterBy != null) { - addToMapIfNotNull(params, "filterBy", filterBy); - } - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - - protected void addToMapIfNotNull(Map map, String key, Object value) { - if (value != null) { - map.put(key, value.toString()); - } - } - -} - diff --git a/src/main/java/com/xero/api/client/BankFeedsApi.java b/src/main/java/com/xero/api/client/BankFeedsApi.java deleted file mode 100644 index 9048e7d7..00000000 --- a/src/main/java/com/xero/api/client/BankFeedsApi.java +++ /dev/null @@ -1,455 +0,0 @@ -package com.xero.api.client; - -import com.xero.api.ApiClient; - -import com.xero.models.bankfeeds.Error; -import com.xero.models.bankfeeds.FeedConnection; -import com.xero.models.bankfeeds.FeedConnections; -import com.xero.models.bankfeeds.Statement; -import com.xero.models.bankfeeds.Statements; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.xero.api.exception.XeroExceptionHandler; -import com.xero.model.*; -import com.xero.api.*; - -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TimeZone; -import java.util.regex.Pattern; - -import javax.ws.rs.core.UriBuilder; - -public class BankFeedsApi { - private ApiClient apiClient; - private XeroExceptionHandler xeroExceptionHandler; - private Config config; - private SignerFactory signerFactory; - private String token = null; - private String tokenSecret = null; - final static Logger logger = LogManager.getLogger(XeroClient.class); - protected static final DateFormat utcFormatter; - - static { - utcFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); - utcFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); - } - - protected static final Pattern MESSAGE_PATTERN = Pattern.compile("(.*)"); - protected final ObjectFactory objFactory = new ObjectFactory(); - - - public BankFeedsApi(Config config) { - this(config, new ConfigBasedSignerFactory(config)); - this.xeroExceptionHandler = new XeroExceptionHandler(); - } - - public BankFeedsApi(Config config, SignerFactory signerFactory) { - this.config = config; - this.signerFactory = signerFactory; - this.xeroExceptionHandler = new XeroExceptionHandler(); - } - - public BankFeedsApi(ApiClient apiClient) { - this(JsonConfig.getInstance()); - this.xeroExceptionHandler = new XeroExceptionHandler(); - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public void setOAuthToken(String token, String tokenSecret) { - this.token = token; - this.tokenSecret = tokenSecret; - } - - - protected String DATA(String url, String body, Map params, String method) throws IOException { - return this.DATA(url,body,params,method,null, "application/json"); - } - - protected String DATA(String url, String body, Map params, String method, OffsetDateTime ifModifiedSince) throws IOException { - return this.DATA(url,body,params,method,ifModifiedSince,"application/json"); - } - - protected String DATA(String url, String body, Map params, String method, String contentType) throws IOException { - return this.DATA(url,body,params,method,null,contentType); - } - - protected String DATA(String url, String body, Map params, String method, OffsetDateTime ifModifiedSince, String contentType) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - contentType, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - if (ifModifiedSince != null) { - req.setIfModifiedSince(ifModifiedSince); - } - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - protected String DATA(String url, String body, Map params, String method, String xeroApplicationId, String xeroTenantId, String xeroUserId) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - null, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - //if (ifModifiedSince != null) { - // req.setIfModifiedSince(ifModifiedSince); - //} - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - - protected ByteArrayInputStream FILE(String url, String body, Map params, String method) throws IOException { - return this.FILE(url,body,params,method,"application/octet-stream"); - } - - protected ByteArrayInputStream FILE(String url, String body, Map params, String method, String accept) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - accept, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - ByteArrayInputStream resp = req.executefile(); - return resp; - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - protected String FILE(String url, String body, Map params, String method, byte[] byteBody) throws IOException { - return this.FILE(url,body,params,method,byteBody,"application/octet-stream"); - } - - protected String FILE(String url, String body, Map params, String method, byte[] byteBody, String contentType) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - contentType, - byteBody, - params, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - /** - * create one or more new feed connection - * By passing in the appropriate body, you can create one or more new feed connections in the system - *

201 - feed connection created - *

400 - invalid input, object invalid - * @param feedConnections Feed Connection(s) to add - * @return FeedConnections - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public FeedConnections createFeedConnections(FeedConnections feedConnections) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/FeedConnections"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - - - strBody = apiClient.getObjectMapper().writeValueAsString(feedConnections); - - String response = this.DATA(url, strBody, params, "POST"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - *

202 - Success - *

400 - Statement failed validation - *

403 - Invalid application or feed connection - *

409 - Duplicate statement received - *

413 - Statement exceeds size limit - *

422 - Unprocessable Entity - *

500 - Intermittent Xero Error - * @param statements Feed Connection(s) to add - * @return Statements - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Statements createStatements(Statements statements) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Statements"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - - - strBody = apiClient.getObjectMapper().writeValueAsString(statements); - - String response = this.DATA(url, strBody, params, "POST"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * delete an exsiting feed connection - * By passing in the appropriate body, you can create a new feed connections in the system - *

202 - create results matching body content - *

400 - bad input parameter - * @param feedConnections Feed Connections to delete - * @return FeedConnections - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public FeedConnections deleteFeedConnections(FeedConnections feedConnections) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/FeedConnections/DeleteRequests"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - - - strBody = apiClient.getObjectMapper().writeValueAsString(feedConnections); - - String response = this.DATA(url, strBody, params, "POST"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * get single feed connection by id - * By passing in a FeedConnection Id options, you can search for available feed connections in the system - *

200 - search results matching criteria - *

400 - bad input parameter - * @param id feed connection id for single object - * @return FeedConnection - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public FeedConnection getFeedConnection(String id) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/FeedConnections/{id}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/FeedConnections/{id}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("id", id.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches feed connections - * By passing in the appropriate options, you can search for available feed connections in the system - *

201 - search results matching criteria - *

400 - bad input parameter - * @param page Page number which specifies the set of records to retrieve. By default the number of the records per set is 10. Example - https://api.xero.com/bankfeeds.xro/1.0/FeedConnections?page=1 to get the second set of the records. When page value is not a number or a negative number, by default, the first set of records is returned. - * @param pageSize Page size which specifies how many records per page will be returned (default 10). Example - https://api.xero.com/bankfeeds.xro/1.0/FeedConnections?pageSize=100 to specify page size of 100. - * @return FeedConnections - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public FeedConnections getFeedConnections(Integer page, Integer pageSize) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/FeedConnections"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (page != null) { - addToMapIfNotNull(params, "page", page); - }if (pageSize != null) { - addToMapIfNotNull(params, "pageSize", pageSize); - } - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - *

200 - search results matching id for single statement - *

404 - Statement not found - * @param statementId The statementId parameter - * @return Statement - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Statement getStatement(String statementId) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Statements/{statementId}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Statements/{statementId}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("statementId", statementId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - *

200 - search results matching criteria - *

400 - bad input parameter - * @param page The page parameter - * @param pageSize The pageSize parameter - * @param xeroApplicationId The xeroApplicationId parameter - * @param xeroTenantId The xeroTenantId parameter - * @param xeroUserId The xeroUserId parameter - * @return Statements - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Statements getStatements(Integer page, Integer pageSize, String xeroApplicationId, String xeroTenantId, String xeroUserId) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Statements"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (page != null) { - addToMapIfNotNull(params, "page", page); - }if (pageSize != null) { - addToMapIfNotNull(params, "pageSize", pageSize); - } - - String response = this.DATA(url, strBody, params, "GET", xeroApplicationId, xeroTenantId, xeroUserId); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - - protected void addToMapIfNotNull(Map map, String key, Object value) { - if (value != null) { - map.put(key, value.toString()); - } - } - -} - diff --git a/src/main/java/com/xero/api/client/FilesApi.java b/src/main/java/com/xero/api/client/FilesApi.java deleted file mode 100644 index c744dd87..00000000 --- a/src/main/java/com/xero/api/client/FilesApi.java +++ /dev/null @@ -1,823 +0,0 @@ -package com.xero.api.client; - -import com.xero.api.ApiClient; - -import com.xero.models.files.Association; -import java.io.File; -import com.xero.models.files.FileObject; -import com.xero.models.files.FileResponse204; -import com.xero.models.files.Files; -import com.xero.models.files.Folder; -import java.util.UUID; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.xero.api.exception.XeroExceptionHandler; -import com.xero.model.*; -import com.xero.api.*; - -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TimeZone; -import java.util.regex.Pattern; - -import javax.ws.rs.core.UriBuilder; - -public class FilesApi { - private ApiClient apiClient; - private XeroExceptionHandler xeroExceptionHandler; - private Config config; - private SignerFactory signerFactory; - private String token = null; - private String tokenSecret = null; - final static Logger logger = LogManager.getLogger(XeroClient.class); - protected static final DateFormat utcFormatter; - - static { - utcFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); - utcFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); - } - - protected static final Pattern MESSAGE_PATTERN = Pattern.compile("(.*)"); - protected final ObjectFactory objFactory = new ObjectFactory(); - - - public FilesApi(Config config) { - this(config, new ConfigBasedSignerFactory(config)); - this.xeroExceptionHandler = new XeroExceptionHandler(); - } - - public FilesApi(Config config, SignerFactory signerFactory) { - this.config = config; - this.signerFactory = signerFactory; - this.xeroExceptionHandler = new XeroExceptionHandler(); - } - - public FilesApi(ApiClient apiClient) { - this(JsonConfig.getInstance()); - this.xeroExceptionHandler = new XeroExceptionHandler(); - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public void setOAuthToken(String token, String tokenSecret) { - this.token = token; - this.tokenSecret = tokenSecret; - } - - - protected String DATA(String url, String body, Map params, String method) throws IOException { - return this.DATA(url,body,params,method,null, "application/json"); - } - - protected String DATA(String url, String body, Map params, String method, OffsetDateTime ifModifiedSince) throws IOException { - return this.DATA(url,body,params,method,ifModifiedSince,"application/json"); - } - - protected String DATA(String url, String body, Map params, String method, String contentType) throws IOException { - return this.DATA(url,body,params,method,null,contentType); - } - - protected String DATA(String url, String body, Map params, String method, OffsetDateTime ifModifiedSince, String contentType) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - contentType, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - if (ifModifiedSince != null) { - req.setIfModifiedSince(ifModifiedSince); - } - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - protected String DATA(String url, String body, Map params, String method, String xeroApplicationId, String xeroTenantId, String xeroUserId) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - null, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - //if (ifModifiedSince != null) { - // req.setIfModifiedSince(ifModifiedSince); - //} - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - - protected ByteArrayInputStream FILE(String url, String body, Map params, String method) throws IOException { - return this.FILE(url,body,params,method,"application/octet-stream"); - } - - protected ByteArrayInputStream FILE(String url, String body, Map params, String method, String accept) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - body, - params, - accept, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - ByteArrayInputStream resp = req.executefile(); - return resp; - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - protected String FILE(String url, String body, Map params, String method, byte[] byteBody) throws IOException { - return this.FILE(url,body,params,method,byteBody,"application/octet-stream"); - } - - protected String FILE(String url, String body, Map params, String method, byte[] byteBody, String contentType) throws IOException { - - OAuthRequestResource req = new OAuthRequestResource( - config, - signerFactory, - url, - method, - contentType, - byteBody, - params, - "application/json"); - - req.setToken(token); - req.setTokenSecret(tokenSecret); - - try { - Map resp = req.execute(); - Object r = resp.get("content"); - return r.toString(); - } catch (IOException ioe) { - throw xeroExceptionHandler.convertException(ioe); - } - } - - /** - * create a new association - * By passing in the appropriate options, you can create a new folder - *

200 - A successful request - *

400 - bad input parameter - TODO - * @param fileId File id for single object - * @param association The association parameter - * @return Association - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Association createFileAssociation(UUID fileId, Association association) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Files/{FileId}/Associations"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Files/{FileId}/Associations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("FileId", fileId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - strBody = apiClient.getObjectMapper().writeValueAsString(association); - - String response = this.DATA(url, strBody, params, "POST"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * create a new folder - * By passing in the appropriate properties, you can create a new folder - *

200 - search results matching criteria - *

400 - bad input parameter - TODO - * @param folder The folder parameter - * @return Folder - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Folder createFolder(Folder folder) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Folders"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - - - strBody = apiClient.getObjectMapper().writeValueAsString(folder); - - String response = this.DATA(url, strBody, params, "POST"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * delete a file - * Delete a specific file - *

204 - A successful request returns 204 empty response - populate with status property in SDK - * @param fileId File id for single object - * @return FileResponse204 - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public FileResponse204 deleteFile(UUID fileId) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Files/{FileId}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Files/{FileId}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("FileId", fileId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "DELETE"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * create a new association - * By passing in the appropriate options, you can create a new folder - *

204 - A successful request - *

400 - bad input parameter - TODO - * @param fileId File id for single object - * @param objectId Object id for single object - * @return FileResponse204 - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public FileResponse204 deleteFileAssociation(UUID fileId, UUID objectId) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Files/{FileId}/Associations/{ObjectId}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Files/{FileId}/Associations/{ObjectId}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("FileId", fileId.toString()); - uriVariables.put("ObjectId", objectId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "DELETE"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * delete a folder - * By passing in the appropriate ID, you can delete a folder - *

204 - A successful request - *

400 - bad input parameter - TODO - * @param folderId Folder id for single object - * @return FileResponse204 - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public FileResponse204 deleteFolder(UUID folderId) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Folders/{FolderId}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Folders/{FolderId}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("FolderId", folderId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "DELETE"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches files - * By passing in the appropriate options, - *

200 - search results matching criteria - * @param objectId Object id for single object - * @return List<Association> - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public List getAssociationsByObject(UUID objectId) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Associations/{ObjectId}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Associations/{ObjectId}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ObjectId", objectId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference> typeRef = new TypeReference>() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches for file by unique id - *

200 - search results matching criteria - * @param fileId File id for single object - * @return FileObject - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public FileObject getFile(UUID fileId) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Files/{FileId}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Files/{FileId}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("FileId", fileId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches files - * By passing in the appropriate options, - *

200 - search results matching criteria - * @param fileId File id for single object - * @return List<Association> - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public List getFileAssociations(UUID fileId) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Files/{FileId}/Associations"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Files/{FileId}/Associations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("FileId", fileId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference> typeRef = new TypeReference>() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches files to retrieve the data - * By passing in the appropriate options, retrieve data for specific file - *

200 - search results matching criteria - * @param fileId File id for single object - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getFileContent(UUID fileId) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Files/{FileId}/Content"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Files/{FileId}/Content"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("FileId", fileId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - ByteArrayInputStream response = this.FILE(url, strBody, params, "GET"); - return response; - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches files - *

200 - search results matching criteria - *

400 - bad input parameter - TODO - * @param pagesize pass an optional page size value - * @param page number of records to skip for pagination - * @param sort values to sort by - * @return Files - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Files getFiles(Integer pagesize, Integer page, String sort) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Files"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (pagesize != null) { - addToMapIfNotNull(params, "pagesize", pagesize); - }if (page != null) { - addToMapIfNotNull(params, "page", page); - }if (sort != null) { - addToMapIfNotNull(params, "sort", sort); - } - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches specific folder by id - * By passing in the appropriate ID, you can search for specific folder - *

200 - search results matching criteria - *

400 - bad input parameter - TODO - * @param folderId Folder id for single object - * @return Folder - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Folder getFolder(UUID folderId) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Folders/{FolderId}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Folders/{FolderId}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("FolderId", folderId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches folder - * By passing in the appropriate options, you can search for available folders - *

200 - search results matching criteria - *

400 - bad input parameter - TODO - * @param sort values to sort by - * @return List<Folder> - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public List getFolders(String sort) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Folders"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (sort != null) { - addToMapIfNotNull(params, "sort", sort); - } - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference> typeRef = new TypeReference>() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * searches inbox folder - * Search for the user inbox - *

200 - search results matching criteria - *

400 - bad input parameter - TODO - * @return Folder - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Folder getInbox() throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Inbox"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - - - String response = this.DATA(url, strBody, params, "GET"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * Update a file - * Update properties on a single file - *

200 - A successful request - * @param fileId File id for single object - * @param fileObject The fileObject parameter - * @return FileObject - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public FileObject updateFile(UUID fileId, FileObject fileObject) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Files/{FileId}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Files/{FileId}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("FileId", fileId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - strBody = apiClient.getObjectMapper().writeValueAsString(fileObject); - - String response = this.DATA(url, strBody, params, "PUT"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * update folder - * By passing in the appropriate ID and properties, you can update a folder - *

200 - return the updated object - *

400 - bad input parameter - TODO - * @param folderId Folder id for single object - * @param folder The folder parameter - * @return Folder - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Folder updateFolder(UUID folderId, Folder folder) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Folders/{FolderId}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Folders/{FolderId}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) - { - correctPath = path.replace("/pdf",""); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("FolderId", folderId.toString()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - - - strBody = apiClient.getObjectMapper().writeValueAsString(folder); - - String response = this.DATA(url, strBody, params, "PUT"); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - /** - * upload an File - *

200 - A successful request - *

400 - invalid input, object invalid - TODO - *

409 - an existing item already exists - TODO - * @param folderId pass an optional folder id to save file to specific folder - * @param body The body parameter - * @param name The name parameter - * @param filename The filename parameter - * @param mimeType The mimeType parameter - * @return FileObject - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public FileObject uploadFile(UUID folderId, byte[] body, String name, String filename, String mimeType) throws IOException { - try { - String strBody = null; - Map params = null; - String correctPath = "/Files"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - params = new HashMap<>(); - if (folderId != null) { - addToMapIfNotNull(params, "folderId", folderId); - } - - UUID uuid = UUID.randomUUID(); - String boundary = uuid.toString(); - - byte[] head = new String("\r\n--" + boundary + "\r\nContent-Disposition: form-data; name=" + name + ";FileName=" + filename + " \r\nContent-Type: " + mimeType + "\r\n\r\n").getBytes(); - byte[] trailer = new String("\r\n--" + boundary + "--\r\n").getBytes(); - - String contentType = "multipart/form-data; boundary=" + boundary; - - byte[] destination = new byte[head.length + body.length + trailer.length]; - System.arraycopy(head, 0, destination, 0, head.length); - System.arraycopy(body, 0, destination, head.length, body.length); - System.arraycopy(trailer, 0, destination, head.length + body.length, trailer.length); - - String response = this.FILE(url, strBody, params, "POST", destination, contentType); - - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response, typeRef); - - } catch (IOException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage()); - } catch (XeroApiException e) { - throw xeroExceptionHandler.handleBadRequest(e.getMessage(), e.getResponseCode(),JSONUtils.isJSONValid(e.getMessage())); - } - } - - protected void addToMapIfNotNull(Map map, String key, Object value) { - if (value != null) { - map.put(key, value.toString()); - } - } - -} - diff --git a/src/main/java/com/xero/api/exception/XeroExceptionHandler.java b/src/main/java/com/xero/api/exception/XeroExceptionHandler.java deleted file mode 100644 index 5a1e43e9..00000000 --- a/src/main/java/com/xero/api/exception/XeroExceptionHandler.java +++ /dev/null @@ -1,237 +0,0 @@ -package com.xero.api.exception; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.google.api.client.http.HttpResponseException; -import com.xero.api.ApiClient; -import com.xero.api.OAuthRequestResource; -import com.xero.api.XeroApiException; -import com.xero.api.XeroClientException; -import com.xero.api.jaxb.XeroJAXBMarshaller; -import com.xero.model.ApiException; -import com.xero.models.accounting.Error; -import com.xero.models.bankfeeds.Statements; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -/** - * This class is to handle Xero API exceptions with the help of the {@link XeroJAXBMarshaller} - */ -public class XeroExceptionHandler { - - //private final static Logger logger = LogManager.getLogger(XeroExceptionHandler.class.getName()); - final static Logger logger = LogManager.getLogger(XeroExceptionHandler.class); - - private static final Pattern MESSAGE_PATTERN = Pattern.compile("(.*)"); - private XeroJAXBMarshaller xeroJaxbMarshaller; - private ApiClient apiClient = new ApiClient(null,null,null,null); - - - public XeroExceptionHandler() { - this.xeroJaxbMarshaller = new XeroJAXBMarshaller(); - } - - /** - * Handle a HTTP 400 Bad Request from Xero. This method will build a {@link XeroApiException} - * containing {@link ApiException} element with a useful summary of the reason for the error. - * Use {@link ApiException} to get a list of the errors pertaining to the call in question. - *

- * For example: if you use {@link com.xero.api.XeroClient#createPayments(List)} and this fails - * with a XeroApiException, you can extract details from the exception with the following code example. - *

-     * List<{@link com.xero.model.Elements}> elements = xeroApiException.getApiException().getElements();
-     * {@link com.xero.model.Elements} element = elements.get(0);
-     * List<{@link Object}> dataContractBase = element.getDataContractBase();
-     * for (Object dataContract : dataContractBase) {
-     *      {@link com.xero.model.Payment} failedPayment = ({@link com.xero.model.Payment}) dataContract;
-     *      {@link com.xero.model.ArrayOfValidationError} validationErrors = failedPayment.getValidationErrors();
-     *      ...
-     * }
-     * 
- *

- * Or if you use {@link com.xero.api.XeroClient#createInvoices(List)} and this fails - * with a XeroApiException, you can extract details from the exception with the following code example. - *

-     * List<{@link com.xero.model.Elements}> elements = xeroApiException.getApiException().getElements();
-     * {@link com.xero.model.Elements} element = elements.get(0);
-     * List<{@link Object}> dataContractBase = element.getDataContractBase();
-     * for (Object dataContract : dataContractBase) {
-     *      {@link com.xero.model.Invoice} failedInvoice = ({@link com.xero.model.Invoice}) dataContract;
-     *      {@link com.xero.model.ArrayOfValidationError} validationErrors = failedInvoice.getValidationErrors();
-     *      ...
-     * }
-     * 
- * - * @param httpResponseException the exception to handle - * @return XeroApiException containing {@link ApiException} with a useful summary of the reason for the error. - */ - public XeroApiException handleBadRequest(HttpResponseException httpResponseException) { - String content = httpResponseException.getContent(); - - //TODO we could use the ApiException.xsd to validate that the content is an ApiException xml - if (content.contains("ApiException")) { - try { - ApiException apiException = xeroJaxbMarshaller.unmarshall(content, ApiException.class); - return new XeroApiException(httpResponseException.getStatusCode(), content, apiException); - } catch (Exception e) { - logger.error(e); - return convertException(httpResponseException); - } - } else { - return newApiException(httpResponseException); - } - } - - public XeroApiException handleBadRequest(String content) { - //TODO we could use the ApiException.xsd to validate that the content is an ApiException xml - if (content.contains("ApiException")) { - try { - ApiException apiException = xeroJaxbMarshaller.unmarshall(content, ApiException.class); - return new XeroApiException(412, content, apiException); - } catch (Exception e) { - logger.error(e); - } - } - return null; - } - - public XeroApiException handleBadRequest(String content, int code, boolean isJson) { - //TODO we could use the ApiException.xsd to validate that the content is an ApiException xml - if (isJson) { - TypeReference typeRef = new TypeReference() {}; - try { - Error error = apiClient.getObjectMapper().readValue(content, typeRef); - return new XeroApiException(code, content, error); - } catch (IOException e) { - logger.error(e); - } - } else { - Error error = new Error(); - error.setMessage(content); - return new XeroApiException(code, content, error); - } - return null; - } - - public XeroApiException handleBadRequest(String content,int code) { - //TODO we could use the ApiException.xsd to validate that the content is an ApiException xml - if (content.contains("ApiException")) { - try { - ApiException apiException = xeroJaxbMarshaller.unmarshall(content, ApiException.class); - return new XeroApiException(code, content, apiException); - } catch (Exception e) { - logger.error(e); - } - } else { - return newApiException(content, code); - } - return null; - } - - /** - * For backwards comparability with xero-java-sdk version 0.6.0 keep the old way of handling exceptions - * - * @param ioe exception to convert - * @return the converted exception - */ - public XeroApiException convertException(IOException ioe) { - if (ioe instanceof HttpResponseException) { - HttpResponseException httpResponseException = (HttpResponseException) ioe; - if (httpResponseException.getStatusCode() == 400) { - return handleBadRequest(httpResponseException); - } else if (httpResponseException.getStatusCode() == 401 || - httpResponseException.getStatusCode() == 404 || - httpResponseException.getStatusCode() == 500 || - httpResponseException.getStatusCode() == 503) { - return newApiException(httpResponseException); - } else { - return newApiException(httpResponseException); - } - } - throw new XeroClientException(ioe.getMessage(), ioe); - } - - /** - * For backwards comparability with xero-java-sdk version 0.6.0 keep the old way of handling exceptions - * - * @param httpResponseException exception to handle - * @return XeroApiException - */ - public XeroApiException newApiException(HttpResponseException httpResponseException) { - Matcher matcher = MESSAGE_PATTERN.matcher(httpResponseException.getContent()); - StringBuilder messages = new StringBuilder(); - while (matcher.find()) { - if (messages.length() > 0) { - messages.append(", "); - } - messages.append(matcher.group(1)); - } - - if (messages.length() > 0) { - return new XeroApiException(httpResponseException.getStatusCode(), messages.toString()); - } - if (httpResponseException.getContent().contains("=")) { - try { - String value = URLDecoder.decode(httpResponseException.getContent(), "UTF-8"); - String[] keyValuePairs = value.split("&"); - - Map errorMap = new HashMap<>(); - for (String pair : keyValuePairs) { - String[] entry = pair.split("="); - errorMap.put(entry[0].trim(), entry[1].trim()); - } - return new XeroApiException(httpResponseException.getStatusCode(), errorMap); - - } catch (UnsupportedEncodingException e) { - logger.error(e); - throw new XeroClientException(e.getMessage(), e); - } - } - - return new XeroApiException(httpResponseException.getStatusCode(), httpResponseException.getContent()); - } - - public XeroApiException newApiException(String content, int code) { - Matcher matcher = MESSAGE_PATTERN.matcher(content); - - StringBuilder messages = new StringBuilder(); - while (matcher.find()) { - if (messages.length() > 0) { - messages.append(", "); - } - messages.append(matcher.group(1)); - } - - if (messages.length() > 0) { - return new XeroApiException(code, messages.toString()); - } - if (content.contains("=")) { - try { - String value = URLDecoder.decode(content, "UTF-8"); - String[] keyValuePairs = value.split("&"); - - Map errorMap = new HashMap<>(); - for (String pair : keyValuePairs) { - String[] entry = pair.split("="); - errorMap.put(entry[0].trim(), entry[1].trim()); - } - return new XeroApiException(code, errorMap); - - } catch (UnsupportedEncodingException e) { - logger.error(e); - throw new XeroClientException(e.getMessage(), e); - } - } - - return new XeroApiException(code, content); - } -} diff --git a/src/main/java/com/xero/api/jaxb/XeroJAXBMarshaller.java b/src/main/java/com/xero/api/jaxb/XeroJAXBMarshaller.java deleted file mode 100644 index da1b1ea0..00000000 --- a/src/main/java/com/xero/api/jaxb/XeroJAXBMarshaller.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.xero.api.jaxb; - -import com.xero.api.XeroClientException; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamSource; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; - -/** - * Marshall and unmarshall from schema derived class and/or java - * to schema (JAXB-annotated) mapped classes found in com.xero.model - * Will throw {@link XeroClientException} if {@link JAXBContext} - * cannot create the marshaller or unmarshaller - */ -public class XeroJAXBMarshaller { - static final JAXBContext context = initContext(); - - private static JAXBContext initContext() { - try { - return JAXBContext.newInstance("com.xero.model", XeroJAXBMarshaller.class.getClassLoader()); - } catch (Exception e) { - throw new XeroClientException(e.getMessage(), e); - } - } - - public XeroJAXBMarshaller() { - } - - - public String marshall(JAXBElement object) { - try { - StringWriter writer = new StringWriter(); - context.createMarshaller().marshal(object, writer); - return writer.toString(); - } catch (JAXBException e) { - throw new IllegalStateException("Error marshalling request object " + object.getClass(), e); - } - } - - public T unmarshall(String responseBody, Class clazz) throws UnsupportedEncodingException { - try { - Source source = new StreamSource(new StringReader(responseBody)); - return context.createUnmarshaller().unmarshal(source, clazz).getValue(); - } catch (JAXBException e) { - throw new IllegalStateException("Error unmarshalling response: " + responseBody, e); - } - } - -} diff --git a/src/main/java/com/xero/example/CallbackServlet.java b/src/main/java/com/xero/example/CallbackServlet.java deleted file mode 100755 index d70ef1b4..00000000 --- a/src/main/java/com/xero/example/CallbackServlet.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.xero.example; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.xero.api.OAuthAccessToken; -import com.xero.api.Config; -import com.xero.api.JsonConfig; - -public class CallbackServlet extends HttpServlet -{ - private static final long serialVersionUID = 1L; - private Config config = JsonConfig.getInstance(); - - public CallbackServlet() - { - super(); - } - - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - // DEMONSTRATION ONLY - retrieve TempToken from Cookie - TokenStorage storage = new TokenStorage(); - - // retrieve OAuth verifier code from callback URL param - String verifier = request.getParameter("oauth_verifier"); - - // Swap your temp token for 30 oauth token - OAuthAccessToken accessToken = new OAuthAccessToken(config); - accessToken.build(verifier,storage.get(request,"tempToken"),storage.get(request,"tempTokenSecret")).execute(); - if(!accessToken.isSuccess()) - { - storage.clear(response); - request.getRequestDispatcher("index.jsp").forward(request, response); - } - else - { - // DEMONSTRATION ONLY - Store in Cookie - you can extend TokenStorage - // and implement the save() method for your database - storage.save(response,accessToken.getAll()); - request.getRequestDispatcher("callback.jsp").forward(request, response); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/xero/example/CustomJsonConfig.java b/src/main/java/com/xero/example/CustomJsonConfig.java deleted file mode 100644 index 9c2fa8db..00000000 --- a/src/main/java/com/xero/example/CustomJsonConfig.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.xero.example; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.xero.api.Config; - -public class CustomJsonConfig implements Config { - - private String APP_TYPE = "PUBLIC"; - private String USER_AGENT = "Xero-Java-SDK"; - private String ACCEPT = "application/xml"; - private String CONSUMER_KEY = "YOUR_CONSUMER_KEY"; - private String CONSUMER_SECRET = "YOUR_CONSUMER_SECRET"; - private String API_ENDPOINT_URL = "https://api.xero.com/api.xro/2.0/"; - private String FILES_ENDPOINT_URL = "https://api.xero.com/files.xro/1.0/"; - private String ASSETS_ENDPOINT_URL = "https://api.xero.com/assets.xro/1.0/"; - private String BANKFEEDS_ENDPOINT_URL = "https://api.xero.com/bankfeeds.xro/1.0/"; - private String REQUEST_TOKEN_URL = "https://api.xero.com/oauth/RequestToken"; - private String AUTHENTICATE_URL = "https://api.xero.com/oauth/Authorize"; - private String ACCESS_TOKEN_URL = "https://api.xero.com/oauth/AccessToken"; - private String AUTH_CALLBACK_URL="http://localhost:8080/xero-sdk-demo-7/CallbackServlet"; - private String PATH_TO_PRIVATE_KEY_CERT = "/certs/public_privatekey.pfx"; - private String PRIVATE_KEY_PASSWORD = "1234"; - private String PROXY_HOST; - private long PROXY_PORT = 80; - private boolean PROXY_HTTPS_ENABLED = false; - private int CONNECT_TIMEOUT = 60; - private int READ_TIMEOUT = 60; - private String DECIMAL_PLACES = null; - private boolean USING_APP_FIREWALL = false; - private String APP_FIREWALL_HOSTNAME; - private String APP_FIREWALL_URL_PREFIX; - private String KEY_STORE_PATH; - private String KEY_STORE_PASSWORD; - - final static Logger logger = LogManager.getLogger(CustomJsonConfig.class); - - public String getAppType() { - return APP_TYPE; - } - - public String getPrivateKeyPassword() { - return PRIVATE_KEY_PASSWORD; - } - - public String getPathToPrivateKey() { - return PATH_TO_PRIVATE_KEY_CERT; - } - - public String getConsumerKey() { - return CONSUMER_KEY; - } - - public String getConsumerSecret() { - return CONSUMER_SECRET; - } - - public String getApiUrl() { - return API_ENDPOINT_URL; - } - - public String getFilesUrl() { - return FILES_ENDPOINT_URL; - } - - public String getAssetsUrl() { - return ASSETS_ENDPOINT_URL; - } - - @Override - public String getBankFeedsUrl() { - return BANKFEEDS_ENDPOINT_URL; - } - - public String getRequestTokenUrl() { - return REQUEST_TOKEN_URL; - } - - public String getAuthorizeUrl() { - return AUTHENTICATE_URL; - } - - public String getAccessTokenUrl() { - return ACCESS_TOKEN_URL; - } - - public String getUserAgent() { - return USER_AGENT + " " + CONSUMER_KEY + " [Xero-Java-1.0.8]"; - } - - public String getAccept() { - return ACCEPT; - } - - public String getRedirectUri() { - return AUTH_CALLBACK_URL; - } - - public String getProxyHost() { - return PROXY_HOST; - } - - public long getProxyPort() { - return PROXY_PORT; - } - - public boolean getProxyHttpsEnabled() { - return PROXY_HTTPS_ENABLED; - } - - public int getConnectTimeout() { - // in seconds - return CONNECT_TIMEOUT; - } - - public int getReadTimeout() { - // in seconds - return READ_TIMEOUT; - } - - public String getDecimalPlaces(){ - // 2 or 4 - return DECIMAL_PLACES; - } - - public boolean isUsingAppFirewall() { - return USING_APP_FIREWALL; - } - - public String getAppFirewallHostname() { - return APP_FIREWALL_HOSTNAME; - } - - public String getAppFirewallUrlPrefix() { - return APP_FIREWALL_URL_PREFIX; - } - - public String getKeyStorePath() { - return KEY_STORE_PATH; - } - - public String getKeyStorePassword() { - return KEY_STORE_PASSWORD; - } - - public void setConsumerKey(String consumerKey) { } - - public void setConsumerSecret(String consumerSecret) { } - - public void setAppType(String appType) { } - - public void setAuthCallBackUrl(String authCallbackUrl) { } - - public void setConnectTimeout(int connectTimeout) { } - - public void setReadTimeout(int readTimeout) { } - - public void setDecimalPlaces(String decimalPlaces) { } - - public void setUsingAppFirewall(boolean usingAppFirewall) { } - - public void setAppFirewallHostname(String appFirewallHostname) { } - - public void setAppFirewallUrlPrefix(String appFirewallUrlPrefix) { } - - public void setKeyStorePath(String keyStorePath) { } - - public void setKeyStorePassword(String keyStorePassword) { } - -} - - diff --git a/src/main/java/com/xero/example/RequestResourceServlet.java b/src/main/java/com/xero/example/RequestResourceServlet.java deleted file mode 100755 index e69c1bf1..00000000 --- a/src/main/java/com/xero/example/RequestResourceServlet.java +++ /dev/null @@ -1,2773 +0,0 @@ -package com.xero.example; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.net.URLConnection; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.io.IOUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.xero.api.client.*; -import com.fasterxml.jackson.core.type.TypeReference; -import com.xero.api.ApiClient; -import com.xero.api.Config; -import com.xero.api.JsonConfig; -import com.xero.api.OAuthAccessToken; -import com.xero.api.OAuthRequestResource; -import com.xero.api.XeroApiException; -import com.xero.api.XeroClientException; -import com.xero.models.accounting.Account; -import com.xero.models.accounting.Account.SystemAccountEnum; -import com.xero.models.accounting.Accounts; -import com.xero.models.accounting.Allocation; -import com.xero.models.accounting.Allocations; -import com.xero.models.accounting.Attachments; -import com.xero.models.accounting.BankTransaction; -import com.xero.models.accounting.BankTransactions; -import com.xero.models.accounting.BankTransfer; -import com.xero.models.accounting.BankTransfers; -import com.xero.models.accounting.BatchPayment; -import com.xero.models.accounting.BatchPayments; -import com.xero.models.accounting.BrandingThemes; -import com.xero.models.accounting.CISSettings; -import com.xero.models.accounting.Contact; -import com.xero.models.accounting.ContactGroup; -import com.xero.models.accounting.ContactGroups; -import com.xero.models.accounting.Contacts; -import com.xero.models.accounting.CreditNote; -import com.xero.models.accounting.CreditNotes; -import com.xero.models.accounting.Currencies; -import com.xero.models.accounting.Currency; -import com.xero.models.accounting.Employee; -import com.xero.models.accounting.Employees; -import com.xero.models.accounting.ExpenseClaim; -import com.xero.models.accounting.ExpenseClaims; -import com.xero.models.accounting.ExternalLink; -import com.xero.models.accounting.HistoryRecord; -import com.xero.models.accounting.HistoryRecords; -import com.xero.models.accounting.Invoice; -import com.xero.models.accounting.InvoiceReminders; -import com.xero.models.accounting.Invoices; -import com.xero.models.accounting.Item; -import com.xero.models.accounting.Items; -import com.xero.models.accounting.Journal; -import com.xero.models.accounting.JournalLine; -import com.xero.models.accounting.Journals; -import com.xero.models.accounting.LineAmountTypes; -import com.xero.models.accounting.LineItem; -import com.xero.models.accounting.LinkedTransaction; -import com.xero.models.accounting.LinkedTransactions; -import com.xero.models.accounting.ManualJournal; -import com.xero.models.accounting.ManualJournalLine; -import com.xero.models.accounting.ManualJournals; -import com.xero.models.accounting.OnlineInvoices; -import com.xero.models.accounting.Organisations; -import com.xero.models.accounting.Overpayments; -import com.xero.models.accounting.Payment; -import com.xero.models.accounting.PaymentService; -import com.xero.models.accounting.PaymentServices; -import com.xero.models.accounting.Payments; -import com.xero.models.accounting.Phone; -import com.xero.models.accounting.Phone.PhoneTypeEnum; -import com.xero.models.accounting.Prepayments; -import com.xero.models.accounting.PurchaseOrder; -import com.xero.models.accounting.PurchaseOrders; -import com.xero.models.accounting.Receipt; -import com.xero.models.accounting.Receipts; -import com.xero.models.accounting.RepeatingInvoices; -import com.xero.models.accounting.ReportWithRows; -import com.xero.models.accounting.RequestEmpty; -import com.xero.models.accounting.TaxComponent; -import com.xero.models.accounting.TaxRate; -import com.xero.models.accounting.TaxRate.ReportTaxTypeEnum; -import com.xero.models.accounting.TaxRates; -import com.xero.models.accounting.TrackingCategories; -import com.xero.models.accounting.TrackingCategory; -import com.xero.models.accounting.TrackingOption; -import com.xero.models.accounting.TrackingOptions; -import com.xero.models.accounting.User; -import com.xero.models.accounting.Users; -import com.xero.models.assets.*; -import com.xero.models.assets.BookDepreciationSetting.AveragingMethodEnum; -import com.xero.models.assets.BookDepreciationSetting.DepreciationCalculationMethodEnum; -import com.xero.models.assets.BookDepreciationSetting.DepreciationMethodEnum; -import com.xero.models.bankfeeds.*; -import com.xero.models.bankfeeds.Statements; -import com.xero.models.files.Association; -import com.xero.models.files.FileObject; -import com.xero.models.files.FileResponse204; -import com.xero.models.files.Files; -import com.xero.models.files.Folder; -import com.xero.models.files.Folders; -import com.xero.models.files.ObjectGroup; -import com.xero.models.bankfeeds.FeedConnection.AccountTypeEnum; - -//import java.time.LocalDate; -import org.threeten.bp.*; - -public class RequestResourceServlet extends HttpServlet -{ - private static final long serialVersionUID = 1L; - private Config config = null; - final static Logger logger = LogManager.getLogger(OAuthRequestResource.class); - - private String htmlString = "" - + "" - + "" - + "

Xero API - JAVA

" - + "
" - + "Logout" - + "
" - + "
" - + "
" - + "" - + "" - + "
" - + "
" - + "" - + "
" - + "
"; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - PrintWriter respWriter = response.getWriter(); - response.setStatus(200); - response.setContentType("text/html"); - respWriter.println(htmlString); - } - - @SuppressWarnings("null") - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - PrintWriter respWriter = response.getWriter(); - response.setStatus(200); - response.setContentType("text/html"); - respWriter.println(htmlString); - respWriter.println("

begin processing request
"); - - String object = request.getParameter("object"); - ArrayList messages = new ArrayList(); - - // Get Xero API Resource - DEMONSTRATION ONLY get token from Cookie - TokenStorage storage = new TokenStorage(); - String token = storage.get(request,"token"); - String tokenSecret = storage.get(request,"tokenSecret"); - - if(storage.tokenIsNull(token)) { - request.getRequestDispatcher("index.jsp").forward(request, response); - } - - try { - //config = new CustomJsonConfig(); - config = JsonConfig.getInstance(); - System.out.println("Your user agent is: " + config.getUserAgent()); - } catch(Exception e) { - System.out.println(e.getMessage()); - } - - - OAuthAccessToken refreshToken = new OAuthAccessToken(config); - String tokenTimestamp = storage.get(request, "tokenTimestamp"); - if(config.getAppType().equals("PARTNER") && refreshToken.isStale(tokenTimestamp)) { - System.out.println("Time to refresh access token"); - refreshToken.setToken(storage.get(request, "token")); - refreshToken.setTokenSecret(storage.get(request, "tokenSecret")); - refreshToken.setSessionHandle(storage.get(request, "sessionHandle")); - - boolean success = refreshToken.build().execute(); - if (!success) { - try { - request.getRequestDispatcher("index.jsp").forward(request, response); - } catch (ServletException e) { - logger.error(e); - } - } - // DEMONSTRATION ONLY - Store in Cookie - you can extend TokenStorage - // and implement the save() method for your database - storage.save(response,refreshToken.getAll()); - token = refreshToken.getToken(); - tokenSecret = refreshToken.getTokenSecret(); - } - - System.out.println(token); - System.out.println(tokenSecret); - - ApiClient apiClientForBankFeeds = new ApiClient(config.getBankFeedsUrl(),null,null,null); - BankFeedsApi bankFeedsApi = new BankFeedsApi(config); - bankFeedsApi.setApiClient(apiClientForBankFeeds); - bankFeedsApi.setOAuthToken(token, tokenSecret); - - ApiClient apiClientForAssets = new ApiClient(config.getAssetsUrl(),null,null,null); - AssetApi assetApi = new AssetApi(config); - assetApi.setApiClient(apiClientForAssets); - assetApi.setOAuthToken(token, tokenSecret); - - ApiClient apiClientForAccounting = new ApiClient(config.getApiUrl(),null,null,null); - AccountingApi accountingApi = new AccountingApi(config); - accountingApi.setApiClient(apiClientForAccounting); - accountingApi.setOAuthToken(token, tokenSecret); - - ApiClient apiClientForFiles = new ApiClient(config.getFilesUrl(),null,null,null); - FilesApi filesApi = new FilesApi(config); - filesApi.setApiClient(apiClientForFiles); - filesApi.setOAuthToken(token, tokenSecret); - - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - boolean summarizeErrors = false; - String ids= null; - boolean includeArchived = false; - String invoiceNumbers = null; - String contactIDs = null; - String statuses = null; - boolean createdByMyApp = false; - Calendar now = Calendar.getInstance(); - if (object.equals("Files")) { - /* FILES */ - //JSON - try { - List myFolders = filesApi.getFolders(null); - if (myFolders.size() > 1) { - System.out.println("My folder : " + myFolders.get(1).getName()); - } - - // Upload new File - String name = "XeroLogo.png"; - String fileName = "XeroLogo"; - String mimeType = URLConnection.guessContentTypeFromName(name); - InputStream inputStream = JsonConfig.class.getResourceAsStream("/" + name); - byte[] bytes = IOUtils.toByteArray(inputStream); - FileObject newFileObj = filesApi.uploadFile(null,bytes, name, fileName ,mimeType); - messages.add("Files found: " + newFileObj.getName()); - inputStream.close(); - - // Get ALL files - - Files myFiles = filesApi.getFiles(null, null, null); - if (myFiles.getItems().size() > 0) { - UUID fileId = myFiles.getItems().get(0).getId(); - String myFileName = myFiles.getItems().get(0).getName(); - messages.add("Files found - total: " + myFiles.getItems().size()); - messages.add("File Name: " + myFileName); - - // Get ONE file - FileObject oneFile = filesApi.getFile(fileId); - messages.add("Get one file - name: " + oneFile.getName()); - - // Update ONE file - FileObject newFileObject = new FileObject(); - newFileObject.setName("HelloWorld.jpg"); - FileObject updatedFile = filesApi.updateFile(fileId, newFileObject); - messages.add("Get one file - name: " + updatedFile.getName()); - - // GET File Content - ByteArrayInputStream input= filesApi.getFileContent(fileId); - String saveFilePath = saveFile(input,"MyNewFile.jpg"); - messages.add("Save it here: " + saveFilePath); - - // Create file Association - Association association = new Association(); - Invoices invoices = accountingApi.getInvoices(null, null, null, null, null, null, "AUTHORISED", null, false, null, null); - UUID invoiceId = invoices.getInvoices().get(0).getInvoiceID(); - association.setObjectGroup(ObjectGroup.INVOICE); - association.setObjectId(invoiceId); - Association fileAssociation = filesApi.createFileAssociation(fileId, association); - messages.add("file association obj group: " + fileAssociation.getObjectGroup()); - - List fileAssociations = filesApi.getFileAssociations(fileId); - messages.add("Total File associations: " + fileAssociations.size()); - UUID objectId = fileAssociations.get(0).getObjectId(); - - // GET Object Associations - List objectAssociations = filesApi.getAssociationsByObject(objectId); - messages.add("Total OBJECT associations: " + objectAssociations.size()); - - // DELETE file Association - FileResponse204 deletedAssociation = filesApi.deleteFileAssociation(fileId, objectId); - messages.add("Delete file association status: " + deletedAssociation.getStatus()); - - List fileAssociationsNew = filesApi.getFileAssociations(fileId); - messages.add("Total File associations: " + fileAssociationsNew.size()); - - // DELETE ONE file - FileResponse204 deletedFile = filesApi.deleteFile(fileId); - messages.add("Delete file status: " + deletedFile.getStatus()); - } - - } catch (Exception e) { - System.out.println(e.getMessage()); - - } - } else if (object.equals("Folders")) { - /* FOLDERS */ - //JSON - try { - // Get ALL Folders - List myFolders = filesApi.getFolders(null); - if (myFolders.size() > 0) { - UUID folderId = myFolders.get(0).getId(); - messages.add("Folders found - total: " + myFolders.size()); - - // GET one Folder - Folder oneFolder = filesApi.getFolder(folderId); - messages.add("One Folders found - name: " + oneFolder.getName()); - - // Create one Folder - Folder folder = new Folder(); - folder.setEmail("foo@bar.com"); - folder.setName("NewFolder"+ SampleData.loadRandomNum()); - Folder createdFolder = filesApi.createFolder(folder); - UUID newFolderId = createdFolder.getId(); - messages.add("New Folder - name: " + createdFolder.getName()); - - // Update one Folder - Folder folder2 = new Folder(); - folder2.setName("UpdatedFolder"+ SampleData.loadRandomNum()); - Folder updatedFolder = filesApi.updateFolder(newFolderId,folder2); - messages.add("Updated Folder - name: " + updatedFolder.getName()); - - // Update one Folder - //FileResponse204 deleteFolder = filesApi.deleteFolder(newFolderId); - //messages.add("Deleted Folder - status: " + deleteFolder.getStatus()); - - // Update one Folder - Folder inboxFolder = filesApi.getInbox(); - messages.add("Get Inbox Folder - email: " + inboxFolder.getEmail()); - - } - - } catch (Exception e) { - System.out.println(e.toString()); - } - - } else if (object.equals("Accounts")) { - /* ACCOUNTS */ - //JSON - try { - // GET all accounts - Accounts accounts = accountingApi.getAccounts(null, null, null); - messages.add("Get a all Accounts - total : " + accounts.getAccounts().size()); - - // GET one account - Accounts oneAccount = accountingApi.getAccount(accounts.getAccounts().get(0).getAccountID()); - messages.add("Get a one Account - name : " + oneAccount.getAccounts().get(0).getName()); - - // CREATE account - Account acct = new Account(); - acct.setName("Bye" + SampleData.loadRandomNum()); - acct.setCode("Hello" + SampleData.loadRandomNum()); - acct.setDescription("Foo boo"); - acct.setType(com.xero.models.accounting.AccountType.EXPENSE); - Accounts newAccount = accountingApi.createAccount(acct); - System.out.println("Create a new Account - Name : " + newAccount.getAccounts().get(0).getName() + " Description : " + newAccount.getAccounts().get(0).getDescription() + ""); - UUID accountID = newAccount.getAccounts().get(0).getAccountID(); - - System.out.println(newAccount.getAccounts().get(0).toString()); - System.out.println("Bank Account type: " + newAccount.getAccounts().get(0).getBankAccountType()); - - // CREATE Bank account - Account bankAcct = new Account(); - bankAcct.setName("Checking " + SampleData.loadRandomNum()); - bankAcct.setCode("12" + SampleData.loadRandomNum()); - bankAcct.setType(com.xero.models.accounting.AccountType.BANK); - bankAcct.setBankAccountNumber("1234" + SampleData.loadRandomNum()); - Accounts newBankAccount = accountingApi.createAccount(bankAcct); - messages.add("Create Bank Account - Name : " + newBankAccount.getAccounts().get(0).getName()); - System.out.println(newBankAccount.getAccounts().get(0).toString()); - System.out.println("Bank Account type: " + newBankAccount.getAccounts().get(0).getBankAccountType()); - - // GET BANK account - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); - messages.add("Get a all Accounts - total : " + accountsWhere.getAccounts().size()); - - - // UDPATE Account - newAccount.getAccounts().get(0).setDescription("Monsters Inc."); - newAccount.getAccounts().get(0).setStatus(null); - Accounts updateAccount = accountingApi.updateAccount(accountID, newAccount); - messages.add("Update Account - Name : " + updateAccount.getAccounts().get(0).getName() + " Description : " + updateAccount.getAccounts().get(0).getDescription() + ""); - - // ARCHIVE Account - Accounts archiveAccounts = new Accounts(); - Account archiveAccount = new Account(); - archiveAccount.setStatus(com.xero.models.accounting.Account.StatusEnum.ARCHIVED); - archiveAccount.setAccountID(accountID); - archiveAccounts.addAccountsItem(archiveAccount); - Accounts achivedAccount = accountingApi.updateAccount(accountID, archiveAccounts); - messages.add("Archived Account - Name : " + achivedAccount.getAccounts().get(0).getName() + " Status: " + achivedAccount.getAccounts().get(0).getStatus()); - - // DELETE Account - UUID deleteAccountID = newAccount.getAccounts().get(0).getAccountID(); - Accounts deleteAccount = accountingApi.deleteAccount(deleteAccountID); - messages.add("Delete account - Status? : " + deleteAccount.getAccounts().get(0).getStatus()); - - } catch (Exception e) { - System.out.println(e.toString()); - e.printStackTrace(); - } - - } else if (object.equals("GetAttachments")) { - - try { - // GET Account Attachment - Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); - if (accounts.getAccounts().size() > 0) { - UUID accountID = accounts.getAccounts().get(0).getAccountID(); - Attachments accountsAttachments = accountingApi.getAccountAttachments(accountID); - if (accountsAttachments.getAttachments().size() > 0) { - UUID attachementId = accountsAttachments.getAttachments().get(0).getAttachmentID(); - String contentType = accountsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream input = accountingApi.getAccountAttachmentById(accountID,attachementId, contentType); - String fileName = "Account_" + accountsAttachments.getAttachments().get(0).getFileName(); - String saveFilePath = saveFile(input,fileName); - messages.add("Get Account attachment - save it here: " + saveFilePath); - } - } - - // GET BankTransactions Attachment - BankTransactions bankTransactions = accountingApi.getBankTransactions(ifModifiedSince, where, order, null, null); - if (bankTransactions.getBankTransactions().size() > 0) { - UUID BankTransactionID = bankTransactions.getBankTransactions().get(0).getBankTransactionID(); - Attachments bankTransactionsAttachments = accountingApi.getBankTransactionAttachments(BankTransactionID); - if (bankTransactionsAttachments.getAttachments().size() > 0) { - UUID BankTransactionAttachementID = bankTransactionsAttachments.getAttachments().get(0).getAttachmentID(); - String BankTransactionContentType = bankTransactionsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream BankTransactionInput = accountingApi.getAccountAttachmentById(BankTransactionID,BankTransactionAttachementID, BankTransactionContentType); - String BankTransactionFileName = "BankTransaction_" + bankTransactionsAttachments.getAttachments().get(0).getFileName(); - String BankTransactionSaveFilePath = saveFile(BankTransactionInput,BankTransactionFileName); - messages.add("Get BankTransactions attachment - save it here: " + BankTransactionSaveFilePath); - } - } - - // GET BankTransfers Attachment - BankTransfers bankTransfers = accountingApi.getBankTransfers(ifModifiedSince, where, order); - if (bankTransfers.getBankTransfers().size() > 0) { - UUID BankTransferID = bankTransfers.getBankTransfers().get(0).getBankTransferID(); - Attachments bankTransfersAttachments = accountingApi.getBankTransferAttachments(BankTransferID); - if (bankTransfersAttachments.getAttachments().size() > 0) { - UUID BankTransferAttachementID = bankTransfersAttachments.getAttachments().get(0).getAttachmentID(); - String BankTransferContentType = bankTransfersAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream BankTransferInput = accountingApi.getAccountAttachmentById(BankTransferID,BankTransferAttachementID, BankTransferContentType); - String BankTransferFileName = "BankTransfer_" + bankTransfersAttachments.getAttachments().get(0).getFileName(); - String BankTransferSaveFilePath = saveFile(BankTransferInput,BankTransferFileName); - messages.add("Get BankTransfers attachment - save it here: " + BankTransferSaveFilePath); - } - } - // GET Contacts Attachment - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - if (contacts.getContacts().size() > 0) { - UUID ContactID = contacts.getContacts().get(0).getContactID(); - Attachments contactsAttachments = accountingApi.getContactAttachments(ContactID); - if (contactsAttachments.getAttachments().size() > 0) { - UUID ContactAttachementID = contactsAttachments.getAttachments().get(0).getAttachmentID(); - String ContactContentType = contactsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream ContactInput = accountingApi.getAccountAttachmentById(ContactID,ContactAttachementID, ContactContentType); - String ContactFileName = "Contact_" + contactsAttachments.getAttachments().get(0).getFileName(); - String ContactSaveFilePath = saveFile(ContactInput,ContactFileName); - messages.add("Get Contacts attachment - save it here: " + ContactSaveFilePath); - } - } - // GET CreditNotes Attachment - CreditNotes creditNotes = accountingApi.getCreditNotes(ifModifiedSince, where, order, null); - if (creditNotes.getCreditNotes().size() > 0) { - UUID CreditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - Attachments creditNotesAttachments = accountingApi.getCreditNoteAttachments(CreditNoteID); - if (creditNotesAttachments.getAttachments().size() > 0) { - UUID CreditNoteAttachementID = creditNotesAttachments.getAttachments().get(0).getAttachmentID(); - String CreditNoteContentType = creditNotesAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream CreditNoteInput = accountingApi.getAccountAttachmentById(CreditNoteID,CreditNoteAttachementID, CreditNoteContentType); - String CreditNoteFileName = "CreditNote_" + creditNotesAttachments.getAttachments().get(0).getFileName(); - String CreditNoteSaveFilePath = saveFile(CreditNoteInput,CreditNoteFileName); - messages.add("Get CreditNotes attachment - save it here: " + CreditNoteSaveFilePath); - } - } - - // GET Invoices Attachment - Invoices invoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - if (invoices.getInvoices().size() > 0) { - UUID InvoiceID = invoices.getInvoices().get(0).getInvoiceID(); - Attachments invoicesAttachments = accountingApi.getInvoiceAttachments(InvoiceID); - if (invoicesAttachments.getAttachments().size() > 0) { - UUID InvoiceAttachementID = invoicesAttachments.getAttachments().get(0).getAttachmentID(); - String InvoiceContentType = invoicesAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream InvoiceInput = accountingApi.getAccountAttachmentById(InvoiceID,InvoiceAttachementID, InvoiceContentType); - String InvoiceFileName = "Invoice_" + invoicesAttachments.getAttachments().get(0).getFileName(); - String InvoiceSaveFilePath = saveFile(InvoiceInput,InvoiceFileName); - messages.add("Get Invoices attachment - save it here: " + InvoiceSaveFilePath); - } - } - - // GET ManualJournals Attachment - ManualJournals manualJournals = accountingApi.getManualJournals(ifModifiedSince, where, order, null); - if (manualJournals.getManualJournals().size() > 0) { - UUID ManualJournalID = manualJournals.getManualJournals().get(0).getManualJournalID(); - Attachments manualJournalsAttachments = accountingApi.getManualJournalAttachments(ManualJournalID); - if (manualJournalsAttachments.getAttachments().size() > 0) { - UUID ManualJournalAttachementID = manualJournalsAttachments.getAttachments().get(0).getAttachmentID(); - String ManualJournalContentType = manualJournalsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream ManualJournalInput = accountingApi.getAccountAttachmentById(ManualJournalID,ManualJournalAttachementID, ManualJournalContentType); - String ManualJournalFileName = "ManualJournal_" + manualJournalsAttachments.getAttachments().get(0).getFileName(); - String ManualJournalSaveFilePath = saveFile(ManualJournalInput,ManualJournalFileName); - messages.add("Get ManualJournals attachment - save it here: " + ManualJournalSaveFilePath); - } - } - - // GET Receipts Attachment - Receipts receipts = accountingApi.getReceipts(ifModifiedSince, where, order, null); - if (receipts.getReceipts().size() > 0) { - UUID ReceiptID = receipts.getReceipts().get(0).getReceiptID(); - Attachments receiptsAttachments = accountingApi.getReceiptAttachments(ReceiptID); - if (receiptsAttachments.getAttachments().size() > 0) { - UUID ReceiptAttachementID = receiptsAttachments.getAttachments().get(0).getAttachmentID(); - String ReceiptContentType = receiptsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream ReceiptInput = accountingApi.getAccountAttachmentById(ReceiptID,ReceiptAttachementID, ReceiptContentType); - String ReceiptFileName = "Receipt_" + receiptsAttachments.getAttachments().get(0).getFileName(); - String ReceiptSaveFilePath = saveFile(ReceiptInput,ReceiptFileName); - messages.add("Get Receipts attachment - save it here: " + ReceiptSaveFilePath); - } - } - - // GET RepeatingInvoices Attachment - RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(where, order); - if (repeatingInvoices.getRepeatingInvoices().size() > 0) { - UUID RepeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - Attachments repeatingInvoicesAttachments = accountingApi.getRepeatingInvoiceAttachments(RepeatingInvoiceID); - if (repeatingInvoicesAttachments.getAttachments().size() > 0) { - UUID RepeatingInvoiceAttachementID = repeatingInvoicesAttachments.getAttachments().get(0).getAttachmentID(); - String RepeatingInvoiceContentType = repeatingInvoicesAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream RepeatingInvoiceInput = accountingApi.getAccountAttachmentById(RepeatingInvoiceID,RepeatingInvoiceAttachementID, RepeatingInvoiceContentType); - String RepeatingInvoiceFileName = "RepeatingInvoice_" + repeatingInvoicesAttachments.getAttachments().get(0).getFileName(); - String RepeatingInvoiceSaveFilePath = saveFile(RepeatingInvoiceInput,RepeatingInvoiceFileName); - messages.add("Get RepeatingInvoices attachment - save it here: " + RepeatingInvoiceSaveFilePath); - } - } - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("CreateAttachments")) { - try { - // JSON - InputStream inputStream = JsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] bytes = IOUtils.toByteArray(inputStream); - String newFileName = "sample5.jpg"; - - // CREATE Accounts attachment - where = "Status==\"ACTIVE\""; - Accounts myAccounts = accountingApi.getAccounts(ifModifiedSince, where, order); - if ( myAccounts.getAccounts().size() > 0) { - UUID accountID = myAccounts.getAccounts().get(0).getAccountID(); - String accountName = myAccounts.getAccounts().get(0).getName(); - Attachments createdAttachments = accountingApi.createAccountAttachmentByFileName(accountID, newFileName, bytes); - messages.add("Attachment to Name: " + accountName + " Account ID: " + accountID + " attachment - ID: " + createdAttachments.getAttachments().get(0).getAttachmentID()); - } - - // CREATE BankTransactions attachment - BankTransactions myBanktransactions = accountingApi.getBankTransactions(ifModifiedSince, where, order, null, null); - if ( myBanktransactions.getBankTransactions().size() > 0) { - UUID banktransactionID = myBanktransactions.getBankTransactions().get(0).getBankTransactionID(); - Attachments createdBanktransationAttachments = accountingApi.createBankTransactionAttachmentByFileName(banktransactionID, newFileName, bytes); - messages.add("Attachment to BankTransaction ID: " + banktransactionID + " attachment - ID: " + createdBanktransationAttachments.getAttachments().get(0).getAttachmentID()); - } - - // CREATE BankTransfer attachment - where = null; - BankTransfers myBankTransfer = accountingApi.getBankTransfers(ifModifiedSince, where, order); - if ( myBankTransfer.getBankTransfers().size() > 0) { - UUID bankTransferID = myBankTransfer.getBankTransfers().get(0).getBankTransferID(); - Attachments createdBankTransferAttachments = accountingApi.createBankTransferAttachmentByFileName(bankTransferID, newFileName, bytes); - messages.add("Attachment to BankTransfer ID: " + bankTransferID + " attachment - ID: " + createdBankTransferAttachments.getAttachments().get(0).getAttachmentID()); - } - - // CREATE Contacts attachment - where = "ContactStatus==\"ACTIVE\""; - Contacts contactsWhere = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - if ( contactsWhere.getContacts().size() > 0) { - UUID contactID = contactsWhere.getContacts().get(0).getContactID(); - Attachments createdContactAttachments = accountingApi.createContactAttachmentByFileName(contactID, newFileName, bytes); - messages.add("Attachment to Contact ID: " + contactID + " attachment - ID: " + createdContactAttachments.getAttachments().get(0).getAttachmentID()); - } - - where = "Status==\"ACTIVE\""; - // CREATE CreditNotes attachment - CreditNotes myCreditNotes = accountingApi.getCreditNotes(ifModifiedSince, where, order, null); - if ( myCreditNotes.getCreditNotes().size() > 0) { - UUID creditNoteID = myCreditNotes.getCreditNotes().get(0).getCreditNoteID(); - Attachments createdCreditNoteAttachments = accountingApi.createCreditNoteAttachmentByFileName(creditNoteID, newFileName, bytes); - messages.add("Attachment to Credit Notes ID: " + creditNoteID + " attachment - ID: " + createdCreditNoteAttachments.getAttachments().get(0).getAttachmentID()); - } - - // CREATE invoice attachment - Invoices myInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - if ( myInvoices.getInvoices().size() > 0) { - UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); - Attachments createdInvoiceAttachments = accountingApi.createInvoiceAttachmentByFileName(invoiceID, newFileName, bytes); - messages.add("Attachment to Invoice ID: " + invoiceID + " attachment - ID: " + createdInvoiceAttachments.getAttachments().get(0).getAttachmentID()); - } - - // CREATE ManualJournals attachment - ManualJournals myManualJournals = accountingApi.getManualJournals(ifModifiedSince, where, order, null); - if ( myManualJournals.getManualJournals().size() > 0) { - UUID manualJournalID = myManualJournals.getManualJournals().get(0).getManualJournalID(); - Attachments createdManualJournalAttachments = accountingApi.createManualJournalAttachmentByFileName(manualJournalID, newFileName, bytes); - messages.add("Attachment to Manual Journal ID: " + manualJournalID + " attachment - ID: " + createdManualJournalAttachments.getAttachments().get(0).getAttachmentID()); - } - - // CREATE Receipts attachment - Receipts myReceipts = accountingApi.getReceipts(ifModifiedSince, where, order, null); - if ( myReceipts.getReceipts().size() > 0) { - UUID receiptID = myReceipts.getReceipts().get(0).getReceiptID(); - Attachments createdReceiptsAttachments = accountingApi.createReceiptAttachmentByFileName(receiptID, newFileName, bytes); - messages.add("Attachment to Receipt ID: " + receiptID + " attachment - ID: " + createdReceiptsAttachments.getAttachments().get(0).getAttachmentID()); - } - - // CREATE Repeating Invoices attachment - RepeatingInvoices myRepeatingInvoices = accountingApi.getRepeatingInvoices(where, order); - if ( myRepeatingInvoices.getRepeatingInvoices().size() > 0) { - UUID repeatingInvoiceID = myRepeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - Attachments createdRepeatingInvoiceAttachments = accountingApi.createRepeatingInvoiceAttachmentByFileName(repeatingInvoiceID, newFileName, bytes); - messages.add("Attachment to Repeating Invoices ID: " + repeatingInvoiceID + " attachment - ID: " + createdRepeatingInvoiceAttachments.getAttachments().get(0).getAttachmentID()); - } - - } catch (Exception e) { - System.out.println(e); - } - } else if(object.equals("Assets")) { - /* Asset */ - // Create Asset - try { - Asset asset = new Asset(); - asset.setAssetName("Computer" + SampleData.loadRandomNum()); - asset.setAssetNumber("1234" + SampleData.loadRandomNum()); - Asset newAsset = assetApi.createAsset(asset); - messages.add("New Asset created: " + newAsset.getAssetName()); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - String orderBy = null; - String sortDirection = null; - String filterBy = null; - String status = "DRAFT"; - Assets assets = assetApi.getAssets(status, null, null, orderBy, sortDirection, filterBy); - messages.add("Assets Found: " + assets.getItems().get(0).getAssetName()); - - } catch (Exception e) { - System.out.println(e.toString()); - } - - try { - List assetTypes = assetApi.getAssetTypes(); - messages.add("AssetType Found: " + assetTypes.get(0).getAssetTypeName()); - } catch (Exception e) { - System.out.println(e.toString()); - } - - try { - where = "Type==\"FIXED\""; - Accounts accountFixedAsset = accountingApi.getAccounts(ifModifiedSince, where, order); - UUID fixedAssetAccountId = accountFixedAsset.getAccounts().get(0).getAccountID(); - where = "Type==\"EXPENSE\""; - Accounts accountDepreciationExpense = accountingApi.getAccounts(ifModifiedSince, where, order); - UUID depreciationExpenseAccountId = accountDepreciationExpense.getAccounts().get(0).getAccountID(); - where = "Type==\"DEPRECIATN\""; - Accounts accountAccumulatedDepreciation = accountingApi.getAccounts(ifModifiedSince, where, order); - UUID accumulatedDepreciationAccountId = accountAccumulatedDepreciation.getAccounts().get(0).getAccountID(); - - AssetType assetType = new AssetType(); - assetType.setAssetTypeName("Machinery" + SampleData.loadRandomNum()); - assetType.setFixedAssetAccountId(fixedAssetAccountId); - assetType.setDepreciationExpenseAccountId(depreciationExpenseAccountId); - assetType.setAccumulatedDepreciationAccountId(accumulatedDepreciationAccountId); - - float depreciationRate = 0.05f; - BookDepreciationSetting bookDepreciationSetting = new BookDepreciationSetting(); - bookDepreciationSetting.setAveragingMethod(AveragingMethodEnum.ACTUALDAYS); - bookDepreciationSetting.setDepreciationCalculationMethod(DepreciationCalculationMethodEnum.NONE); - bookDepreciationSetting.setDepreciationRate(depreciationRate); - bookDepreciationSetting.setDepreciationMethod(DepreciationMethodEnum.DIMINISHINGVALUE100); - assetType.setBookDepreciationSetting(bookDepreciationSetting); - - AssetType newAssetType = assetApi.createAssetType(assetType); - messages.add("Asset Type Created: " + newAssetType.getAssetTypeName()); - - } catch (Exception e) { - System.out.println(e.toString()); - } - - try { - Setting setting = assetApi.getAssetSettings(); - messages.add("Asset Setting Start date: " + setting.getAssetStartDate()); - } catch (Exception e) { - System.out.println(e.toString()); - } - - } else if(object.equals("BankFeedConnections")) { - /* BANKFEED CONNECTIONS */ - // Create New Feed Connection - try { - FeedConnection newBank = new FeedConnection(); - newBank.setAccountName("SDK Bank " + SampleData.loadRandomNum()); - newBank.setAccountNumber("1234" + SampleData.loadRandomNum()); - newBank.setAccountType(AccountTypeEnum.BANK); - newBank.setAccountToken("foobar" + SampleData.loadRandomNum()); - newBank.setCurrency("GBP"); - - FeedConnections feedConnections = new FeedConnections(); - feedConnections.addItemsItem(newBank); - - FeedConnections fc1 = bankFeedsApi.createFeedConnections(feedConnections); - messages.add("New Bank with status: " + fc1.getItems().get(0).getStatus()); - } catch (Exception e) { - System.out.println(e.toString()); - } - - // Get ALL Feed Connection - try { - FeedConnections fc = bankFeedsApi.getFeedConnections(null,null); - messages.add("Total Banks found: " + fc.getItems().size()); - } catch (Exception e) { - System.out.println(e.toString()); - } - - // Get one Feed Connection - try { - FeedConnections fc = bankFeedsApi.getFeedConnections(null, null); - String id = fc.getItems().get(0).getId(); - FeedConnection oneFC = bankFeedsApi.getFeedConnection(id); - messages.add("One Bank: " + oneFC.getAccountName()); - } catch (Exception e) { - System.out.println(e.toString()); - } - - // Delete Feed Connection - try { - FeedConnections fc = bankFeedsApi.getFeedConnections(null, null); - FeedConnections allFeedConnections = bankFeedsApi.getFeedConnections(null, null); - FeedConnections deleteFeedConnections = new FeedConnections(); - - FeedConnection feedConnectionOne = new FeedConnection(); - feedConnectionOne.setId(allFeedConnections.getItems().get(fc.getItems().size()-1).getId()); - deleteFeedConnections.addItemsItem(feedConnectionOne); - - FeedConnections deletedFeedConnection = bankFeedsApi.deleteFeedConnections(deleteFeedConnections); - messages.add("Deleted Bank status: " + deletedFeedConnection.getItems().get(0).getStatus()); - } catch (Exception e) { - System.out.println(e.toString()); - } - - } else if(object.equals("BankStatements")) { - // BANK STATEMENTS - // Create One Statement - int day = now.get(Calendar.DATE); - int year = now.get(Calendar.YEAR); - int lastMonth = now.get(Calendar.MONTH) - 1; - int nextMonth = now.get(Calendar.MONTH) + 1; - if (lastMonth == -1) { - lastMonth = 12; - year = year -1; - } - - if (nextMonth == 13) { - nextMonth = 1; - year = year + 1; - } - - if (day > 28) { - day = 28; - } - try { - Statements arrayOfStatements = new Statements(); - Statement newStatement = new Statement(); - - LocalDate stDate = LocalDate.of(year, nextMonth, day); - newStatement.setStartDate(stDate); - LocalDate endDate = LocalDate.of(year, lastMonth, day); - newStatement.endDate(endDate); - StartBalance stBalance = new StartBalance(); - stBalance.setAmount("100"); - stBalance.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatement.setStartBalance(stBalance); - - EndBalance endBalance = new EndBalance(); - endBalance.setAmount("300"); - endBalance.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatement.endBalance(endBalance); - - FeedConnections fc = bankFeedsApi.getFeedConnections(null, null); - newStatement.setFeedConnectionId(fc.getItems().get(2).getId().toString()); - - StatementLine newStatementLine = new StatementLine(); - newStatementLine.setAmount("50"); - newStatementLine.setChequeNumber("123" + SampleData.loadRandomNum()); - newStatementLine.setDescription("My new line"); - newStatementLine.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatementLine.setReference("Foobar" + SampleData.loadRandomNum()); - newStatementLine.setPayeeName("StarLord" + SampleData.loadRandomNum()); - newStatementLine.setTransactionId("1234" + SampleData.loadRandomNum()); - LocalDate postedDate = LocalDate.of(year, lastMonth, day); - newStatementLine.setPostedDate(postedDate); - - StatementLines arrayStatementLines = new StatementLines(); - arrayStatementLines.add(newStatementLine); - - newStatement.setStatementLines(arrayStatementLines); - arrayOfStatements.addItemsItem(newStatement); - Statements rStatements = bankFeedsApi.createStatements(arrayOfStatements); - messages.add("New Bank Statement Status: " + rStatements.getItems().get(0).getStatus()); - - } catch (Exception e) { - TypeReference typeRef = new TypeReference() {}; - Statements statementErrors = apiClientForBankFeeds.getObjectMapper().readValue(e.getMessage(), typeRef); - System.out.println(statementErrors.getItems().get(0).getErrors().get(0).getDetail()); - } - - // Create One Statement, Then GET One Statement - try { - Statements arrayOfStatements = new Statements(); - Statement newStatement = new Statement(); - LocalDate stDate = LocalDate.of(year, lastMonth, 01); - newStatement.setStartDate(stDate); - LocalDate endDate = LocalDate.of(year, lastMonth, 15); - newStatement.endDate(endDate); - StartBalance stBalance = new StartBalance(); - stBalance.setAmount("100"); - stBalance.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatement.setStartBalance(stBalance); - - EndBalance endBalance = new EndBalance(); - endBalance.setAmount("300"); - endBalance.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatement.endBalance(endBalance); - - FeedConnections fc = bankFeedsApi.getFeedConnections(null, null); - newStatement.setFeedConnectionId(fc.getItems().get(2).getId().toString()); - - StatementLine newStatementLine = new StatementLine(); - newStatementLine.setAmount("50"); - newStatementLine.setChequeNumber("123" + SampleData.loadRandomNum()); - newStatementLine.setDescription("My new line"); - newStatementLine.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatementLine.setReference("Foobar" + SampleData.loadRandomNum()); - newStatementLine.setPayeeName("StarLord" + SampleData.loadRandomNum()); - newStatementLine.setTransactionId("1234" + SampleData.loadRandomNum()); - LocalDate postedDate = LocalDate.of(year, lastMonth, 05); - newStatementLine.setPostedDate(postedDate); - - StatementLines arrayStatementLines = new StatementLines(); - arrayStatementLines.add(newStatementLine); - - newStatement.setStatementLines(arrayStatementLines); - arrayOfStatements.addItemsItem(newStatement); - Statements rStatements = bankFeedsApi.createStatements(arrayOfStatements); - String statementId = rStatements.getItems().get(0).getId(); - Statement oneStatement = bankFeedsApi.getStatement(statementId); - messages.add("New Bank Statement Status: " + oneStatement.getStatementLineCount()); - - } catch (Exception e) { - System.out.println(e.toString()); - } - - // Create Duplicate Statement - to test error handling - try { - Statements arrayOfStatements = new Statements(); - Statement newStatement = new Statement(); - LocalDate stDate = LocalDate.of(year, lastMonth, 01); - newStatement.setStartDate(stDate); - LocalDate endDate = LocalDate.of(year, lastMonth, 15); - newStatement.endDate(endDate); - StartBalance stBalance = new StartBalance(); - stBalance.setAmount("100"); - stBalance.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatement.setStartBalance(stBalance); - - EndBalance endBalance = new EndBalance(); - endBalance.setAmount("300"); - endBalance.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatement.endBalance(endBalance); - - FeedConnections fc = bankFeedsApi.getFeedConnections(null,null); - newStatement.setFeedConnectionId(fc.getItems().get(2).getId().toString()); - - StatementLine newStatementLine = new StatementLine(); - newStatementLine.setAmount("50"); - newStatementLine.setChequeNumber("123"); - newStatementLine.setDescription("My new line"); - newStatementLine.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatementLine.setReference("Foobar" ); - newStatementLine.setPayeeName("StarLord"); - newStatementLine.setTransactionId("1234"); - LocalDate postedDate = LocalDate.of(year, lastMonth, 05); - newStatementLine.setPostedDate(postedDate); - - StatementLines arrayStatementLines = new StatementLines(); - arrayStatementLines.add(newStatementLine); - - newStatement.setStatementLines(arrayStatementLines); - arrayOfStatements.addItemsItem(newStatement); - Statements rStatements2 = bankFeedsApi.createStatements(arrayOfStatements); - messages.add("New Bank Statement Status: " + rStatements2.getItems().get(0).getStatus()); - - //DUPLICATE - Statements rStatements3 = bankFeedsApi.createStatements(arrayOfStatements); - - messages.add("New Bank Statement Status: " + rStatements3.getItems().get(0).getStatus()); - - } catch (Exception e) { - TypeReference typeRef = new TypeReference() {}; - Statements statementErrors = apiClientForBankFeeds.getObjectMapper().readValue(e.getMessage(), typeRef); - System.out.println(statementErrors.getItems().get(0).getErrors().get(0).getDetail()); - System.out.println(statementErrors.getItems().get(0).getErrors().get(0).getStatus()); - } - - //Get ALL Statements - try { - Statements allStatements = bankFeedsApi.getStatements(null, null, null, null, null); - messages.add("Statement total: " + allStatements.getItems().size()); - } catch (Exception e) { - TypeReference typeRef = new TypeReference() {}; - Statements statementErrors = apiClientForBankFeeds.getObjectMapper().readValue(e.getMessage(), typeRef); - System.out.println(statementErrors.getItems().get(0).getErrors().get(0).getDetail()); - } - - try { - Statements arrayOfStatements = new Statements(); - Statement newStatement = new Statement(); - - LocalDate stDate = LocalDate.of(year, lastMonth, day); - newStatement.setStartDate(stDate); - - LocalDate endDate = LocalDate.of(year, lastMonth, day); - newStatement.endDate(endDate); - StartBalance stBalance = new StartBalance(); - stBalance.setAmount("100"); - stBalance.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatement.setStartBalance(stBalance); - - EndBalance endBalance = new EndBalance(); - endBalance.setAmount("150"); - endBalance.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatement.endBalance(endBalance); - - FeedConnections fc = bankFeedsApi.getFeedConnections(null,null); - - if (fc.getItems().size() > 2) { - newStatement.setFeedConnectionId(fc.getItems().get(0).getId().toString()); - - StatementLine newStatementLine = new StatementLine(); - newStatementLine.setAmount("50"); - newStatementLine.setChequeNumber("123" + SampleData.loadRandomNum()); - newStatementLine.setDescription("My new line"); - newStatementLine.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatementLine.setReference("Foobar" + SampleData.loadRandomNum()); - newStatementLine.setPayeeName("StarLord" + SampleData.loadRandomNum()); - newStatementLine.setTransactionId("1234" + SampleData.loadRandomNum()); - - LocalDate postedDate = LocalDate.of(year, lastMonth, day); - newStatementLine.setPostedDate(postedDate); - - StatementLines arrayStatementLines = new StatementLines(); - arrayStatementLines.add(newStatementLine); - - newStatement.setStatementLines(arrayStatementLines); - - arrayOfStatements.addItemsItem(newStatement); - - Statement newStatement2 = new Statement(); - LocalDate stDate2 = LocalDate.of(year, lastMonth, day); - newStatement2.setStartDate(stDate2); - - LocalDate endDate2 = LocalDate.of(year, lastMonth, day); - newStatement2.endDate(endDate2); - StartBalance stBalance2 = new StartBalance(); - stBalance2.setAmount("100"); - stBalance2.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatement2.setStartBalance(stBalance2); - - EndBalance endBalance2 = new EndBalance(); - endBalance2.setAmount("150"); - endBalance2.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatement2.endBalance(endBalance2); - - newStatement2.setFeedConnectionId(fc.getItems().get(1).getId().toString()); - - StatementLine newStatementLine2 = new StatementLine(); - newStatementLine2.setAmount("50"); - newStatementLine2.setChequeNumber("123" + SampleData.loadRandomNum()); - newStatementLine2.setDescription("My new line"); - newStatementLine2.setCreditDebitIndicator(CreditDebitIndicator.CREDIT); - newStatementLine2.setReference("Foobar" + SampleData.loadRandomNum()); - newStatementLine2.setPayeeName("StarLord" + SampleData.loadRandomNum()); - newStatementLine2.setTransactionId("1234" + SampleData.loadRandomNum()); - LocalDate postedDate2 = LocalDate.of(year, lastMonth, day); - newStatementLine2.setPostedDate(postedDate2); - - StatementLines arrayStatementLines2 = new StatementLines(); - arrayStatementLines2.add(newStatementLine2); - - newStatement2.setStatementLines(arrayStatementLines2); - - arrayOfStatements.addItemsItem(newStatement2); - - Statements rStatements = bankFeedsApi.createStatements(arrayOfStatements); - - messages.add("Statement Status: " + rStatements.getItems().get(0).getStatus()); - - } else { - messages.add("Need at least 2 feed connections to perform this test"); - } - - } catch (XeroApiException e) { - try { - TypeReference typeRef = new TypeReference() {}; - com.xero.models.bankfeeds.Error error = apiClientForBankFeeds.getObjectMapper().readValue(e.getMessage(), typeRef); - messages.add(error.getDetail()); - } catch (IOException ioe) { - System.out.println("IO:" + ioe.toString()); - } - } catch (Exception e) { - messages.add("Generic Exception " + e.toString()); - } - - } else if (object.equals("BankTransactions")) { - /* BANK TRANSACTION */ - try { - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); - - Account bankAcct = new Account(); - bankAcct.setCode(accountsWhere.getAccounts().get(0).getCode()); - - where = null; - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // Maker sure we have at least 1 bank - if(accountsWhere.getAccounts().size() > 0) { - // Create Bank Transaction - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode("400"); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setUnitAmount(20.0); - lineItems.add(li); - BankTransaction bt = new BankTransaction(); - bt.setBankAccount(bankAcct); - bt.setContact(useContact); - bt.setLineitems(lineItems); - bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.SPEND); - BankTransactions bts = new BankTransactions(); - bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(bts, summarizeErrors); - messages.add("Create new BankTransaction : amount:" + newBankTransaction.getBankTransactions().get(0).getTotal()); - - // GET all Bank Transaction - BankTransactions bankTransactions = accountingApi.getBankTransactions(ifModifiedSince, where, order, null, null); - messages.add("Get a all Bank Transactions - total : " + bankTransactions.getBankTransactions().size()); - - // GET one Bank Transaction - BankTransactions oneBankTransaction = accountingApi.getBankTransaction(bankTransactions.getBankTransactions().get(0).getBankTransactionID()); - messages.add("Get a one Bank Transaction : amount:" + oneBankTransaction.getBankTransactions().get(0).getTotal()); - - // UDPATE Bank Transaction - newBankTransaction.getBankTransactions().get(0).setSubTotal(null); - newBankTransaction.getBankTransactions().get(0).setTotal(null); - newBankTransaction.getBankTransactions().get(0).setReference("You just updated"); - BankTransactions updateBankTransaction = accountingApi.updateBankTransaction(newBankTransaction.getBankTransactions().get(0).getBankTransactionID(),newBankTransaction); - messages.add("Update new BankTransaction : reference:" + updateBankTransaction.getBankTransactions().get(0).getReference()); - - // DELETE Bank Transaction - newBankTransaction.getBankTransactions().get(0).setStatus(com.xero.models.accounting.BankTransaction.StatusEnum.DELETED); - BankTransactions deletedBankTransaction = accountingApi.updateBankTransaction(newBankTransaction.getBankTransactions().get(0).getBankTransactionID(),newBankTransaction); - messages.add("Deleted new Bank Transaction : Status:" + deletedBankTransaction.getBankTransactions().get(0).getStatus()); - - // GET Bank Transaction History - HistoryRecords hr = accountingApi.getBankTransactionsHistory(oneBankTransaction.getBankTransactions().get(0).getBankTransactionID()); - messages.add("Get a one Bank Transaction History Record - details :" + hr.getHistoryRecords().get(0).getDetails()); - - // CREATE Bank Transaction History - // Error: "The document with the supplied id was not found for this end point. - /* - HistoryRecords historyRecords = new HistoryRecords(); - HistoryRecord historyRecord = new HistoryRecord(); - historyRecord.setDetails("This is a sample history note"); - historyRecords.addHistoryRecordsItem(historyRecord); - HistoryRecords newHr = accountingApi.createBankTransactionHistoryRecord(oneBankTransaction.getBankTransactions().get(0).getBankTransactionID(), historyRecords); - messages.add("Create a one Bank Transaction History Record - details :" + newHr.getHistoryRecords().get(0).getDetails()); - */ - } - - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("BankTransfers")) { - /* BANK TRANSFER */ - try { - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); - where = null; - // Maker sure we have at least 2 banks - if(accountsWhere.getAccounts().size() > 1) { - // CREATE bank transfer - BankTransfer bankTransfer = new BankTransfer(); - bankTransfer.setFromBankAccount(accountsWhere.getAccounts().get(1)); - bankTransfer.setToBankAccount(accountsWhere.getAccounts().get(0)); - bankTransfer.setAmount("50.00"); - BankTransfers newBTs = new BankTransfers(); - newBTs.addBankTransfersItem(bankTransfer); - BankTransfers newBankTranfer = accountingApi.createBankTransfer(newBTs); - messages.add("Get a one Bank Transfer - amount : " + newBankTranfer.getBankTransfers().get(0).getAmount()); - - // GET all Bank Transfers - BankTransfers bankTranfers = accountingApi.getBankTransfers(ifModifiedSince, where, order); - messages.add("Get a all Bank Transfers - total : " + bankTranfers.getBankTransfers().size()); - UUID bankTransferId = bankTranfers.getBankTransfers().get(0).getBankTransferID(); - - // GET one Bank Transfer - BankTransfers oneBankTranfer = accountingApi.getBankTransfer(bankTransferId); - messages.add("Get a one Bank Transfer - amount : " + oneBankTranfer.getBankTransfers().get(0).getAmount()); - - // GET Bank Transfer History - HistoryRecords hr = accountingApi.getBankTransferHistory(bankTransferId); - messages.add("Get a one Bank Transfer History Record - details :" + hr.getHistoryRecords().get(0).getDetails()); - - // CREATE Bank Transfer History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords historyRecords = new HistoryRecords(); - HistoryRecord historyRecord = new HistoryRecord(); - historyRecord.setDetails("This is a sample history note"); - historyRecords.addHistoryRecordsItem(historyRecord); - HistoryRecords newHr = accountingApi.createBankTransferHistoryRecord(bankTransferId, historyRecords); - messages.add("Get a one Bank Transfer History Record - details :" + newHr.getHistoryRecords().get(0).getDetails()); - */ - } - } catch (Exception e) { - System.out.println(e.toString()); - } - - } else if (object.equals("BatchPayments")) { - try { - /* BATCH PAYMENTS */ - // CREATE payment - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - Invoice inv2 = new Invoice(); - inv2.setInvoiceID(allInvoices.getInvoices().get(1).getInvoiceID()); - Invoice inv3 = new Invoice(); - inv3.setInvoiceID(allInvoices.getInvoices().get(3).getInvoiceID()); - where = null; - - where = "EnablePaymentsToAccount==true"; - Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); - Account paymentAccount = new Account(); - paymentAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); - where = null; - - BatchPayments createBatchPayments = new BatchPayments(); - BatchPayment createBatchPayment = new BatchPayment(); - createBatchPayment.setAccount(paymentAccount); - createBatchPayment.setAmount(3.0); - LocalDate currDate = LocalDate.now(); - createBatchPayment.setDate(currDate); - createBatchPayment.setReference("Foobar" + SampleData.loadRandomNum()); - - Payment payment01 = new Payment(); - payment01.setAccount(paymentAccount); - payment01.setInvoice(inv); - payment01.setAmount(1.0); - payment01.setDate(currDate); - - Payment payment02 = new Payment(); - payment02.setAccount(paymentAccount); - payment02.setInvoice(inv2); - payment02.setAmount(1.0); - payment02.setDate(currDate); - - Payment payment03 = new Payment(); - payment03.setAccount(paymentAccount); - payment03.setInvoice(inv3); - payment03.setAmount(1.0); - payment03.setDate(currDate); - - createBatchPayment.addPaymentsItem(payment01); - createBatchPayment.addPaymentsItem(payment02); - createBatchPayment.addPaymentsItem(payment03); - - createBatchPayments.addBatchPaymentsItem(createBatchPayment); - - BatchPayments newBatchPayments = accountingApi.createBatchPayment(createBatchPayments); - messages.add("Create BatchPayments - ID : " + newBatchPayments.getBatchPayments().get(0).getTotalAmount()); - - // GET all Payments - BatchPayments allBatchPayments = accountingApi.getBatchPayments(ifModifiedSince, where, order); - messages.add("Get BatchPayments - Total : " + allBatchPayments.getBatchPayments().size()); - } catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); - } - - } else if (object.equals("BrandingThemes")) { - /* BRANDING THEME */ - try { - // GET all BrandingTheme - BrandingThemes bt = accountingApi.getBrandingThemes(); - messages.add("Get a All Branding Themes - total : " + bt.getBrandingThemes().size()); - - // GET one BrandingTheme - UUID btID = bt.getBrandingThemes().get(0).getBrandingThemeID(); - BrandingThemes oneBt = accountingApi.getBrandingTheme(btID); - messages.add("Get a one Branding Themes - name : " + oneBt.getBrandingThemes().get(0).getName()); - - // Create PaymentService for a Branding Theme - PaymentServices paymentServices = accountingApi.getPaymentServices(); - UUID paymentServiceID = paymentServices.getPaymentServices().get(0).getPaymentServiceID(); - PaymentService btPaymentService = new PaymentService(); - btPaymentService.setPaymentServiceID(paymentServiceID); - PaymentServices createdPaymentService = accountingApi.createBrandingThemePaymentServices(btID, btPaymentService); - messages.add("Created payment services for Branding Themes - name : " + createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); - - // GET Payment Services for a single Branding Theme - PaymentServices paymentServicesForBrandingTheme = accountingApi.getBrandingThemePaymentServices(btID); - messages.add("Get payment services for Branding Themes - name : " + paymentServicesForBrandingTheme.getPaymentServices().get(0).getPaymentServiceName()); - - } catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); - } - - } else if (object.equals("Contacts")) { - /* CONTACTS */ - try { - // CREATE contact - Contact contact = new Contact(); - contact.setName("Foo" + SampleData.loadRandomNum()); - contact.setEmailAddress("sid" + SampleData.loadRandomNum() + "@blah.com"); - List phones = new ArrayList(); - Phone phone = new Phone(); - phone.setPhoneType(PhoneTypeEnum.MOBILE); - phone.setPhoneNumber("555-1212"); - phone.setPhoneAreaCode("415"); - phones.add(phone); - contact.setPhones(phones); - Contacts newContact = accountingApi.createContact(contact); - messages.add("Create new Contact - Name : " + newContact.getContacts().get(0).getName()); - - // UPDATE contact - newContact.getContacts().get(0).setName("Bar" + SampleData.loadRandomNum()); - UUID contactID = newContact.getContacts().get(0).getContactID(); - Contacts updatedContact = accountingApi.updateContact(contactID, newContact); - messages.add("Update new Contact - Name : " + updatedContact.getContacts().get(0).getName()); - - // GET all contact - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - messages.add("Get a All Contacts - Total : " + contacts.getContacts().size()); - - // GET one contact - UUID oneContactID = contacts.getContacts().get(0).getContactID(); - Contacts oneContact = accountingApi.getContact(oneContactID); - messages.add("Get a One Contact - Name : " + oneContact.getContacts().get(0).getName()); - - // GET contact cisSettings - where = "Name==\"sidney\""; - Contacts cisContact = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - if (cisContact.getContacts().size() > 0) { - CISSettings cisSettings = accountingApi.getContactCISSettings(cisContact.getContacts().get(0).getContactID()); - messages.add("Get a Contact cisSettings - Enabled? : " + cisSettings.getCiSSettings().get(0).getCiSEnabled()); - } - where = null; - - // GET active contacts - where = "ContactStatus==\"ACTIVE\""; - Contacts contactsWhere = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - messages.add("Get a all ACTIVE Contacts - Total : " + contactsWhere.getContacts().size()); - where = null; - - // Get Contact History - HistoryRecords contactHistory = accountingApi.getContactHistory(contactID); - messages.add("Contact History - count : " + contactHistory.getHistoryRecords().size() ); - - // Create Contact History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - - HistoryRecords newInvoiceHistory = accountingApi.createContactHistory(contactID,newHistoryRecords); - messages.add("Contact History - note added to : " + newInvoiceHistory.getHistoryRecords().get(0).getDetails()); - - } catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); - } - } else if (object.equals("ContactGroups")) { - - /* CONTACT GROUP */ - try { - // Create contact group - ContactGroups newCGs = new ContactGroups(); - ContactGroup cg = new ContactGroup(); - cg.setName("NewGroup" + SampleData.loadRandomNum()); - newCGs.addContactGroupsItem(cg); - ContactGroups newContactGroup = accountingApi.createContactGroup(newCGs); - messages.add("Create a ContactGroup - Name : " + newContactGroup.getContactGroups().get(0).getName()); - - // UPDATE Contact group - newCGs.getContactGroups().get(0).setName("Old Group" + SampleData.loadRandomNum()); - UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - ContactGroups updateContactGroup = accountingApi.updateContactGroup(newContactGroupID, newCGs); - messages.add("Update a ContactGroup - Name : " + updateContactGroup.getContactGroups().get(0).getName()); - - // GET all contact groups - ContactGroups contactGroups = accountingApi.getContactGroups(where, order); - messages.add("Get all ContactGroups - Total : " + contactGroups.getContactGroups().size()); - - // GET one contact groups - UUID contactGroupId = contactGroups.getContactGroups().get(0).getContactGroupID(); - ContactGroups oneCg = accountingApi.getContactGroup(contactGroupId); - messages.add("Get one ContactGroups - Name : " + oneCg.getContactGroups().get(0).getName()); - - // DELETE contact Group - newCGs.getContactGroups().get(0).setStatus(com.xero.models.accounting.ContactGroup.StatusEnum.DELETED); - UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - ContactGroups deletedContactGroup = accountingApi.updateContactGroup(contactGroupID, contactGroups); - messages.add("Delete a ContactGroup - Name : " + deletedContactGroup.getContactGroups().get(0).getName()); - - } catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); - } - - } else if (object.equals("ContactGroupContacts")) { - /* CONTACT GROUP CONTACTS */ - try { - // Create new Contact Group - ContactGroups newCGs = new ContactGroups(); - ContactGroup cg = new ContactGroup(); - cg.setName("NewGroup" + SampleData.loadRandomNum()); - newCGs.addContactGroupsItem(cg); - ContactGroups newContactGroup = accountingApi.createContactGroup(newCGs); - - Contacts allContacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - - // Create Contacts in Group - Contacts contactList = new Contacts(); - contactList.addContactsItem(allContacts.getContacts().get(0)); - contactList.addContactsItem(allContacts.getContacts().get(1)); - UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - Contacts addContacts = accountingApi.createContactGroupContacts(contactGroupID, contactList); - messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts.getContacts().size()); - - // DELETE all Contacts in Group - accountingApi.deleteContactGroupContacts(newContactGroup.getContactGroups().get(0).getContactGroupID()); - messages.add("Delete All Contacts to Contact Group - no content in response "); - ContactGroups oneCg = accountingApi.getContactGroup(newContactGroup.getContactGroups().get(0).getContactGroupID()); - messages.add("Get ContactGroups - Total Contacts : " + oneCg.getContactGroups().get(0).getContacts().size()); - - // DELETE Single Contact - Contacts contactList2 = new Contacts(); - contactList2.addContactsItem(allContacts.getContacts().get(3)); - contactList2.addContactsItem(allContacts.getContacts().get(4)); - - UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - Contacts addContacts2 = accountingApi.createContactGroupContacts(newContactGroupID, contactList2); - messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts2.getContacts().size()); - - // DELETE Single CONACTS - accountingApi.deleteContactGroupContact(newContactGroup.getContactGroups().get(0).getContactGroupID(),allContacts.getContacts().get(3).getContactID()); - messages.add("Delete 1 contact from Contact Group - no content in response"); - ContactGroups oneCg2 = accountingApi.getContactGroup(newContactGroup.getContactGroups().get(0).getContactGroupID()); - messages.add("Get ContactGroups - Total Contacts : " + oneCg2.getContactGroups().get(0).getContacts().size()); - - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("CreditNotesPDF")) { - // GET CreditNote As a PDF - CreditNotes creditNotes = accountingApi.getCreditNotes(ifModifiedSince, where, order, null); - UUID creditNoteId = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - ByteArrayInputStream CreditNoteInput = accountingApi.getCreditNoteAsPdf(creditNoteId, "application/pdf"); - String CreditNoteFileName = "CreditNoteAsPDF.pdf"; - - String CreditNoteSaveFilePath = saveFile(CreditNoteInput,CreditNoteFileName); - messages.add("Get CreditNote attachment - save it here: " + CreditNoteSaveFilePath); - - } else if (object.equals("CreditNotes")) { - /* CREDIT NOTE */ - // JSON - complete - except Attachment - try { - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - - // Create Credit Note - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode("400"); - li.setDescription("Foobar"); - li.setQuantity(2.0); - li.setUnitAmount(20.0); - lineItems.add(li); - - CreditNotes newCNs = new CreditNotes(); - CreditNote cn = new CreditNote(); - cn.setContact(contacts.getContacts().get(0)); - cn.setLineItems(lineItems); - cn.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT); - newCNs.addCreditNotesItem(cn); - CreditNotes newCreditNote = accountingApi.createCreditNote(summarizeErrors, newCNs); - messages.add("Create a CreditNote - Amount : " + newCreditNote.getCreditNotes().get(0).getTotal()); - UUID newCreditNoteId = newCreditNote.getCreditNotes().get(0).getCreditNoteID(); - - // GET all Credit Note - CreditNotes creditNotes = accountingApi.getCreditNotes(ifModifiedSince, where, order, null); - messages.add("Get all CreditNotes - Total : " + creditNotes.getCreditNotes().size()); - - // GET One Credit Note - UUID creditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - CreditNotes oneCreditNote = accountingApi.getCreditNote(creditNoteID); - messages.add("Get a CreditNote - Amount : " + oneCreditNote.getCreditNotes().get(0).getTotal()); - - // UPDATE Credit Note - newCNs.getCreditNotes().get(0).setStatus(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED); - CreditNotes updatedCreditNote = accountingApi.updateCreditNote(newCreditNoteId, newCNs); - messages.add("Update a CreditNote - Ref : " + updatedCreditNote.getCreditNotes().get(0).getReference()); - - // Allocate Credit Note - Allocations allocations = new Allocations(); - Allocation allocation = new Allocation(); - - where = "Status==\"AUTHORISED\"&&Type==\"ACCPAY\""; - Invoices allInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - allocation.setInvoice(inv); - allocation.setAmount(1.0); - LocalDate currDate = LocalDate.now(); - allocation.setDate(currDate); - allocations.addAllocationsItem(allocation); - where = null; - - Allocations allocatedCreditNote = accountingApi.createCreditNoteAllocation(newCreditNoteId,allocations); - messages.add("Update CreditNote Allocation - Amount : " + allocatedCreditNote.getAllocations().get(0).getAmount()); - - // Get Invoice History - HistoryRecords history = accountingApi.getCreditNoteHistory(creditNoteID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create Invoice History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - - HistoryRecords newHistory = accountingApi.createCreditNoteHistory(creditNoteID, newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - - - } else if (object.equals("Currencies")) { - - /* CURRENCY */ - // JSON - incomplete - try { - //Get All - Currencies currencies = accountingApi.getCurrencies(where, order); - messages.add("Get all Currencies - Total : " + currencies.getCurrencies().size()); - - // Create New - // Error: 400 - /* - Currency curr = new Currency(); - curr.setCode("SGD"); - Currencies currs = new Currencies(); - currs.addCurrenciesItem(curr); - Currencies newCurrency = accountingApi.createCurrency(currs); - messages.add("New Currencies - Code : " + newCurrency.getCurrencies().get(0).getCode()); - */ - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("Employees")) { - - /* EMPLOYEE */ - // JSON - try { - // Create - Employee employee = new Employee(); - employee.setFirstName("Sam"); - employee.setLastName("Jackson" + SampleData.loadRandomNum()); - ExternalLink extLink = new ExternalLink(); - extLink.setUrl("http://twitter.com/#!/search/Homer+Simpson"); - employee.setExternalLink(extLink); - Employees emps = new Employees(); - emps.addEmployeesItem(employee); - - Employees newEmployee = accountingApi.createEmployee(emps); - messages.add("Create an Employee - Last Name : " + newEmployee.getEmployees().get(0).getLastName()); - - // Update - newEmployee.getEmployees().get(0).setLastName("Anderson" + SampleData.loadRandomNum()); - Employees updateEmployee = accountingApi.updateEmployee(newEmployee.getEmployees().get(0).getEmployeeID(),newEmployee); - messages.add("Update an Employee - Last Name : " + updateEmployee.getEmployees().get(0).getLastName()); - - //Get All - Employees employees = accountingApi.getEmployees(ifModifiedSince, where, order); - messages.add("Get all Employees - Total : " + employees.getEmployees().size()); - - // Get One - Employees oneEmployee = accountingApi.getEmployee(employees.getEmployees().get(0).getEmployeeID()); - messages.add("Get one Employees - Name : " + oneEmployee.getEmployees().get(0).getFirstName()); - - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("ExpenseClaims")) { - /* EXPENSE CLAIM */ - //Create - where = "IsSubscriber==true"; - Users users = accountingApi.getUsers(ifModifiedSince, where, order); - where = null; - - where = "ShowInExpenseClaims==true&&Status==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); - where = null; - - if (users.getUsers().size() > 0) { - User user = new User(); - user.setUserID(users.getUsers().get(0).getUserID()); - - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // CREATE NEW RECEIPT - Receipts receipts = new Receipts(); - Receipt receipt = new Receipt(); - - LineItem li = new LineItem(); - li.setAccountCode(accounts.getAccounts().get(0).getCode()); - li.setDescription("Foobar"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - receipt.addLineitemsItem(li); - receipt.setUser(user); - receipt.lineAmountTypes(LineAmountTypes.NOTAX); - receipt.contact(useContact); - receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); - receipts.addReceiptsItem(receipt); - Receipts newReceipts = accountingApi.createReceipt(receipts); - - // CREATE EXPENSE CLAIM - ExpenseClaims createExpenseClaims = new ExpenseClaims(); - ExpenseClaim expenseClaim = new ExpenseClaim(); - expenseClaim.setUser(user); - - Receipts myReceipts = new Receipts(); - Receipt myReceipt = new Receipt(); - myReceipt.setReceiptID(newReceipts.getReceipts().get(0).getReceiptID()); - myReceipts.addReceiptsItem(myReceipt); - expenseClaim.setReceipts(myReceipts.getReceipts()); - expenseClaim.setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED); - createExpenseClaims.addExpenseClaimsItem(expenseClaim); - ExpenseClaims newExpenseClaims = accountingApi.createExpenseClaim(createExpenseClaims, summarizeErrors); - messages.add("Create new Expense Claim - Status : " + newExpenseClaims.getExpenseClaims().get(0).getStatus()); - - // UPDATE EXPENSE CLAIM - createExpenseClaims.getExpenseClaims().get(0).setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED); - UUID expenseClaimID = newExpenseClaims.getExpenseClaims().get(0).getExpenseClaimID(); - ExpenseClaims updateExpenseClaims = accountingApi.updateExpenseClaim(expenseClaimID, createExpenseClaims); - messages.add("Update new Expense Claim - Status : " + updateExpenseClaims.getExpenseClaims().get(0).getStatus()); - - //Get All Expense Claims - ExpenseClaims expenseClaims = accountingApi.getExpenseClaims(ifModifiedSince, where, order); - messages.add("Get all Expense Claim - Total : " + expenseClaims.getExpenseClaims().size()); - - // Get One Expense Claim - ExpenseClaims oneExpenseClaim = accountingApi.getExpenseClaim(expenseClaims.getExpenseClaims().get(0).getExpenseClaimID()); - messages.add("Get one Expense Claim - Total : " + oneExpenseClaim.getExpenseClaims().get(0).getStatus()); - - // VOID EXPENSE CLAIM - createExpenseClaims.getExpenseClaims().get(0).setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.VOIDED); - ExpenseClaims voidExpenseClaims = accountingApi.updateExpenseClaim(expenseClaimID, createExpenseClaims); - messages.add("Void new Expense Claim - Status : " + voidExpenseClaims.getExpenseClaims().get(0).getStatus()); - - // Get Invoice History - HistoryRecords history = accountingApi.getExpenseClaimHistory(expenseClaimID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create Invoice History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createExpenseClaimHistory(expenseClaimID, newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - */ - } else { - System.out.println("No User Found"); - } - - } else if (object.equals("Invoices")) { - /* INVOICE */ - // GET Invoice As a PDF - Invoices myInvoicesForPDF = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - UUID invoiceIDForPDF = myInvoicesForPDF.getInvoices().get(0).getInvoiceID(); - ByteArrayInputStream InvoiceNoteInput = accountingApi.getInvoiceAsPdf(invoiceIDForPDF, "application/pdf"); - String InvoiceFileName = "InvoiceAsPDF.pdf"; - String InvoiceSaveFilePath = saveFile(InvoiceNoteInput,InvoiceFileName); - messages.add("Get Invoice attachment - save it here: " + InvoiceSaveFilePath); - - // Create Invoice - where = "Type==\"REVENUE\""; - Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); - String accountCodeForInvoice = accounts.getAccounts().get(0).getCode(); - where = null; - - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - UUID contactIDForInvoice = contacts.getContacts().get(0).getContactID(); - - Contact useContact = new Contact(); - useContact.setContactID(contactIDForInvoice); - - Invoices newInvoices = new Invoices(); - Invoice myInvoice = new Invoice(); - - LineItem li = new LineItem(); - li.setAccountCode(accountCodeForInvoice); - li.setDescription("Acme Tires"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - myInvoice.addLineItemsItem(li); - myInvoice.setContact(useContact); - LocalDate dueDate = LocalDate.of(2018,Month.DECEMBER,10); - myInvoice.setDueDate(dueDate); - LocalDate todayDate = LocalDate.now(); - myInvoice.setDate(todayDate); - myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); - myInvoice.setReference("One Fish, Two Fish"); - myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); - newInvoices.addInvoicesItem(myInvoice); - - Invoices newInvoice = accountingApi.createInvoice(newInvoices, summarizeErrors); - messages.add("Create invoice - Reference : " + newInvoice.getInvoices().get(0).getReference()); - - UUID newInvoiceID = newInvoice.getInvoices().get(0).getInvoiceID(); - Invoices updateInvoices = new Invoices(); - Invoice updateInvoice = new Invoice(); - updateInvoice.setInvoiceID(newInvoiceID); - updateInvoice.setReference("Red Fish, Blue Fish"); - updateInvoices.addInvoicesItem(updateInvoice); - - Invoices updatedInvoice = accountingApi.updateInvoice(newInvoiceID,updateInvoices); - messages.add("Update invoice - Reference : " + updatedInvoice.getInvoices().get(0).getReference()); - - //Get All - Invoices invoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - messages.add("Get all invoices - Total : " + invoices.getInvoices().size()); - - //Get Invoice If-Modified-Since - OffsetDateTime invModified = OffsetDateTime.of(LocalDateTime.of(2018, 12, 06, 15, 00), ZoneOffset.UTC); - - System.out.println(invModified.toString()); - - Invoices invoicesSince = accountingApi.getInvoices(invModified, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - messages.add("Get all invoices - Since Modfied Date - Total : " + invoicesSince.getInvoices().size()); - - // Get One - Invoices oneInvoice = accountingApi.getInvoice(invoices.getInvoices().get(0).getInvoiceID()); - messages.add("Get one invoice - total : " + oneInvoice.getInvoices().get(0).getTotal()); - LocalDate myDate = oneInvoice.getInvoices().get(0).getDate(); - OffsetDateTime myUTC = oneInvoice.getInvoices().get(0).getUpdatedDateUTC(); - - // Get Online Invoice - OnlineInvoices onlineInvoice = accountingApi.getOnlineInvoice(newInvoiceID); - messages.add("Get Online invoice - URL : " + onlineInvoice.getOnlineInvoices().get(0).getOnlineInvoiceUrl()); - - // Email Invoice - RequestEmpty empty = new RequestEmpty(); - accountingApi.emailInvoice(newInvoiceID,empty); - messages.add("Email invoice - no content in response"); - - // Get Invoice History - HistoryRecords history = accountingApi.getInvoiceHistory(newInvoiceID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create Invoice History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createInvoiceHistory(newInvoiceID,newHistoryRecords); - messages.add("History - note added to : " + newHistory); - - // CREATE invoice attachment - Invoices myInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); - InputStream inputStream = JsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] bytes = IOUtils.toByteArray(inputStream); - - String newFileName = "sample2.jpg"; - Attachments createdAttachments = accountingApi.createInvoiceAttachmentByFileName(invoiceID, newFileName, bytes); - messages.add("Attachment to Invoice complete - ID: " + createdAttachments.getAttachments().get(0).getAttachmentID()); - - // GET Invoice Attachment - Attachments attachments = accountingApi.getInvoiceAttachments(invoiceID); - System.out.println(attachments.getAttachments().get(0).getFileName()); - UUID attachementId = attachments.getAttachments().get(0).getAttachmentID(); - String contentType = attachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream InvoiceAttachmentInput = accountingApi.getInvoiceAttachmentById(invoiceID,attachementId, contentType); - - String InvoiceAttachmentFileName = attachments.getAttachments().get(0).getFileName(); - String InvoiceAttachmentSaveFilePath = saveFile(InvoiceAttachmentInput,InvoiceAttachmentFileName); - messages.add("Get Invoice attachment - save it here: " + InvoiceAttachmentSaveFilePath); - - } else if (object.equals("InvoiceReminders")) { - /* INVOICE REMINDER */ - try { - InvoiceReminders invReminders = accountingApi.getInvoiceReminders(); - messages.add("Get a Invoice Reminder - Is Enabled: " + invReminders.getInvoiceReminders().get(0).getEnabled() ); - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Items")) { - /* ITEM */ - try { - // Create Items - Items myItems = new Items(); - Item myItem = new Item(); - myItem.setCode("abc" + SampleData.loadRandomNum()); - myItem.setDescription("foobar"); - myItem.setName("Hello"+SampleData.loadRandomNum()); - myItems.addItemsItem(myItem); - Items newItems = accountingApi.createItem(myItems); - messages.add("Create new item - Description : " + newItems.getItems().get(0).getDescription()); - UUID newItemId = newItems.getItems().get(0).getItemID(); - - // Update Item - newItems.getItems().get(0).setDescription("Barfoo"); - Items updateItem = accountingApi.updateItem(newItemId, newItems); - messages.add("Update item - Description : " + updateItem.getItems().get(0).getDescription()); - - //Get All Items - Items items = accountingApi.getItems(ifModifiedSince, where, order, null); - messages.add("Get all items - Total : " + items.getItems().size()); - - // Get One Item - UUID itemId = items.getItems().get(0).getItemID(); - Items oneItem = accountingApi.getItem(itemId); - messages.add("Get one item - Description : " + oneItem.getItems().get(0).getDescription()); - - // Get Invoice History - HistoryRecords history = accountingApi.getItemHistory(itemId); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create Invoice History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords createdHistory = accountingApi.createItemHistory(itemId,newHistoryRecords); - messages.add("History - note added to : " + createdHistory.getHistoryRecords().get(0).getDetails()); - */ - - //Delete - accountingApi.deleteItem(newItemId); - messages.add("Delete one item - no content in response"); - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("Journals")) { - /* JOURNAL */ - try { - - boolean paymentsOnly = false; - // GET all Journals - Journals journals = accountingApi.getJournals(ifModifiedSince, null, paymentsOnly); - messages.add("Get Journals - total : " + journals.getJournals().size()); - - // GET Journal with offset - Journals journalsOffset = accountingApi.getJournals(ifModifiedSince, null, paymentsOnly); - messages.add("Get Journals offset - total : " + journalsOffset.getJournals().size()); - - // GET one Journal - UUID journalId = journals.getJournals().get(0).getJournalID(); - Journals oneJournal = accountingApi.getJournal(journalId); - messages.add("Get one Journal - number : " + oneJournal.getJournals().get(0).getJournalNumber()); - - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("LinkedTransactions")) { - - /* LINKED TRANSACTION */ - try { - // Create Linked Transaction - where = "Type==\"EXPENSE\""; - Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); - where = null; - - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - Invoices newInvoices = new Invoices(); - Invoice myInvoice = new Invoice(); - - LineItem li = new LineItem(); - li.setAccountCode(accounts.getAccounts().get(0).getCode()); - li.setDescription("Acme Tires"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - myInvoice.addLineItemsItem(li); - myInvoice.setContact(useContact); - LocalDate dueDate = LocalDate.of(2018,Month.OCTOBER,10); - myInvoice.setDueDate(dueDate); - LocalDate todayDate = LocalDate.now(); - myInvoice.setDate(todayDate); - myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCPAY); - myInvoice.setReference("One Fish, Two Fish"); - myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); - newInvoices.addInvoicesItem(myInvoice); - - Invoices newInvoice = accountingApi.createInvoice(newInvoices, summarizeErrors); - - UUID sourceTransactionID1 = newInvoice.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID1 = newInvoice.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - LinkedTransactions newLinkedTransactions = new LinkedTransactions(); - LinkedTransaction newLinkedTransaction = new LinkedTransaction(); - newLinkedTransaction.setSourceTransactionID(sourceTransactionID1); - newLinkedTransaction.setSourceLineItemID(sourceLineItemID1); - newLinkedTransactions.addLinkedTransactionsItem(newLinkedTransaction); - - LinkedTransactions createdLinkedTransaction = accountingApi.createLinkedTransaction(newLinkedTransactions); - messages.add("Create LinkedTransaction - Status : " + createdLinkedTransaction.getLinkedTransactions().get(0).getStatus()); - - // Created Linked Transaction 2 - Contact contact = new Contact(); - contact.setName("Foo" + SampleData.loadRandomNum()); - contact.setEmailAddress("sid" + SampleData.loadRandomNum() + "@blah.com"); - Contacts newContact = accountingApi.createContact(contact); - UUID newContactID = newContact.getContacts().get(0).getContactID(); - - Invoices newInvoice2 = accountingApi.createInvoice(newInvoices, summarizeErrors); - - UUID sourceTransactionID2 = newInvoice2.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID2 = newInvoice2.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - LinkedTransactions newLinkedTransactions2 = new LinkedTransactions(); - LinkedTransaction newLinkedTransaction2 = new LinkedTransaction(); - newLinkedTransaction2.setSourceTransactionID(sourceTransactionID2); - newLinkedTransaction2.setSourceLineItemID(sourceLineItemID2); - newLinkedTransaction2.setContactID(newContactID); - newLinkedTransactions2.addLinkedTransactionsItem(newLinkedTransaction2); - - LinkedTransactions createdLinkedTransaction2 = accountingApi.createLinkedTransaction(newLinkedTransactions2); - messages.add("Create LinkedTransaction 2 - Status : " + createdLinkedTransaction2.getLinkedTransactions().get(0).getStatus()); - - // Created Linked Transaction 3 - Invoices newInvoicesAccRec = new Invoices(); - Invoice myInvoiceAccRec = new Invoice(); - - myInvoiceAccRec.addLineItemsItem(li); - myInvoiceAccRec.setContact(useContact); - - myInvoiceAccRec.setDueDate(dueDate); - myInvoiceAccRec.setDate(todayDate); - - myInvoiceAccRec.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); - myInvoiceAccRec.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); - newInvoicesAccRec.addInvoicesItem(myInvoiceAccRec); - - Invoices newInvoiceAccRec = accountingApi.createInvoice(newInvoicesAccRec, summarizeErrors); - UUID sourceTransactionID4 = newInvoiceAccRec.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID4 = newInvoiceAccRec.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - - Invoices newInvoice3 = accountingApi.createInvoice(newInvoices, summarizeErrors); - - UUID sourceTransactionID3 = newInvoice3.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID3 = newInvoice3.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - LinkedTransactions newLinkedTransactions3 = new LinkedTransactions(); - LinkedTransaction newLinkedTransaction3 = new LinkedTransaction(); - newLinkedTransaction3.setSourceTransactionID(sourceTransactionID3); - newLinkedTransaction3.setSourceLineItemID(sourceLineItemID3); - newLinkedTransaction3.setContactID(useContact.getContactID()); - newLinkedTransaction3.setTargetTransactionID(sourceTransactionID4); - newLinkedTransaction3.setTargetLineItemID(sourceLineItemID4); - newLinkedTransactions3.addLinkedTransactionsItem(newLinkedTransaction3); - - LinkedTransactions createdLinkedTransaction3 = accountingApi.createLinkedTransaction(newLinkedTransactions3); - messages.add("Create LinkedTransaction 3 - Status : " + createdLinkedTransaction3.getLinkedTransactions().get(0).getStatus()); - - // GET all Link Transactions - - int page = 1; - String linkedTransactionID = null; - String sourceTransactionID = null; - String targetTransactionID = null; - String status = null; - String contactID = null; - LinkedTransactions linkTransactions = accountingApi.getLinkedTransactions(page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); - messages.add("Get Link Transactions - total : " + linkTransactions.getLinkedTransactions().size()); - - // GET all Link Transactions - UUID linkedTransactionID2 = linkTransactions.getLinkedTransactions().get(0).getLinkedTransactionID(); - LinkedTransactions oneLinkTransaction = accountingApi.getLinkedTransaction(linkedTransactionID2); - messages.add("Get one Link Transaction - Status : " + oneLinkTransaction.getLinkedTransactions().get(0).getStatus()); - - // DELETE LINKEDTRANSACTION - UUID newLinkedTransactionID = createdLinkedTransaction.getLinkedTransactions().get(0).getLinkedTransactionID(); - accountingApi.deleteLinkedTransaction(newLinkedTransactionID); - messages.add("Delete LinkedTransaction - no content in response"); - - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("ManualJournals")) { - /* MANUAL JOURNAL */ - try { - // Create Manual Journal - where = "Type==\"EXPENSE\" && Status ==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); - String accountCode = accounts.getAccounts().get(0).getCode(); - where = null; - ManualJournals manualJournals = new ManualJournals(); - ManualJournal manualJournal = new ManualJournal(); - LocalDate currDate = LocalDate.now(); - manualJournal.setDate(currDate); - manualJournal.setNarration("Foo bar"); - - ManualJournalLine credit = new ManualJournalLine(); - credit.setDescription("Hello there"); - credit.setAccountCode(accountCode); - credit.setLineAmount(100.00); - manualJournal.addJournalLinesItem(credit); - - ManualJournalLine debit = new ManualJournalLine(); - debit.setDescription("Goodbye"); - debit.setAccountCode(accountCode); - debit.setLineAmount(-100.00); - manualJournal.addJournalLinesItem(debit); - manualJournals.addManualJournalsItem(manualJournal); - ManualJournals createdManualJournals = accountingApi.createManualJournal(manualJournals); - UUID newManualJournalId = createdManualJournals.getManualJournals().get(0).getManualJournalID(); - messages.add("Create Manual Journal - Narration : " + createdManualJournals.getManualJournals().get(0).getNarration()); - - // GET all Manual Journal - ManualJournals getManualJournals = accountingApi.getManualJournals(ifModifiedSince, where, order, null); - messages.add("Get Manual Journal - total : " + getManualJournals.getManualJournals().size()); - - // GET one Manual Journal - UUID manualJournalId = getManualJournals.getManualJournals().get(0).getManualJournalID(); - ManualJournals oneManualJournal = accountingApi.getManualJournal(manualJournalId); - messages.add("Get one Manual Journal - Narration : " + oneManualJournal.getManualJournals().get(0).getNarration()); - - // Update Manual Journal - - ManualJournals updateManualJournals = new ManualJournals(); - ManualJournal updateManualJournal = new ManualJournal(); - updateManualJournal.setManualJournalID(newManualJournalId); - updateManualJournal.setNarration("Hello Xero"); - updateManualJournals.addManualJournalsItem(updateManualJournal); - ManualJournals updatedManualJournal = accountingApi.updateManualJournal(newManualJournalId,updateManualJournals); - messages.add("Update Manual Journal - Narration : " + updatedManualJournal.getManualJournals().get(0).getNarration()); - - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("Organisations")) { - /* Organisation */ - try { - Organisations organisations = accountingApi.getOrganisations(); - messages.add("Get a Organisation - Name : " + organisations.getOrganisations().get(0).getName()); - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Overpayments")) { - /* OVERPAYMENT */ - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); - Account bankAccount = new Account(); - bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); - where = null; - - where = "SystemAccount==\"DEBTORS\""; - Accounts arAccounts = accountingApi.getAccounts(ifModifiedSince, where, order); - Account arAccount = arAccounts.getAccounts().get(0); - where = null; - - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // Maker sure we have at least 2 banks - if(accountsWhere.getAccounts().size() > 0) { - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode(arAccount.getCode()); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setUnitAmount(20.00); - lineItems.add(li); - - BankTransaction bt = new BankTransaction(); - bt.setBankAccount(bankAccount); - bt.setContact(useContact); - bt.setLineitems(lineItems); - bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_OVERPAYMENT); - BankTransactions bts = new BankTransactions(); - bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(bts, summarizeErrors); - - Overpayments overpayments = accountingApi.getOverpayments(ifModifiedSince, where, order, null, null); - messages.add("Get a Overpayments - Count : " + overpayments.getOverpayments().size()); - - if(overpayments.getOverpayments().size() > 0) { - UUID overpaymentId = overpayments.getOverpayments().get(2).getOverpaymentID(); - Overpayments oneOverpayment = accountingApi.getOverpayment(overpaymentId); - messages.add("Get one Overpayment - Total : " + oneOverpayment.getOverpayments().get(0).getTotal()); - - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - where = null; - - Allocations allocations = new Allocations(); - Allocation allocation = new Allocation(); - allocation.setAmount(1.0); - LocalDate currDate = LocalDate.now(); - allocation.setDate(currDate); - allocation.setInvoice(inv); - allocations.addAllocationsItem(allocation); - - Allocations newAllocation = accountingApi.createOverpaymentAllocation(overpaymentId, allocations); - messages.add("Create OverPayment allocation - Amt : " + newAllocation.getAllocations().get(0).getAmount()); - - // Get History - HistoryRecords history = accountingApi.getOverpaymentHistory(overpaymentId); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords createdHistory = accountingApi.createOverpaymentHistory(overpaymentId,newHistoryRecords); - messages.add("History - note added to : " + createdHistory.getHistoryRecords().get(0).getDetails()); - */ - } - } - - } else if (object.equals("Payments")) { - /* Payment */ - // CREATE payment - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - where = null; - - where = "EnablePaymentsToAccount==true"; - Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); - Account paymentAccount = new Account(); - paymentAccount.setCode(accountsWhere.getAccounts().get(0).getCode()); - where = null; - - Payments createPayments = new Payments(); - Payment createPayment = new Payment(); - createPayment.setAccount(paymentAccount); - createPayment.setInvoice(inv); - createPayment.setAmount(1.00); - - LocalDate currDate = LocalDate.now(); - createPayment.setDate(currDate); - createPayments.addPaymentsItem(createPayment); - - Payments newPayments = accountingApi.createPayment(createPayments); - messages.add("Create Payments - Amt : " + newPayments.getPayments().get(0).getAmount()); - - // GET all Payments - Payments payments = accountingApi.getPayments(ifModifiedSince, where, order); - messages.add("Get Payments - Total : " + payments.getPayments().size()); - - // GET one Payment - UUID paymentID = payments.getPayments().get(0).getPaymentID(); - Payments onePayment = accountingApi.getPayment(paymentID); - messages.add("Get Payments - Amount : " + onePayment.getPayments().get(0).getAmount()); - - // Get History - HistoryRecords allHistory = accountingApi.getPaymentHistory(paymentID); - messages.add("History - count : " + allHistory.getHistoryRecords().size() ); - - // Create History - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createPaymentHistory(paymentID,newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - */ - - } else if (object.equals("PaymentServices")) { - /* Payment Services */ - try { - // CREATE PaymentService - PaymentServices newPaymentServices = new PaymentServices(); - PaymentService newPaymentService = new PaymentService(); - newPaymentService.setPaymentServiceName("PayUp"+SampleData.loadRandomNum()); - newPaymentService.setPaymentServiceUrl("https://www.payupnow.com/"); - newPaymentService.setPayNowText("Time To PayUp"); - newPaymentServices.addPaymentServicesItem(newPaymentService); - PaymentServices createdPaymentService = accountingApi.createPaymentService(newPaymentServices); - messages.add("Create PaymentServices - name : " + createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); - - // GET all Payments - PaymentServices paymentServices = accountingApi.getPaymentServices(); - messages.add("Get PaymentServices - Total : " + paymentServices.getPaymentServices().size()); - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Prepayments")) { - /* PREPAYMENT */ - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); - Account bankAccount = new Account(); - bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); - where = null; - - where = "Type==\"EXPENSE\""; - Accounts arAccounts = accountingApi.getAccounts(ifModifiedSince, where, order); - Account arAccount = arAccounts.getAccounts().get(0); - where = null; - - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // Maker sure we have at least 2 banks - if(accountsWhere.getAccounts().size() > 0) { - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode(arAccount.getCode()); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setTaxType("NONE"); - li.setUnitAmount(20.00); - lineItems.add(li); - - BankTransaction bt = new BankTransaction(); - bt.setBankAccount(bankAccount); - bt.setContact(useContact); - bt.setLineitems(lineItems); - bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_PREPAYMENT); - BankTransactions bts = new BankTransactions(); - bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(bts, summarizeErrors); - where = "Status==\"AUTHORISED\" && TYPE==\"RECEIVE-PREPAYMENT\""; - Prepayments prepayments = accountingApi.getPrepayments(ifModifiedSince, where, order, null, null); - messages.add("Get a Prepayments - Count : " + prepayments.getPrepayments().size()); - where = null; - if(prepayments.getPrepayments().size() > 0) { - UUID prepaymentId = prepayments.getPrepayments().get(0).getPrepaymentID(); - Prepayments onePrepayment = accountingApi.getPrepayment(prepaymentId); - messages.add("Get one Prepayment - Total : " + onePrepayment.getPrepayments().get(0).getTotal()); - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - where = null; - - Allocations allocations = new Allocations(); - Allocation allocation = new Allocation(); - allocation.setAmount(1.0); - LocalDate currDate = LocalDate.now(); - allocation.setDate(currDate); - allocation.setInvoice(inv); - allocations.addAllocationsItem(allocation); - - //Allocations newAllocation = accountingApi.createPrepaymentAllocation(prepaymentId, allocations); - //messages.add("Create PrePayment allocation - Amt : " + newAllocation.getAllocations().get(0).getAmount()); - - // Get History - HistoryRecords history = accountingApi.getPrepaymentHistory(prepaymentId); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create History - // Error: "The document with the supplied id was not found for this end point. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords createdHistory = accountingApi.createPrepaymentHistory(prepaymentId,newHistoryRecords); - messages.add("History - note added to : " + createdHistory.getHistoryRecords().get(0).getDetails()); - */ - } - } - } else if (object.equals("PurchaseOrders")) { - /* PURCHASE ORDERS */ - try { - // CREATE Purchase Order - where = "Type==\"EXPENSE\""; - Accounts arAccounts = accountingApi.getAccounts(ifModifiedSince, where, order); - Account arAccount = arAccounts.getAccounts().get(0); - where = null; - - PurchaseOrders purchaseOrders = new PurchaseOrders(); - PurchaseOrder purchaseOrder = new PurchaseOrder(); - LocalDate currDate = LocalDate.now(); - purchaseOrder.setDate(currDate); - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - purchaseOrder.setContact(useContact); - - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode(arAccount.getCode()); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setUnitAmount(20.00); - lineItems.add(li); - purchaseOrder.setLineItems(lineItems); - purchaseOrders.addPurchaseOrdersItem(purchaseOrder); - PurchaseOrders createdPurchaseOrders = accountingApi.createPurchaseOrder(purchaseOrders, summarizeErrors); - messages.add("Create Purchase order - total : " + createdPurchaseOrders.getPurchaseOrders().get(0).getTotal()); - - // UPDATE Purchase Orders - UUID newPurchaseOrderID = createdPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); - createdPurchaseOrders.getPurchaseOrders().get(0).setAttentionTo("Jimmy"); - PurchaseOrders updatePurchaseOrders = accountingApi.updatePurchaseOrder(newPurchaseOrderID, createdPurchaseOrders); - messages.add("Update Purchase order - attn : " + updatePurchaseOrders.getPurchaseOrders().get(0).getAttentionTo()); - - // GET Purchase Orders - String status = null; - String dateFrom = null; - String dateTo = null; - PurchaseOrders allPurchaseOrders = accountingApi.getPurchaseOrders(ifModifiedSince, status, dateFrom, dateTo, order, null); - messages.add("Get Purchase orders - Count : " + allPurchaseOrders.getPurchaseOrders().size()); - - // GET one Purchase Order - UUID purchaseOrderID = allPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); - PurchaseOrders onePurchaseOrder = accountingApi.getPurchaseOrder(purchaseOrderID); - messages.add("Get one Purchase order - Total : " + onePurchaseOrder.getPurchaseOrders().get(0).getTotal()); - - // DELETE Purchase Orders - createdPurchaseOrders.getPurchaseOrders().get(0).setStatus(com.xero.models.accounting.PurchaseOrder.StatusEnum.DELETED); - PurchaseOrders deletePurchaseOrders = accountingApi.updatePurchaseOrder(newPurchaseOrderID, createdPurchaseOrders); - messages.add("Delete Purchase order - Status : " + deletePurchaseOrders.getPurchaseOrders().get(0).getStatus()); - - // Get History - HistoryRecords history = accountingApi.getInvoiceHistory(purchaseOrderID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createPurchaseOrderHistory(purchaseOrderID,newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Receipts")) { - /* RECEIPTS */ - try { - //Create - where = "IsSubscriber==true"; - Users users = accountingApi.getUsers(ifModifiedSince, where, order); - where = null; - - where = "ShowInExpenseClaims==true && Status==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); - where = null; - - User useUser = new User(); - useUser.setUserID(users.getUsers().get(0).getUserID()); - - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // CREATE NEW RECEIPT - Receipts receipts = new Receipts(); - Receipt receipt = new Receipt(); - - LineItem li = new LineItem(); - li.setAccountCode(accounts.getAccounts().get(0).getCode()); - li.setDescription("Foobar"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - receipt.addLineitemsItem(li); - receipt.setUser(useUser); - receipt.lineAmountTypes(LineAmountTypes.NOTAX); - receipt.contact(useContact); - receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); - receipts.addReceiptsItem(receipt); - Receipts newReceipts = accountingApi.createReceipt(receipts); - messages.add("Create Receipts - Total : " + newReceipts.getReceipts().get(0).getTotal()); - - // UPDATE Receipts - UUID newReceiptId = newReceipts.getReceipts().get(0).getReceiptID(); - newReceipts.getReceipts().get(0).setReference("Foobar"); - Receipts updateReceipts = accountingApi.updateReceipt(newReceiptId, newReceipts); - messages.add("Create Receipts - Ref : " + updateReceipts.getReceipts().get(0).getReference()); - - // GET all Receipts - Receipts allReceipts = accountingApi.getReceipts(ifModifiedSince, where, order, null); - messages.add("Create Receipts - Count : " + allReceipts.getReceipts().size()); - - // GET one Receipts - UUID receiptID = allReceipts.getReceipts().get(0).getReceiptID(); - Receipts oneReceipts = accountingApi.getReceipt(receiptID); - messages.add("Create Receipts - Total : " + oneReceipts.getReceipts().get(0).getTotal()); - - // Get History - HistoryRecords history = accountingApi.getReceiptHistory(receiptID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createReceiptHistory(receiptID, newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - */ - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("RepeatingInvoices")) { - /* REPEATING INVOICE */ - try { - // GET all Repeating Invoices - RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(where, order); - if ( repeatingInvoices.getRepeatingInvoices().size() > 0) { - messages.add("Repeating Invoice - count : " + repeatingInvoices.getRepeatingInvoices().size() ); - - // GET one Repeating Invoices - UUID repeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - RepeatingInvoices repeatingInvoice = accountingApi.getRepeatingInvoice(repeatingInvoiceID); - messages.add("Repeating Invoice - total : " + repeatingInvoice.getRepeatingInvoices().get(0).getTotal()); - - // Get History - HistoryRecords history = accountingApi.getRepeatingInvoiceHistory(repeatingInvoiceID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createRepeatingInvoiceHistory(repeatingInvoiceID, newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - */ - } else { - messages.add("Zero repeating Invoices found" ); - - } - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Reports")) { - - /* REPORTS */ - /* - // TenNinetyNine - US Only - String reportYear = null; - Reports reports = accountingApi.getReportTenNinetyNine(reportYear); - System.out.println(reports.toString()); - */ - // AgedPayablesByContact - String date = null; - String fromDate = null; - String toDate = null; - String profitLossTimeframe = null; - String trackingOptionID1 = null; - String trackingOptionID2 = null; - boolean standardLayout = false; - boolean paymentsOnly = false; - String trackingCategoryID = null; - String trackingCategoryID2 = null; - String trackingOptionID = null; - - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - UUID contactId = contacts.getContacts().get(0).getContactID(); - LocalDate xDate = LocalDate.now(); - LocalDate xFromDate = LocalDate.now(); - LocalDate xToDate = LocalDate.now(); - - ReportWithRows reportAgedPayablesByContact = accountingApi.getReportAgedPayablesByContact(contactId, xDate, xFromDate, xToDate); - messages.add("Get a Reports - Name:" + reportAgedPayablesByContact.getReports().get(0).getReportName()); - - // AgedReceivablesByContact - ReportWithRows reportAgedReceivablesByContact = accountingApi.getReportAgedReceivablesByContact(contactId, xDate, xFromDate, xToDate); - messages.add("Get a Reports - Name:" + reportAgedReceivablesByContact.getReports().get(0).getReportName()); - - // reportBalanceSheet - ReportWithRows reportBalanceSheet = accountingApi.getReportBalanceSheet(toDate, 3, "MONTH", trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); - messages.add("Get a Reports - Name:" + reportBalanceSheet.getReports().get(0).getReportName()); - System.out.println(reportBalanceSheet.getReports().get(0).getReportTitles().get(1).toString() ); - // reportBankSummary - ReportWithRows reportBankSummary = accountingApi.getReportBankSummary(xToDate, null, null); - messages.add("Get a Reports - Name:" + reportBankSummary.getReports().get(0).getReportName()); - - // reportBASorGSTlist - AU and NZ only - ReportWithRows reportTax = accountingApi.getReportBASorGSTList(); - System.out.println(reportTax.toString()); - - // reportBudgetSummary - int budgetPeriod = 1; - int budgetTimeframe = 3; - ReportWithRows reportBudgetSummary = accountingApi.getReportBudgetSummary(xToDate, budgetPeriod, budgetTimeframe); - messages.add("Get a Reports - Name:" + reportBudgetSummary.getReports().get(0).getReportName()); - - // reportExecutiveSummary - ReportWithRows reportExecutiveSummary = accountingApi.getReportExecutiveSummary(xToDate); - messages.add("Get a Reports - Name:" + reportExecutiveSummary.getReports().get(0).getReportName()); - - // reportProfitandLoss - fromDate = "2018-01-01"; - toDate = "2018-12-31"; - profitLossTimeframe = "MONTH"; - standardLayout = true; - paymentsOnly = false; - ReportWithRows reportProfitLoss = accountingApi.getReportProfitAndLoss(xFromDate, xToDate, null, profitLossTimeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); - messages.add("Get a Reports - Name:" + reportProfitLoss.getReports().get(0).getReportName()); - fromDate = null; - toDate = null; - - // reportTrialBalance - ReportWithRows reportTrialBalance = accountingApi.getReportTrialBalance(xToDate, paymentsOnly); - messages.add("Get a Reports - Name:" + reportTrialBalance.getReports().get(0).getReportName()); - - } else if (object.equals("TaxRates")) { - /* TAX RATE */ - try { - // CREATE Tax Rate - - TaxRates newTaxRates = new TaxRates(); - TaxRate newTaxRate = new TaxRate(); - TaxComponent rate01 = new TaxComponent(); - rate01.setName("State Tax"); - rate01.setRate(2.25); - newTaxRate.setReportTaxType(ReportTaxTypeEnum.INPUT); - newTaxRate.setName("SDKTax"+SampleData.loadRandomNum()); - newTaxRate.addTaxComponentsItem(rate01); - newTaxRates.addTaxRatesItem(newTaxRate); - - TaxRates createdTaxRate = accountingApi.createTaxRate(newTaxRates); - messages.add("CREATE TaxRate - name : " + createdTaxRate.getTaxRates().get(0).getName()); - - // UDPATE Tax Rate - newTaxRates.getTaxRates().get(0).setStatus(com.xero.models.accounting.TaxRate.StatusEnum.DELETED); - TaxRates updatedTaxRate = accountingApi.updateTaxRate(newTaxRates); - messages.add("UPDATED TaxRate - status : " + updatedTaxRate.getTaxRates().get(0).getStatus()); - - // GET Tax Rate - String taxType = null; - TaxRates taxRates = accountingApi.getTaxRates(where, order, taxType); - messages.add("GET TaxRate - cnt : " + taxRates.getTaxRates().size()); - - // GET Tax Rate - taxType = "CAPEXINPUT2"; - TaxRates taxRatesByType = accountingApi.getTaxRates(where, order, taxType); - messages.add("GET TaxRate by Cap Purchase Type : " + taxRatesByType.getTaxRates().size()); - - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("TrackingCategories")) { - - /* TRACKING CATEGORIES */ - try { - // GET Tracking Categories - TrackingCategories trackingCategories = accountingApi.getTrackingCategories(where, order, includeArchived); - int count = trackingCategories.getTrackingCategories().size(); - - if (count == 2) { - //DELETE Tracking Categories - UUID trackingCategoryID = trackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); - TrackingCategories deletedTrackingCategories = accountingApi.deleteTrackingCategory(trackingCategoryID); - messages.add("DELETED tracking categories - status : " + deletedTrackingCategories.getTrackingCategories().get(0).getStatus()); - } - - // CREATE Tracking Categories - TrackingCategory newTrackingCategory = new TrackingCategory(); - newTrackingCategory.setName("Foo"+SampleData.loadRandomNum()); - TrackingCategories createdTrackingCategories = accountingApi.createTrackingCategory(newTrackingCategory); - messages.add("CREATED tracking categories - name : " + createdTrackingCategories.getTrackingCategories().get(0).getName()); - - // UPDATE Tracking Categories - UUID newTrackingCategoryID = createdTrackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); - newTrackingCategory.setName("Foo"+SampleData.loadRandomNum()); - TrackingCategories updatedTrackingCategories = accountingApi.updateTrackingCategory(newTrackingCategoryID,newTrackingCategory); - messages.add("UPDATED tracking categories - name : " + updatedTrackingCategories.getTrackingCategories().get(0).getName()); - - // GET one Tracking Categories - - if (count > 0) - { - UUID oneTrackingCategoryID = trackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); - TrackingCategories oneTrackingCategories = accountingApi.getTrackingCategory(oneTrackingCategoryID); - messages.add("GET ONE tracking categories - name : " + oneTrackingCategories.getTrackingCategories().get(0).getName()); - - // Create one Option - TrackingOption option = new TrackingOption(); - option.setName("Bar"+SampleData.loadRandomNum()); - TrackingOptions newTrackingOptions = accountingApi.createTrackingOptions(oneTrackingCategoryID,option); - messages.add("CREATE option - name : " + newTrackingOptions.getOptions().get(0).getName()); - - // DELETE All options - //UUID newOptionId = newTrackingOptions.getOptions().get(0).getTrackingOptionID(); - //TrackingOptions deleteOptions = accountingApi.deleteTrackingOptions(oneTrackingCategoryID, newOptionId); - //messages.add("DELETE one option - Status : " + deleteOptions.getOptions().get(0).getStatus()); - } - - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("Users")) { - /* USER */ - try { - // GET Users - Users users = accountingApi.getUsers(ifModifiedSince, where, order); - messages.add("GET Users - cnt : " + users.getUsers().size()); - - //GET One User - UUID userID = users.getUsers().get(0).getUserID(); - Users user = accountingApi.getUser(userID); - messages.add("GET Users - First Name : " + user.getUsers().get(0).getFirstName()); - } catch (XeroApiException e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("Errors")) { - try { - Contact contact = new Contact(); - contact.setName("Sidney Maestre"); - Contacts createContact1 = accountingApi.createContact(contact); - Contacts createContact2 = accountingApi.createContact(contact); - } catch (XeroApiException e) { - System.out.println("Response Code: " + e.getResponseCode()); - System.out.println("Error Type: " + e.getError().getType()); - System.out.println("Error Number: " + e.getError().getErrorNumber()); - System.out.println("Error Message: " + e.getError().getMessage()); - if (e.getResponseCode() == 400) { - System.out.println("Validation Message: " + e.getError().getElements().get(0).getValidationErrors().get(0).getMessage()); - } - } - - try { - Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - Invoices newInvoices = new Invoices(); - Invoice myInvoice = new Invoice(); - - LineItem li = new LineItem(); - li.setAccountCode("123456789"); - li.setDescription("Acme Tires"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - myInvoice.addLineItemsItem(li); - myInvoice.setContact(useContact); - LocalDate dueDate = LocalDate.of(2018,Month.OCTOBER,10); - myInvoice.setDueDate(dueDate); - LocalDate todayDate = LocalDate.now(); - myInvoice.setDate(todayDate); - - myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); - myInvoice.setReference("One Fish, Two Fish"); - myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); - newInvoices.addInvoicesItem(myInvoice); - - Invoices newInvoice = accountingApi.createInvoice(newInvoices, summarizeErrors); - messages.add("Create invoice - Reference : " + newInvoice.getInvoices().get(0).getReference()); - } catch (XeroApiException e) { - System.out.println("Response Code: " + e.getResponseCode()); - System.out.println("Error Type: " + e.getError().getType()); - System.out.println("Error Number: " + e.getError().getErrorNumber()); - System.out.println("Error Message: " + e.getError().getMessage()); - if (e.getResponseCode() == 400) { - System.out.println("Validation Message: " + e.getError().getElements().get(0).getValidationErrors().get(0).getMessage()); - } - } - - try { - UUID badContactId = UUID.fromString("bd2270c3-0000-4c11-9cfb-000b551c3f51"); - Contacts badContacts = accountingApi.getContact(badContactId); - } catch (XeroApiException e) { - System.out.println("Response Code: " + e.getResponseCode()); - System.out.println("Error Type: " + e.getError().getType()); - System.out.println("Error Number: " + e.getError().getErrorNumber()); - System.out.println("Error Message: " + e.getError().getMessage()); - if (e.getResponseCode() == 400) { - System.out.println("Validation Message: " + e.getError().getElements().get(0).getValidationErrors().get(0).getMessage()); - } - } - - Contacts ContactList = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - int num4 = SampleData.findRandomNum(ContactList.getContacts().size()); - UUID contactId = ContactList.getContacts().get(num4).getContactID(); - try { - for(int i=65; i>1; i--){ - Contacts allMyContacts = accountingApi.getContact(contactId); - } - messages.add("Congrats - you made over 60 calls without hitting rate limit"); - } catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); - messages.add("Error Code : " + e.getResponseCode() + " Message: " + e.getMessage()); - } - } - - for (int i = 0; i < messages.size(); i++) { - System.out.println(messages.get(i)); - respWriter.println("

" + messages.get(i) + "

"); - } - - respWriter.println("
end processing request
"); - respWriter.println("
"); - } - - - protected void addToMapIfNotNull(Map map, String key, Object value) { - if (value != null) { - map.put(key, value.toString()); - } - } - - protected String saveFile(ByteArrayInputStream input, String fileName) { - String saveFilePath = null; - File f = new File("./"); - String dirPath; - try { - dirPath = f.getCanonicalPath(); - - FileOutputStream output = new FileOutputStream(fileName); - - int DEFAULT_BUFFER_SIZE = 1024; - byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; - int n = 0; - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - while (n >= 0) { - output.write(buffer, 0, n); - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - } - input.close(); - output.close(); - - saveFilePath = dirPath + File.separator + fileName; - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return saveFilePath; - } -} diff --git a/src/main/java/com/xero/example/RequestTokenServlet.java b/src/main/java/com/xero/example/RequestTokenServlet.java index ac03fd5e..dfd78078 100755 --- a/src/main/java/com/xero/example/RequestTokenServlet.java +++ b/src/main/java/com/xero/example/RequestTokenServlet.java @@ -1,23 +1,21 @@ package com.xero.example; import java.io.IOException; -import java.io.PrintWriter; +import java.util.Random; import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.xero.api.Config; -import com.xero.api.JsonConfig; -import com.xero.api.OAuthAuthorizeToken; -import com.xero.api.OAuthRequestToken; -import com.xero.api.XeroApiException; -import com.xero.api.XeroClientException; +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.oauth.OAuth20Service; +import com.xero.api.XeroApi20; public class RequestTokenServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private Config config = null; + //private Config config = null; public RequestTokenServlet() { super(); @@ -25,37 +23,21 @@ public RequestTokenServlet() { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - PrintWriter respWriter = response.getWriter(); - response.setStatus(200); - response.setContentType("text/html"); - - try { - config = JsonConfig.getInstance(); - // IF Xero App is Private > 2 legged oauth - fwd to RequestResouce Servlet - if(config.getAppType().equals("PRIVATE")) { - response.sendRedirect("./callback.jsp"); - } else { - OAuthRequestToken requestToken = new OAuthRequestToken(config); - try { - requestToken.execute(); - // DEMONSTRATION ONLY - Store in Cookie - you can extend TokenStorage - // and implement the save() method for your database - TokenStorage storage = new TokenStorage(); - storage.save(response,requestToken.getAll()); + final String clientId = "--your-client-id--"; + final String clientSecret = "--your-client-secret--"; + final String secretState = "secret" + new Random().nextInt(999_999); + final OAuth20Service service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .defaultScope("openid email profile offline_access accounting.settings accounting.transactions") // replace with desired scope + .callback("http://localhost/Callback") + .build(XeroApi20.instance()); + + // Obtain the Authorization URL + final String authorizationUrl = service.createAuthorizationUrlBuilder() + .state(secretState) + .build(); - //Build the Authorization URL and redirect User - OAuthAuthorizeToken authToken = new OAuthAuthorizeToken(config, requestToken.getTempToken()); - response.sendRedirect(authToken.getAuthUrl()); - } catch (XeroApiException e) { - String message = java.net.URLDecoder.decode(e.getMessage(), "UTF-8"); - respWriter.println("Error code:" + e.getResponseCode() + " Message:" + message); - } - } - } catch (XeroClientException e) { - String message = java.net.URLDecoder.decode(e.getMessage(), "UTF-8"); - respWriter.println("Error: " + message); - } - + response.sendRedirect(authorizationUrl); } } diff --git a/src/main/java/com/xero/example/SampleData.java b/src/main/java/com/xero/example/SampleData.java deleted file mode 100755 index 82165148..00000000 --- a/src/main/java/com/xero/example/SampleData.java +++ /dev/null @@ -1,811 +0,0 @@ -package com.xero.example; - -import java.io.IOException; -import java.math.BigDecimal; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.List; -import java.util.Random; - -import com.xero.api.XeroClient; -import com.xero.model.*; - -public class SampleData { - - public static XeroClient client = null; - - public SampleData(XeroClient client) { - SampleData.client = client; - } - - public static ArrayOfAccount loadAccount() { - ArrayOfAccount array = new ArrayOfAccount(); - Account account = new Account(); - int ranNum = loadRandomNum(); - account.setCode(Integer.toString(ranNum)); - account.setName("My Expense " + Integer.toString(ranNum)); - account.setDescription("Finding Nemo"); - - account.setType(AccountType.EXPENSE); - array.getAccount().add(account); - return array; - } - - public static Account loadAccountFixedAsset() throws IOException { - ArrayOfAccount array = new ArrayOfAccount(); - Account account = new Account(); - int ranNum = loadRandomNum(); - account.setCode(Integer.toString(ranNum)); - account.setName("FixedAsset " + Integer.toString(ranNum)); - account.setDescription("New Fixed Asset via SDK"); - - account.setType(AccountType.FIXED); - array.getAccount().add(account); - List newAccount = client.createAccounts(array.getAccount()); - return newAccount.get(0); - } - - public static Account loadAccountExpenses() throws IOException { - ArrayOfAccount array = new ArrayOfAccount(); - Account account = new Account(); - int ranNum = loadRandomNum(); - account.setCode(Integer.toString(ranNum)); - account.setName("Expense " + Integer.toString(ranNum)); - account.setDescription("New Expense via SDK"); - - account.setType(AccountType.EXPENSE); - array.getAccount().add(account); - List newAccount = client.createAccounts(array.getAccount()); - return newAccount.get(0); - } - - public static Account loadAccountDepreciation() throws IOException { - ArrayOfAccount array = new ArrayOfAccount(); - Account account = new Account(); - int ranNum = loadRandomNum(); - account.setCode(Integer.toString(ranNum)); - account.setName("Depreciation " + Integer.toString(ranNum)); - account.setDescription("New Depreciation via SDK"); - - account.setType(AccountType.DEPRECIATN); - array.getAccount().add(account); - List newAccount = client.createAccounts(array.getAccount()); - return newAccount.get(0); - } - - // BANK TRANSACTION - public static ArrayOfBankTransaction loadBankTransaction() throws IOException { - ArrayOfBankTransaction array = new ArrayOfBankTransaction(); - BankTransaction bt = new BankTransaction(); - bt.setDate(loadDate());; - bt.setStatus(BankTransactionStatus.AUTHORISED);; - bt.setType(BankTransactionType.SPEND); - bt.setUrl("http://mycompany.org/transactions/230498239"); - bt.setLineItems(loadLineItem()); - bt.setSubTotal(new BigDecimal(20.00)); - bt.setTotalTax(new BigDecimal(0)); - bt.setTotal(new BigDecimal("20.00")); - bt.setCurrencyRate(new BigDecimal(1.000000)); - bt.setContact(loadContact().getContact().get(0)); - bt.setLineAmountTypes(LineAmountType.INCLUSIVE); - - Account acct = loadBankAccount(); - bt.setBankAccount(acct); - array.getBankTransaction().add(bt); - return array; - } - - // BANK TRANSFER - public static ArrayOfBankTransfer loadBankTransfer() throws IOException { - ArrayOfBankTransfer array = new ArrayOfBankTransfer(); - BankTransfer bt = new BankTransfer(); - - List accountWhere = client.getAccounts(null,"Type==\"BANK\"",null); - - if(accountWhere.size() > 2) { - BankAccount fromAccount = new BankAccount(); - fromAccount.setAccountID(accountWhere.get(0).getAccountID()); - - BankAccount toAccount = new BankAccount(); - toAccount.setAccountID(accountWhere.get(1).getAccountID()); - - bt.setAmount(new BigDecimal(20.00)); - bt.setDate(loadDate()); - bt.setFromBankAccount(fromAccount); - bt.setToBankAccount(toAccount); - bt.setCurrencyRate(new BigDecimal(1.000000)); - - array.getBankTransfer().add(bt); - } - return array; - } - - // CONTACT - public static ArrayOfContact loadContact() { - ArrayOfContact array = new ArrayOfContact(); - Contact contact = new Contact(); - contact.setName("Barney Rubble-" + loadRandomNum()); - contact.setEmailAddress("barney@bedrock.com"); - contact.setFirstName("B"); - contact.setLastName("Rubble"); - - ArrayOfAddress arrayOfAddress = new ArrayOfAddress(); - Address address = new Address(); - address.setAddressLine1("100 Green Street"); - address.setCity("San Francisco"); - address.setPostalCode("94111"); - address.setAddressType(AddressType.STREET); - arrayOfAddress.getAddress().add(address); - - contact.setAddresses(arrayOfAddress); - - ArrayOfPhone arrayOfPhone = new ArrayOfPhone(); - Phone phone = new Phone(); - phone.setPhoneAreaCode("415"); - phone.setPhoneNumber("5551212"); - arrayOfPhone.getPhone().add(phone); - contact.setPhones(arrayOfPhone); - - array.getContact().add(contact); - return array; - } - - // CONTACT GROUP - public static ArrayOfContactGroup loadContactGroup() { - ArrayOfContactGroup array = new ArrayOfContactGroup(); - - ContactGroup cg = new ContactGroup(); - cg.setName("Fancy Cats-" + loadRandomNum()); - cg.setContacts(loadContact()); - array.getContactGroup().add(cg); - return array; - } - - // CREDIT NOTE - public static ArrayOfCreditNote loadCreditNote() throws IOException { - ArrayOfCreditNote array = new ArrayOfCreditNote(); - - CreditNote cn = new CreditNote(); - cn.setType(CreditNoteType.ACCPAYCREDIT); - cn.setDate(loadDate()); - cn.setLineAmountTypes(LineAmountType.INCLUSIVE); - cn.setLineItems(loadLineItem()); - cn.setContact(loadSingleContact()); - array.getCreditNote().add(cn); - return array; - } - - public static ArrayOfCreditNote loadCreditNote4dp() throws IOException { - ArrayOfCreditNote array = new ArrayOfCreditNote(); - - CreditNote cn = new CreditNote(); - cn.setType(CreditNoteType.ACCPAYCREDIT); - cn.setDate(loadDate()); - cn.setLineAmountTypes(LineAmountType.INCLUSIVE); - cn.setLineItems(loadLineItem4dp()); - cn.setContact(loadSingleContact()); - array.getCreditNote().add(cn); - return array; - } - - - // CURRENCY - public static ArrayOfCurrency loadCurrency() { - ArrayOfCurrency array = new ArrayOfCurrency(); - - Currency currency = new Currency(); - currency.setCode(CurrencyCode.CAD); - - array.getCurrency().add(currency); - return array; - } - - - // EMPLOYEE - public static ArrayOfEmployee loadEmployee() { - ArrayOfEmployee array = new ArrayOfEmployee(); - - Hyperlink link = new Hyperlink(); - link.setUrl("http://www.sfmoma.org"); - link.setDescription("SF Mueseum of Modern Art"); - - Employee e = new Employee(); - e.setFirstName("Jackson"); - e.setLastName("Pollock-" + loadRandomNum()); - e.setExternalLink(link); - array.getEmployee().add(e); - return array; - } - - // EXPENSE CLAIM - public static ArrayOfExpenseClaim loadExpenseClaim() throws IOException { - ArrayOfExpenseClaim array = new ArrayOfExpenseClaim(); - - ExpenseClaim e = new ExpenseClaim(); - e.setAmountDue(new BigDecimal(10.00)); - - List UserWhere = client.getUsers(null,"IsSubscriber==true",null); - if (UserWhere.size() == 0) { - UserWhere = client.getUsers(); - } - e.setUser(UserWhere.get(0)); - - List receipt = SampleData.loadReceipt().getReceipt(); - List newReceipt = client.createReceipts(receipt); - ArrayOfReceipt arrayReceipts = new ArrayOfReceipt(); - arrayReceipts.getReceipt().add(newReceipt.get(0)); - e.setReceipts(arrayReceipts); - - array.getExpenseClaim().add(e); - return array; - } - - // INVOICE - public static ArrayOfInvoice loadInvoice() throws IOException { - ArrayOfInvoice array = new ArrayOfInvoice(); - - Invoice inv = new Invoice(); - inv.setContact(loadSingleContact()); - inv.setCurrencyCode(CurrencyCode.USD); - inv.setLineItems(loadLineItem()); - inv.setDate(loadDate()); - inv.setDueDate(loadDate()); - inv.setInvoiceNumber( Integer.toString(loadRandomNum()) ); - inv.setType(InvoiceType.ACCREC); - inv.setStatus(InvoiceStatus.DRAFT); - array.getInvoice().add(inv); - return array; - } - - // BAD INVOICE - public static ArrayOfInvoice loadBadInvoice() throws IOException { - ArrayOfInvoice array = new ArrayOfInvoice(); - - Invoice inv = new Invoice(); - inv.setContact(loadSingleContact()); - inv.setCurrencyCode(CurrencyCode.AUD); - inv.setLineItems(loadLineItem()); - inv.setDate(loadDate()); - inv.setDueDate(loadDate()); - inv.setInvoiceNumber( Integer.toString(loadRandomNum()) ); - inv.setType(InvoiceType.ACCREC); - inv.setStatus(InvoiceStatus.DRAFT); - array.getInvoice().add(inv); - return array; - } - - // BAD INVOICE 2 - public static ArrayOfInvoice loadBadInvoice2() throws IOException { - ArrayOfInvoice array = new ArrayOfInvoice(); - - Invoice inv = new Invoice(); - inv.setContact(loadSingleContact()); - inv.setCurrencyCode(CurrencyCode.NZD); - inv.setLineItems(loadLineItem()); - inv.setDate(loadDate()); - inv.setDueDate(loadDate()); - inv.setInvoiceNumber( Integer.toString(loadRandomNum()) ); - inv.setType(InvoiceType.ACCREC); - inv.setStatus(InvoiceStatus.DRAFT); - array.getInvoice().add(inv); - return array; - } - - // ITEMS - public static ArrayOfItem loadItem() { - ArrayOfItem array = new ArrayOfItem(); - String rand = Integer.toString(loadRandomNum()); - Item item = new Item(); - item.setCode( rand); - item.setDescription("ACME hammer-" + rand); - item.setName("ACME hammer-" + rand ); - item.setIsSold(true); - - array.getItem().add(item); - return array; - } - - // LINKED TRANSACTIONS - public static ArrayOfLinkedTransaction loadLinkedTransaction() throws IOException { - ArrayOfLinkedTransaction array = new ArrayOfLinkedTransaction(); - - Invoice newBill = loadNewBill(); - @SuppressWarnings("unused") - Invoice newSalesInvoice = loadNewSalesInvoice(); - LinkedTransaction lt = new LinkedTransaction(); - lt.setContactID(loadSingleContact().getContactID()); - lt.setSourceTransactionID(newBill.getInvoiceID()); - lt.setSourceLineItemID(newBill.getLineItems().getLineItem().get(0).getLineItemID()); - //lt.setTargetTransactionID(newSalesInvoice.getInvoiceID()); - //lt.setTargetLineItemID(newSalesInvoice.getLineItems().getLineItem().get(0).getLineItemID()); - - array.getLinkedTransaction().add(lt); - return array; - } - - // MANUAL JOURNAL - public static ArrayOfManualJournal loadManualJournal() throws IOException { - ArrayOfManualJournal array = new ArrayOfManualJournal(); - ArrayOfManualJournalLine arrayOfMJLine = new ArrayOfManualJournalLine(); - - List accountSales = client.getAccounts(null,"Type==\"REVENUE\"",null); - List accountDirectCosts = client.getAccounts(null,"Type==\"DIRECTCOSTS\"",null); - - if (accountSales.size() == 0 ){ - System.out.println("no revenue accounts"); - } - - if (accountDirectCosts.size() == 0 ){ - System.out.println("no direct cost accounts"); - } - - // GET ALL YOUR TRACKING CATEGORIES - List TrackingCategoryList = client.getTrackingCategories(); - - // Create a New Array to Populate with a chosen Tracking Category - ArrayOfTrackingCategory arrayTracking = new ArrayOfTrackingCategory(); - - if (TrackingCategoryList.size() > 0) { - // Get the options for a Tracking Category 1 - ArrayOfTrackingCategoryOption options1 = TrackingCategoryList.get(0).getOptions(); - List optionList1 = options1.getOption(); - - // Populate the option 1 with the Name of the Cateogry and Option - TrackingCategory category1 = new TrackingCategory(); - category1.setName(TrackingCategoryList.get(0).getName()); - category1.setOption(optionList1.get(0).getName()); - - arrayTracking.getTrackingCategory().add(category1); - } - - - if (TrackingCategoryList.size() > 1) { - // Get the options for a Tracking Category 2 - ArrayOfTrackingCategoryOption options2 = TrackingCategoryList.get(1).getOptions(); - List optionList2 = options2.getOption(); - - // Populate the option 2 with the Name of the Cateogry and Option - TrackingCategory category2 = new TrackingCategory(); - category2.setName(TrackingCategoryList.get(1).getName()); - category2.setOption(optionList2.get(1).getName()); - - arrayTracking.getTrackingCategory().add(category2); - } - - ManualJournalLine debit = new ManualJournalLine(); - debit.setDescription("My MJ Debit"); - debit.setAccountCode("400"); - debit.setLineAmount(new BigDecimal(10.00)); - debit.setTracking(arrayTracking); - arrayOfMJLine.getJournalLine().add(debit); - - ManualJournalLine credit = new ManualJournalLine(); - credit.setDescription("My MJ Credit"); - credit.setAccountCode("500"); - credit.setLineAmount(new BigDecimal(-10.00)); - credit.setTracking(arrayTracking); - arrayOfMJLine.getJournalLine().add(credit); - - ManualJournal mj = new ManualJournal(); - mj.setJournalLines(arrayOfMJLine); - mj.setDate(loadDate()); - mj.setNarration("My Fake Journal"); - mj.setStatus(ManualJournalStatus.DRAFT); - array.getManualJournal().add(mj); - return array; - } - - // NEW ALLOCATION - public static ArrayOfAllocation loadAllocation() throws IOException { - ArrayOfAllocation array = new ArrayOfAllocation(); - Allocation allocation = new Allocation(); - allocation.setDate(loadDate()); - allocation.setAppliedAmount(new BigDecimal("1.00")); - - Invoice inv = loadNewSalesInvoice(); - allocation.setInvoice(inv); - - array.getAllocation().add(allocation); - return array; - } - - // NEW CREDIT NOTE ALLOCATION - public static ArrayOfAllocation loadCreditNoteAllocation() throws IOException { - ArrayOfAllocation array = new ArrayOfAllocation(); - Allocation allocation = new Allocation(); - allocation.setDate(loadDate()); - allocation.setAppliedAmount(new BigDecimal("1.00")); - - Invoice inv = loadNewBill(); - Invoice useInv = new Invoice(); - useInv.setInvoiceID(inv.getInvoiceID()); - allocation.setInvoice(useInv); - - array.getAllocation().add(allocation); - return array; - } - - // OVERPAYMENT - public static BankTransaction loadNewlyCreatedOverpayment() throws IOException { - ArrayOfBankTransaction array = new ArrayOfBankTransaction(); - BankTransaction bt = new BankTransaction(); - bt.setDate(loadDate());; - bt.setStatus(BankTransactionStatus.AUTHORISED);; - bt.setType(BankTransactionType.RECEIVE_OVERPAYMENT); - bt.setUrl("http://mycompany.org/transactions/230498239"); - bt.setLineItems(loadLineItemForOverpayment()); - - bt.setSubTotal(new BigDecimal(20.00)); - bt.setTotalTax(new BigDecimal(0)); - bt.setTotal(new BigDecimal("20.00")); - bt.setCurrencyRate(new BigDecimal(1.000000)); - bt.setContact(loadContact().getContact().get(0)); - bt.setLineAmountTypes(LineAmountType.NO_TAX); - - Account acct = loadBankAccount(); - bt.setBankAccount(acct); - array.getBankTransaction().add(bt); - - List newBankTransaction = client.createBankTransactions(array.getBankTransaction()); - return newBankTransaction.get(0); - } - - // PAYMENTS - public static ArrayOfPayment loadPayment() throws IOException { - ArrayOfPayment array = new ArrayOfPayment(); - Payment pay = new Payment(); - pay.setDate(loadDate()); - - Account acct = loadBankAccount(); - pay.setAccount(acct); - pay.setAmount(new BigDecimal(".99")); - - Invoice inv = loadNewSalesInvoice(); - pay.setInvoice(inv); - - array.getPayment().add(pay); - return array; - } - - - // PREPAYMENT - public static BankTransaction loadNewlyCreatedPrepayment() throws IOException { - ArrayOfBankTransaction array = new ArrayOfBankTransaction(); - BankTransaction bt = new BankTransaction(); - bt.setDate(loadDate());; - bt.setStatus(BankTransactionStatus.AUTHORISED);; - bt.setType(BankTransactionType.RECEIVE_PREPAYMENT); - bt.setUrl("http://mycompany.org/transactions/230498239"); - bt.setLineItems(loadLineItemForPrepayment()); - - bt.setSubTotal(new BigDecimal(20.00)); - bt.setTotalTax(new BigDecimal(0)); - bt.setTotal(new BigDecimal("20.00")); - bt.setCurrencyRate(new BigDecimal(1.000000)); - bt.setContact(loadContact().getContact().get(0)); - bt.setLineAmountTypes(LineAmountType.NO_TAX); - Account acct = loadBankAccount(); - bt.setBankAccount(acct); - array.getBankTransaction().add(bt); - - List newBankTransaction = client.createBankTransactions(array.getBankTransaction()); - return newBankTransaction.get(0); - } - - - - // PURCHASEORDER - public static ArrayOfPurchaseOrder loadPurchaseOrder() throws IOException { - ArrayOfPurchaseOrder array = new ArrayOfPurchaseOrder(); - PurchaseOrder po = new PurchaseOrder(); - po.setDate(loadDate()); - po.setAttentionTo("Sid Maestre"); - po.setContact(loadSingleContact()); - po.setDate(loadDate()); - po.setStatus(PurchaseOrderStatus.DRAFT); - po.setReference("What is the Matrix?"); - po.setLineItems(loadLineItem()); - po.setPurchaseOrderNumber("XRO-" + loadRandomNum()); - - array.getPurchaseOrder().add(po); - return array; - } - - // RECEIPT - public static ArrayOfReceipt loadReceipt() throws IOException { - ArrayOfReceipt array = new ArrayOfReceipt(); - - Receipt r = new Receipt(); - r.setContact(loadSingleContact()); - List UserWhere = client.getUsers(null,"IsSubscriber==true",null); - if (UserWhere.size() == 0) { - UserWhere = client.getUsers(); - } - r.setUser(UserWhere.get(0)); - r.setLineItems(loadExpenseClaimLineItem()); - r.setDate(loadDate()); - r.setReference("Does Barry Manilow know you raid his wardrobe?"); - r.setStatus(ReceiptStatus.DRAFT); - r.setLineAmountTypes(LineAmountType.INCLUSIVE); - - array.getReceipt().add(r); - return array; - } - - // TAXRATES - public static ArrayOfTaxRate loadTaxRate() { - ArrayOfTaxRate array = new ArrayOfTaxRate(); - ArrayOfTaxComponent arrayOfTaxComponent = new ArrayOfTaxComponent(); - TaxComponent taxComponent = new TaxComponent(); - taxComponent.setName("Little One-" + loadRandomNum()); - taxComponent.setRate("2"); - taxComponent.setIsCompound(false); - arrayOfTaxComponent.getTaxComponent().add(taxComponent); - - TaxComponent taxComponent2 = new TaxComponent(); - taxComponent2.setName("Big One-" + loadRandomNum()); - taxComponent2.setRate("5"); - taxComponent2.setIsCompound(true); - arrayOfTaxComponent.getTaxComponent().add(taxComponent2); - - TaxRate taxrate = new TaxRate(); - taxrate.setTaxComponents(arrayOfTaxComponent); - taxrate.setName("CA Big fat tax-"+ loadRandomNum()); - array.getTaxRate().add(taxrate); - return array; - } - - // TRACKING CATEGORY - public static ArrayOfTrackingCategory loadTrackingCategory() { - ArrayOfTrackingCategory array = new ArrayOfTrackingCategory(); - - TrackingCategory tc = new TrackingCategory(); - tc.setName("Star Wars-"+ loadRandomNum()); - - array.getTrackingCategory().add(tc); - return array; - } - - // TRACKING CATEGORY OPTION - public static ArrayOfTrackingCategoryOption loadTrackingCategoryOption() { - ArrayOfTrackingCategoryOption array = new ArrayOfTrackingCategoryOption(); - - TrackingCategoryOption tc = new TrackingCategoryOption(); - tc.setName("The Empire Strikes Back-"+ loadRandomNum()); - - array.getOption().add(tc); - return array; - } - - public static ArrayOfTrackingCategoryOption loadTrackingCategoryOptionMulti() { - ArrayOfTrackingCategoryOption array = new ArrayOfTrackingCategoryOption(); - - TrackingCategoryOption tc = new TrackingCategoryOption(); - tc.setName("The Empire Strikes Back-"+ loadRandomNum()); - - TrackingCategoryOption tc2 = new TrackingCategoryOption(); - tc2.setName("Return of the Jedi"); - - TrackingCategoryOption tc3 = new TrackingCategoryOption(); - tc3.setName("Return of the Jedi"); - - array.getOption().add(tc); - array.getOption().add(tc2); - array.getOption().add(tc3); - return array; - } - - // GENERAL - - public static int findRandomNum(int total) { - Random randomGenerator = new Random(); - int randomInt = randomGenerator.nextInt(total); - return randomInt; - } - - private static Calendar loadDate() { - Calendar calendar = new GregorianCalendar(2016,9,19,13,10,00); - return calendar; - } - - public static Contact loadSingleContact() throws IOException { - List contacts = SampleData.client.getContacts(); - return contacts.get(0); - } - - @SuppressWarnings("unused") - private static Receipt loadSingleReceipt() throws IOException { - List r = SampleData.client.getReceipts(); - return r.get(0); - } - - private static User loadSingleUser() throws IOException { - List users = SampleData.client.getUsers(); - return users.get(0); - } - - public static int loadRandomNum() { - Random randomGenerator = new Random(); - int randomInt = randomGenerator.nextInt(100000); - return randomInt; - } - - public static Account loadBankAccount() throws IOException { - List accountWhere = client.getAccounts(null,"Type==\"BANK\"",null); - - return accountWhere.get(0); - } - - private static Invoice loadNewBill() throws IOException { - ArrayOfInvoice array = new ArrayOfInvoice(); - - Invoice inv = new Invoice(); - Contact contact = loadSingleContact(); - Contact useContact = new Contact(); - useContact.setContactID(contact.getContactID()); - inv.setContact(useContact); - inv.setLineItems(loadLineItem()); - inv.setDate(loadDate()); - inv.setDueDate(loadDate()); - inv.setInvoiceNumber( Integer.toString(loadRandomNum()) ); - inv.setType(InvoiceType.ACCPAY); - inv.setStatus(InvoiceStatus.AUTHORISED); - array.getInvoice().add(inv); - - List newInvoice = client.createInvoices(array.getInvoice()); - - return newInvoice.get(0); - } - - private static Invoice loadNewSalesInvoice() throws IOException { - ArrayOfInvoice array = new ArrayOfInvoice(); - - Invoice inv = new Invoice(); - inv.setContact(loadSingleContact()); - inv.setCurrencyCode(CurrencyCode.USD); - inv.setLineItems(loadEmptyLineItem()); - inv.setDate(loadDate()); - inv.setDueDate(loadDate()); - inv.setType(InvoiceType.ACCREC); - inv.setStatus(InvoiceStatus.AUTHORISED); - array.getInvoice().add(inv); - - List newInvoice = client.createInvoices(array.getInvoice()); - - return newInvoice.get(0); - } - - private static ArrayOfLineItem loadLineItem() throws IOException{ - List accountDirectCosts = client.getAccounts(null,"Type==\"DIRECTCOSTS\"",null); - - ArrayOfLineItem array = new ArrayOfLineItem(); - LineItem line = new LineItem(); - line.setDescription("Yearly Bank Account Fee"); - line.setQuantity(new BigDecimal("1.00")); - line.setUnitAmount(new BigDecimal("20.00")); - line.setLineAmount(new BigDecimal("20.00")); - line.setAccountCode(accountDirectCosts.get(0).getCode()); - - - List TrackingCategoryList = client.getTrackingCategories(); - if (TrackingCategoryList.size() > 0) { - int num10 = SampleData.findRandomNum(TrackingCategoryList.size()); - - ArrayOfTrackingCategory trackingCategories = new ArrayOfTrackingCategory(); - TrackingCategory trackingCategory = new TrackingCategory(); - - trackingCategory.setTrackingCategoryID(TrackingCategoryList.get(num10).getTrackingCategoryID()); - trackingCategory.setName(TrackingCategoryList.get(num10).getName()); - trackingCategory.setOption(TrackingCategoryList.get(num10).getOptions().getOption().get(0).getName()); - - trackingCategories.getTrackingCategory().add(trackingCategory); - - line.setTracking(trackingCategories); - - } - - array.getLineItem().add(line); - return array; - } - - private static ArrayOfLineItem loadLineItem4dp() throws IOException{ - List accountDirectCosts = client.getAccounts(null,"Type==\"DIRECTCOSTS\"",null); - - ArrayOfLineItem array = new ArrayOfLineItem(); - LineItem line = new LineItem(); - line.setDescription("Yearly Bank Account Fee"); - line.setQuantity(new BigDecimal("1.00")); - line.setUnitAmount(new BigDecimal("20.0344")); - line.setLineAmount(new BigDecimal("20.0344")); - line.setAccountCode(accountDirectCosts.get(0).getCode()); - - - List TrackingCategoryList = client.getTrackingCategories(); - if (TrackingCategoryList.size() > 0) { - int num10 = SampleData.findRandomNum(TrackingCategoryList.size()); - - ArrayOfTrackingCategory trackingCategories = new ArrayOfTrackingCategory(); - TrackingCategory trackingCategory = new TrackingCategory(); - - trackingCategory.setTrackingCategoryID(TrackingCategoryList.get(num10).getTrackingCategoryID()); - trackingCategory.setName(TrackingCategoryList.get(num10).getName()); - trackingCategory.setOption(TrackingCategoryList.get(num10).getOptions().getOption().get(0).getName()); - - trackingCategories.getTrackingCategory().add(trackingCategory); - - line.setTracking(trackingCategories); - - } - - array.getLineItem().add(line); - return array; - } - - private static ArrayOfLineItem loadLineItemForOverpayment() throws IOException{ - List accountDebtors = client.getAccounts(null,"SystemAccount==\"DEBTORS\"",null); - - ArrayOfLineItem array = new ArrayOfLineItem(); - LineItem line = new LineItem(); - line.setDescription("My Overpayment for Subscription"); - line.setQuantity(new BigDecimal("1.00")); - line.setUnitAmount(new BigDecimal("20.00")); - line.setLineAmount(new BigDecimal("20.00")); - line.setAccountCode(accountDebtors.get(0).getCode()); - array.getLineItem().add(line); - return array; - } - - private static ArrayOfLineItem loadLineItemForPrepayment(){ - ArrayOfLineItem array = new ArrayOfLineItem(); - LineItem line = new LineItem(); - line.setDescription("My Prepayment for legal services"); - line.setQuantity(new BigDecimal("1.00")); - line.setUnitAmount(new BigDecimal("20.00")); - line.setLineAmount(new BigDecimal("20.00")); - line.setAccountCode("400"); - array.getLineItem().add(line); - return array; - } - - private static ArrayOfLineItem loadEmptyLineItem() throws IOException{ - List accountSales = client.getAccounts(null,"Type==\"REVENUE\"",null); - - ArrayOfLineItem array = new ArrayOfLineItem(); - LineItem line = new LineItem(); - line.setDescription("Yearly Bank Account Fee"); - line.setQuantity(new BigDecimal("1.00")); - line.setUnitAmount(new BigDecimal("30.00")); - line.setLineAmount(new BigDecimal("30.00")); - line.setAccountCode(accountSales.get(0).getCode()); - array.getLineItem().add(line); - return array; - } - - private static ArrayOfLineItem loadExpenseLineItem() throws IOException{ - List accountExpense = client.getAccounts(null,"Type==\"EXPENSE\"",null); - - ArrayOfLineItem array = new ArrayOfLineItem(); - LineItem line = new LineItem(); - line.setDescription("Coffee and Bagel"); - line.setQuantity(new BigDecimal("1.00")); - line.setUnitAmount(new BigDecimal("7.50")); - line.setLineAmount(new BigDecimal("7.50")); - line.setAccountCode(accountExpense.get(0).getCode()); - array.getLineItem().add(line); - return array; - } - - private static ArrayOfLineItem loadExpenseClaimLineItem() throws IOException{ - List accountExpense = client.getAccounts(null,"Type==\"EXPENSE\" and ShowInExpenseClaims==TRUE",null); - - ArrayOfLineItem array = new ArrayOfLineItem(); - LineItem line = new LineItem(); - line.setDescription("Coffee and Bagel"); - line.setQuantity(new BigDecimal("1.00")); - line.setUnitAmount(new BigDecimal("7.50")); - line.setLineAmount(new BigDecimal("7.50")); - line.setAccountCode(accountExpense.get(0).getCode()); - array.getLineItem().add(line); - return array; - } -} diff --git a/src/main/java/com/xero/models/accounting/Account.java b/src/main/java/com/xero/models/accounting/Account.java index f01cc7a0..a2502c5a 100644 --- a/src/main/java/com/xero/models/accounting/Account.java +++ b/src/main/java/com/xero/models/accounting/Account.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ public class Account { @JsonProperty("Type") - private AccountType type = null; + private AccountType type; @JsonProperty("BankAccountNumber") @@ -82,13 +82,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -129,13 +129,13 @@ public String toString() { } @JsonCreator - public static BankAccountTypeEnum fromValue(String text) { + public static BankAccountTypeEnum fromValue(String value) { for (BankAccountTypeEnum b : BankAccountTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -145,7 +145,7 @@ public static BankAccountTypeEnum fromValue(String text) { @JsonProperty("CurrencyCode") - private CurrencyCode currencyCode = null; + private CurrencyCode currencyCode; @JsonProperty("TaxType") @@ -190,13 +190,13 @@ public String toString() { } @JsonCreator - public static PropertyClassEnum fromValue(String text) { + public static PropertyClassEnum fromValue(String value) { for (PropertyClassEnum b : PropertyClassEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -253,13 +253,13 @@ public String toString() { } @JsonCreator - public static SystemAccountEnum fromValue(String text) { + public static SystemAccountEnum fromValue(String value) { for (SystemAccountEnum b : SystemAccountEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -285,7 +285,7 @@ public static SystemAccountEnum fromValue(String text) { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); public Account code(String code) { this.code = code; @@ -624,7 +624,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Account {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" accountID: ").append(toIndentedString(accountID)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/AccountType.java b/src/main/java/com/xero/models/accounting/AccountType.java index 47f4fb33..e26cc7ec 100644 --- a/src/main/java/com/xero/models/accounting/AccountType.java +++ b/src/main/java/com/xero/models/accounting/AccountType.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -86,13 +86,13 @@ public String toString() { } @JsonCreator - public static AccountType fromValue(String text) { + public static AccountType fromValue(String value) { for (AccountType b : AccountType.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/src/main/java/com/xero/models/accounting/Accounts.java b/src/main/java/com/xero/models/accounting/Accounts.java index 1e18ec5f..6d65d096 100644 --- a/src/main/java/com/xero/models/accounting/Accounts.java +++ b/src/main/java/com/xero/models/accounting/Accounts.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Accounts { @JsonProperty("Accounts") - private List accounts = null; + private List accounts = new ArrayList(); public Accounts accounts(List accounts) { this.accounts = accounts; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Accounts {\n"); - sb.append(" accounts: ").append(toIndentedString(accounts)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/AccountsPayable.java b/src/main/java/com/xero/models/accounting/AccountsPayable.java index 71766877..c57f3ea7 100644 --- a/src/main/java/com/xero/models/accounting/AccountsPayable.java +++ b/src/main/java/com/xero/models/accounting/AccountsPayable.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -96,7 +96,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AccountsPayable {\n"); - sb.append(" outstanding: ").append(toIndentedString(outstanding)).append("\n"); sb.append(" overdue: ").append(toIndentedString(overdue)).append("\n"); sb.append("}"); diff --git a/src/main/java/com/xero/models/accounting/AccountsReceivable.java b/src/main/java/com/xero/models/accounting/AccountsReceivable.java index c2e32eb2..e08a5f21 100644 --- a/src/main/java/com/xero/models/accounting/AccountsReceivable.java +++ b/src/main/java/com/xero/models/accounting/AccountsReceivable.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -96,7 +96,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AccountsReceivable {\n"); - sb.append(" outstanding: ").append(toIndentedString(outstanding)).append("\n"); sb.append(" overdue: ").append(toIndentedString(overdue)).append("\n"); sb.append("}"); diff --git a/src/main/java/com/xero/models/accounting/Address.java b/src/main/java/com/xero/models/accounting/Address.java index e82cf0c3..3aae55b9 100644 --- a/src/main/java/com/xero/models/accounting/Address.java +++ b/src/main/java/com/xero/models/accounting/Address.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -55,13 +55,13 @@ public String toString() { } @JsonCreator - public static AddressTypeEnum fromValue(String text) { + public static AddressTypeEnum fromValue(String value) { for (AddressTypeEnum b : AddressTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -317,7 +317,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Address {\n"); - sb.append(" addressType: ").append(toIndentedString(addressType)).append("\n"); sb.append(" addressLine1: ").append(toIndentedString(addressLine1)).append("\n"); sb.append(" addressLine2: ").append(toIndentedString(addressLine2)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Allocation.java b/src/main/java/com/xero/models/accounting/Allocation.java index d03a47d7..6689f594 100644 --- a/src/main/java/com/xero/models/accounting/Allocation.java +++ b/src/main/java/com/xero/models/accounting/Allocation.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -121,7 +121,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Allocation {\n"); - sb.append(" invoice: ").append(toIndentedString(invoice)).append("\n"); sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Allocations.java b/src/main/java/com/xero/models/accounting/Allocations.java index 95294839..62a3d4c4 100644 --- a/src/main/java/com/xero/models/accounting/Allocations.java +++ b/src/main/java/com/xero/models/accounting/Allocations.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Allocations { @JsonProperty("Allocations") - private List allocations = null; + private List allocations = new ArrayList(); public Allocations allocations(List allocations) { this.allocations = allocations; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Allocations {\n"); - sb.append(" allocations: ").append(toIndentedString(allocations)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Attachment.java b/src/main/java/com/xero/models/accounting/Attachment.java index ff7997aa..180c5802 100644 --- a/src/main/java/com/xero/models/accounting/Attachment.java +++ b/src/main/java/com/xero/models/accounting/Attachment.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -190,7 +190,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Attachment {\n"); - sb.append(" attachmentID: ").append(toIndentedString(attachmentID)).append("\n"); sb.append(" fileName: ").append(toIndentedString(fileName)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Attachments.java b/src/main/java/com/xero/models/accounting/Attachments.java index 3cbcd9b6..6e7c3720 100644 --- a/src/main/java/com/xero/models/accounting/Attachments.java +++ b/src/main/java/com/xero/models/accounting/Attachments.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Attachments { @JsonProperty("Attachments") - private List attachments = null; + private List attachments = new ArrayList(); public Attachments attachments(List attachments) { this.attachments = attachments; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Attachments {\n"); - sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Balances.java b/src/main/java/com/xero/models/accounting/Balances.java index ca76514a..621fb01a 100644 --- a/src/main/java/com/xero/models/accounting/Balances.java +++ b/src/main/java/com/xero/models/accounting/Balances.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -99,7 +99,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Balances {\n"); - sb.append(" accountsReceivable: ").append(toIndentedString(accountsReceivable)).append("\n"); sb.append(" accountsPayable: ").append(toIndentedString(accountsPayable)).append("\n"); sb.append("}"); diff --git a/src/main/java/com/xero/models/accounting/BankTransaction.java b/src/main/java/com/xero/models/accounting/BankTransaction.java index 96617608..c43b211f 100644 --- a/src/main/java/com/xero/models/accounting/BankTransaction.java +++ b/src/main/java/com/xero/models/accounting/BankTransaction.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -76,13 +76,13 @@ public String toString() { } @JsonCreator - public static TypeEnum fromValue(String text) { + public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -116,7 +116,7 @@ public static TypeEnum fromValue(String text) { @JsonProperty("CurrencyCode") - private CurrencyCode currencyCode = null; + private CurrencyCode currencyCode; @JsonProperty("CurrencyRate") @@ -151,13 +151,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -167,7 +167,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("LineAmountTypes") - private LineAmountTypes lineAmountTypes = null; + private LineAmountTypes lineAmountTypes; @JsonProperty("SubTotal") @@ -207,7 +207,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); public BankTransaction type(TypeEnum type) { this.type = type; @@ -626,7 +626,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BankTransaction {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); sb.append(" lineitems: ").append(toIndentedString(lineitems)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/BankTransactions.java b/src/main/java/com/xero/models/accounting/BankTransactions.java index 68d1d7b8..0534a6eb 100644 --- a/src/main/java/com/xero/models/accounting/BankTransactions.java +++ b/src/main/java/com/xero/models/accounting/BankTransactions.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class BankTransactions { @JsonProperty("BankTransactions") - private List bankTransactions = null; + private List bankTransactions = new ArrayList(); public BankTransactions bankTransactions(List bankTransactions) { this.bankTransactions = bankTransactions; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BankTransactions {\n"); - sb.append(" bankTransactions: ").append(toIndentedString(bankTransactions)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/BankTransfer.java b/src/main/java/com/xero/models/accounting/BankTransfer.java index 23f62359..def2bf27 100644 --- a/src/main/java/com/xero/models/accounting/BankTransfer.java +++ b/src/main/java/com/xero/models/accounting/BankTransfer.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -77,7 +77,7 @@ public class BankTransfer { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); public BankTransfer fromBankAccount(Account fromBankAccount) { this.fromBankAccount = fromBankAccount; @@ -264,7 +264,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BankTransfer {\n"); - sb.append(" fromBankAccount: ").append(toIndentedString(fromBankAccount)).append("\n"); sb.append(" toBankAccount: ").append(toIndentedString(toBankAccount)).append("\n"); sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/BankTransfers.java b/src/main/java/com/xero/models/accounting/BankTransfers.java index ce8a7568..afc6c886 100644 --- a/src/main/java/com/xero/models/accounting/BankTransfers.java +++ b/src/main/java/com/xero/models/accounting/BankTransfers.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class BankTransfers { @JsonProperty("BankTransfers") - private List bankTransfers = null; + private List bankTransfers = new ArrayList(); public BankTransfers bankTransfers(List bankTransfers) { this.bankTransfers = bankTransfers; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BankTransfers {\n"); - sb.append(" bankTransfers: ").append(toIndentedString(bankTransfers)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/BatchPayment.java b/src/main/java/com/xero/models/accounting/BatchPayment.java index 91bdab2e..8ecfaa01 100644 --- a/src/main/java/com/xero/models/accounting/BatchPayment.java +++ b/src/main/java/com/xero/models/accounting/BatchPayment.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -77,7 +77,7 @@ public class BatchPayment { @JsonProperty("Payments") - private List payments = null; + private List payments = new ArrayList(); @JsonProperty("Type") @@ -379,7 +379,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BatchPayment {\n"); - sb.append(" account: ").append(toIndentedString(account)).append("\n"); sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); sb.append(" particulars: ").append(toIndentedString(particulars)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/BatchPaymentDetails.java b/src/main/java/com/xero/models/accounting/BatchPaymentDetails.java index 0b078447..ce905e96 100644 --- a/src/main/java/com/xero/models/accounting/BatchPaymentDetails.java +++ b/src/main/java/com/xero/models/accounting/BatchPaymentDetails.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -166,7 +166,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BatchPaymentDetails {\n"); - sb.append(" bankAccountNumber: ").append(toIndentedString(bankAccountNumber)).append("\n"); sb.append(" bankAccountName: ").append(toIndentedString(bankAccountName)).append("\n"); sb.append(" details: ").append(toIndentedString(details)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/BatchPayments.java b/src/main/java/com/xero/models/accounting/BatchPayments.java index 86b1ba45..61dd6310 100644 --- a/src/main/java/com/xero/models/accounting/BatchPayments.java +++ b/src/main/java/com/xero/models/accounting/BatchPayments.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class BatchPayments { @JsonProperty("BatchPayments") - private List batchPayments = null; + private List batchPayments = new ArrayList(); public BatchPayments batchPayments(List batchPayments) { this.batchPayments = batchPayments; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BatchPayments {\n"); - sb.append(" batchPayments: ").append(toIndentedString(batchPayments)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Bill.java b/src/main/java/com/xero/models/accounting/Bill.java index ceba672f..8222ed5e 100644 --- a/src/main/java/com/xero/models/accounting/Bill.java +++ b/src/main/java/com/xero/models/accounting/Bill.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -35,7 +35,7 @@ public class Bill { @JsonProperty("Type") - private PaymentTermType type = null; + private PaymentTermType type; public Bill day(Integer day) { this.day = day; @@ -97,7 +97,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Bill {\n"); - sb.append(" day: ").append(toIndentedString(day)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append("}"); diff --git a/src/main/java/com/xero/models/accounting/BrandingTheme.java b/src/main/java/com/xero/models/accounting/BrandingTheme.java index 7a06519d..ffd415f9 100644 --- a/src/main/java/com/xero/models/accounting/BrandingTheme.java +++ b/src/main/java/com/xero/models/accounting/BrandingTheme.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -144,7 +144,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BrandingTheme {\n"); - sb.append(" brandingThemeID: ").append(toIndentedString(brandingThemeID)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" sortOrder: ").append(toIndentedString(sortOrder)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/BrandingThemes.java b/src/main/java/com/xero/models/accounting/BrandingThemes.java index 557180e1..70c267a3 100644 --- a/src/main/java/com/xero/models/accounting/BrandingThemes.java +++ b/src/main/java/com/xero/models/accounting/BrandingThemes.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class BrandingThemes { @JsonProperty("BrandingThemes") - private List brandingThemes = null; + private List brandingThemes = new ArrayList(); public BrandingThemes brandingThemes(List brandingThemes) { this.brandingThemes = brandingThemes; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BrandingThemes {\n"); - sb.append(" brandingThemes: ").append(toIndentedString(brandingThemes)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/CISOrgSetting.java b/src/main/java/com/xero/models/accounting/CISOrgSetting.java index 664d735c..89822361 100644 --- a/src/main/java/com/xero/models/accounting/CISOrgSetting.java +++ b/src/main/java/com/xero/models/accounting/CISOrgSetting.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -119,7 +119,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CISOrgSetting {\n"); - sb.append(" ciSContractorEnabled: ").append(toIndentedString(ciSContractorEnabled)).append("\n"); sb.append(" ciSSubContractorEnabled: ").append(toIndentedString(ciSSubContractorEnabled)).append("\n"); sb.append(" rate: ").append(toIndentedString(rate)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/CISSetting.java b/src/main/java/com/xero/models/accounting/CISSetting.java index 3ac87ba4..08582e89 100644 --- a/src/main/java/com/xero/models/accounting/CISSetting.java +++ b/src/main/java/com/xero/models/accounting/CISSetting.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -96,7 +96,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CISSetting {\n"); - sb.append(" ciSEnabled: ").append(toIndentedString(ciSEnabled)).append("\n"); sb.append(" rate: ").append(toIndentedString(rate)).append("\n"); sb.append("}"); diff --git a/src/main/java/com/xero/models/accounting/CISSettings.java b/src/main/java/com/xero/models/accounting/CISSettings.java index cd215414..07c11948 100644 --- a/src/main/java/com/xero/models/accounting/CISSettings.java +++ b/src/main/java/com/xero/models/accounting/CISSettings.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class CISSettings { @JsonProperty("CISSettings") - private List ciSSettings = null; + private List ciSSettings = new ArrayList(); public CISSettings ciSSettings(List ciSSettings) { this.ciSSettings = ciSSettings; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CISSettings {\n"); - sb.append(" ciSSettings: ").append(toIndentedString(ciSSettings)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Contact.java b/src/main/java/com/xero/models/accounting/Contact.java index 7d277ff9..840a6ae4 100644 --- a/src/main/java/com/xero/models/accounting/Contact.java +++ b/src/main/java/com/xero/models/accounting/Contact.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -83,13 +83,13 @@ public String toString() { } @JsonCreator - public static ContactStatusEnum fromValue(String text) { + public static ContactStatusEnum fromValue(String value) { for (ContactStatusEnum b : ContactStatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -119,7 +119,7 @@ public static ContactStatusEnum fromValue(String text) { @JsonProperty("ContactPersons") - private List contactPersons = null; + private List contactPersons = new ArrayList(); @JsonProperty("BankAccountDetails") @@ -139,11 +139,11 @@ public static ContactStatusEnum fromValue(String text) { @JsonProperty("Addresses") - private List
addresses = null; + private List
addresses = new ArrayList
(); @JsonProperty("Phones") - private List phones = null; + private List phones = new ArrayList(); @JsonProperty("IsSupplier") @@ -155,7 +155,7 @@ public static ContactStatusEnum fromValue(String text) { @JsonProperty("DefaultCurrency") - private CurrencyCode defaultCurrency = null; + private CurrencyCode defaultCurrency; @JsonProperty("XeroNetworkKey") @@ -171,11 +171,11 @@ public static ContactStatusEnum fromValue(String text) { @JsonProperty("SalesTrackingCategories") - private List salesTrackingCategories = null; + private List salesTrackingCategories = new ArrayList(); @JsonProperty("PurchasesTrackingCategories") - private List purchasesTrackingCategories = null; + private List purchasesTrackingCategories = new ArrayList(); @JsonProperty("TrackingCategoryName") @@ -195,7 +195,7 @@ public static ContactStatusEnum fromValue(String text) { @JsonProperty("ContactGroups") - private List contactGroups = null; + private List contactGroups = new ArrayList(); @JsonProperty("Website") @@ -219,7 +219,7 @@ public static ContactStatusEnum fromValue(String text) { @JsonProperty("Attachments") - private List attachments = null; + private List attachments = new ArrayList(); @JsonProperty("HasAttachments") @@ -227,7 +227,7 @@ public static ContactStatusEnum fromValue(String text) { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); @JsonProperty("HasValidationErrors") @@ -1023,7 +1023,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Contact {\n"); - sb.append(" contactID: ").append(toIndentedString(contactID)).append("\n"); sb.append(" contactNumber: ").append(toIndentedString(contactNumber)).append("\n"); sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/ContactGroup.java b/src/main/java/com/xero/models/accounting/ContactGroup.java index be529abe..539e0120 100644 --- a/src/main/java/com/xero/models/accounting/ContactGroup.java +++ b/src/main/java/com/xero/models/accounting/ContactGroup.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -61,13 +61,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -81,7 +81,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Contacts") - private List contacts = null; + private List contacts = new ArrayList(); public ContactGroup name(String name) { this.name = name; @@ -189,7 +189,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ContactGroup {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" contactGroupID: ").append(toIndentedString(contactGroupID)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/ContactGroups.java b/src/main/java/com/xero/models/accounting/ContactGroups.java index 0c2ffb30..9c5c308d 100644 --- a/src/main/java/com/xero/models/accounting/ContactGroups.java +++ b/src/main/java/com/xero/models/accounting/ContactGroups.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class ContactGroups { @JsonProperty("ContactGroups") - private List contactGroups = null; + private List contactGroups = new ArrayList(); public ContactGroups contactGroups(List contactGroups) { this.contactGroups = contactGroups; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ContactGroups {\n"); - sb.append(" contactGroups: ").append(toIndentedString(contactGroups)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/ContactPerson.java b/src/main/java/com/xero/models/accounting/ContactPerson.java index 16c3f9c3..1c9582ae 100644 --- a/src/main/java/com/xero/models/accounting/ContactPerson.java +++ b/src/main/java/com/xero/models/accounting/ContactPerson.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -142,7 +142,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ContactPerson {\n"); - sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Contacts.java b/src/main/java/com/xero/models/accounting/Contacts.java index c180c0ba..4ad65e9c 100644 --- a/src/main/java/com/xero/models/accounting/Contacts.java +++ b/src/main/java/com/xero/models/accounting/Contacts.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Contacts { @JsonProperty("Contacts") - private List contacts = null; + private List contacts = new ArrayList(); public Contacts contacts(List contacts) { this.contacts = contacts; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Contacts {\n"); - sb.append(" contacts: ").append(toIndentedString(contacts)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/CountryCode.java b/src/main/java/com/xero/models/accounting/CountryCode.java index 15cdad6f..580f917d 100644 --- a/src/main/java/com/xero/models/accounting/CountryCode.java +++ b/src/main/java/com/xero/models/accounting/CountryCode.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -521,13 +521,13 @@ public String toString() { } @JsonCreator - public static CountryCode fromValue(String text) { + public static CountryCode fromValue(String value) { for (CountryCode b : CountryCode.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/src/main/java/com/xero/models/accounting/CreditNote.java b/src/main/java/com/xero/models/accounting/CreditNote.java index 306e6447..a7ec2f95 100644 --- a/src/main/java/com/xero/models/accounting/CreditNote.java +++ b/src/main/java/com/xero/models/accounting/CreditNote.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -65,13 +65,13 @@ public String toString() { } @JsonCreator - public static TypeEnum fromValue(String text) { + public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -120,13 +120,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -136,11 +136,11 @@ public static StatusEnum fromValue(String text) { @JsonProperty("LineAmountTypes") - private LineAmountTypes lineAmountTypes = null; + private LineAmountTypes lineAmountTypes; @JsonProperty("LineItems") - private List lineItems = null; + private List lineItems = new ArrayList(); @JsonProperty("SubTotal") @@ -160,7 +160,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("CurrencyCode") - private CurrencyCode currencyCode = null; + private CurrencyCode currencyCode; @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) @JsonProperty("FullyPaidOnDate") @@ -192,11 +192,11 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Allocations") - private List allocations = null; + private List allocations = new ArrayList(); @JsonProperty("Payments") - private List payments = null; + private List payments = new ArrayList(); @JsonProperty("BrandingThemeID") @@ -208,7 +208,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); public CreditNote type(TypeEnum type) { this.type = type; @@ -692,7 +692,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreditNote {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/CreditNotes.java b/src/main/java/com/xero/models/accounting/CreditNotes.java index c8771980..43b81271 100644 --- a/src/main/java/com/xero/models/accounting/CreditNotes.java +++ b/src/main/java/com/xero/models/accounting/CreditNotes.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class CreditNotes { @JsonProperty("CreditNotes") - private List creditNotes = null; + private List creditNotes = new ArrayList(); public CreditNotes creditNotes(List creditNotes) { this.creditNotes = creditNotes; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreditNotes {\n"); - sb.append(" creditNotes: ").append(toIndentedString(creditNotes)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Currencies.java b/src/main/java/com/xero/models/accounting/Currencies.java index 6d48d539..ce241019 100644 --- a/src/main/java/com/xero/models/accounting/Currencies.java +++ b/src/main/java/com/xero/models/accounting/Currencies.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Currencies { @JsonProperty("Currencies") - private List currencies = null; + private List currencies = new ArrayList(); public Currencies currencies(List currencies) { this.currencies = currencies; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Currencies {\n"); - sb.append(" currencies: ").append(toIndentedString(currencies)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Currency.java b/src/main/java/com/xero/models/accounting/Currency.java index b3941098..ec29902d 100644 --- a/src/main/java/com/xero/models/accounting/Currency.java +++ b/src/main/java/com/xero/models/accounting/Currency.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -31,7 +31,7 @@ public class Currency { @JsonProperty("Code") - private CurrencyCode code = null; + private CurrencyCode code; @JsonProperty("Description") @@ -97,7 +97,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Currency {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append("}"); diff --git a/src/main/java/com/xero/models/accounting/CurrencyCode.java b/src/main/java/com/xero/models/accounting/CurrencyCode.java index ef1ea633..590d3542 100644 --- a/src/main/java/com/xero/models/accounting/CurrencyCode.java +++ b/src/main/java/com/xero/models/accounting/CurrencyCode.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -366,13 +366,13 @@ public String toString() { } @JsonCreator - public static CurrencyCode fromValue(String text) { + public static CurrencyCode fromValue(String value) { for (CurrencyCode b : CurrencyCode.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/src/main/java/com/xero/models/accounting/Element.java b/src/main/java/com/xero/models/accounting/Element.java index 754d3b89..73844a38 100644 --- a/src/main/java/com/xero/models/accounting/Element.java +++ b/src/main/java/com/xero/models/accounting/Element.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Element { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); public Element validationErrors(List validationErrors) { this.validationErrors = validationErrors; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Element {\n"); - sb.append(" validationErrors: ").append(toIndentedString(validationErrors)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Employee.java b/src/main/java/com/xero/models/accounting/Employee.java index 7b962e00..1fd6cba4 100644 --- a/src/main/java/com/xero/models/accounting/Employee.java +++ b/src/main/java/com/xero/models/accounting/Employee.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -62,13 +62,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -228,7 +228,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Employee {\n"); - sb.append(" employeeID: ").append(toIndentedString(employeeID)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Employees.java b/src/main/java/com/xero/models/accounting/Employees.java index 9308271b..36d0786f 100644 --- a/src/main/java/com/xero/models/accounting/Employees.java +++ b/src/main/java/com/xero/models/accounting/Employees.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Employees { @JsonProperty("Employees") - private List employees = null; + private List employees = new ArrayList(); public Employees employees(List employees) { this.employees = employees; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Employees {\n"); - sb.append(" employees: ").append(toIndentedString(employees)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Error.java b/src/main/java/com/xero/models/accounting/Error.java index a321a3c9..d36f1611 100644 --- a/src/main/java/com/xero/models/accounting/Error.java +++ b/src/main/java/com/xero/models/accounting/Error.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -45,7 +45,7 @@ public class Error { @JsonProperty("Elements") - private List elements = null; + private List elements = new ArrayList(); public Error errorNumber(Integer errorNumber) { this.errorNumber = errorNumber; @@ -153,7 +153,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Error {\n"); - sb.append(" errorNumber: ").append(toIndentedString(errorNumber)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/ExpenseClaim.java b/src/main/java/com/xero/models/accounting/ExpenseClaim.java index 1691e4d2..5daec35c 100644 --- a/src/main/java/com/xero/models/accounting/ExpenseClaim.java +++ b/src/main/java/com/xero/models/accounting/ExpenseClaim.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -69,13 +69,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -85,7 +85,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Payments") - private List payments = null; + private List payments = new ArrayList(); @JsonProperty("User") @@ -93,7 +93,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Receipts") - private List receipts = null; + private List receipts = new ArrayList(); @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) @JsonProperty("UpdatedDateUTC") @@ -335,7 +335,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ExpenseClaim {\n"); - sb.append(" expenseClaimID: ").append(toIndentedString(expenseClaimID)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" payments: ").append(toIndentedString(payments)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/ExpenseClaims.java b/src/main/java/com/xero/models/accounting/ExpenseClaims.java index b404ec76..39fef5ac 100644 --- a/src/main/java/com/xero/models/accounting/ExpenseClaims.java +++ b/src/main/java/com/xero/models/accounting/ExpenseClaims.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class ExpenseClaims { @JsonProperty("ExpenseClaims") - private List expenseClaims = null; + private List expenseClaims = new ArrayList(); public ExpenseClaims expenseClaims(List expenseClaims) { this.expenseClaims = expenseClaims; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ExpenseClaims {\n"); - sb.append(" expenseClaims: ").append(toIndentedString(expenseClaims)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/ExternalLink.java b/src/main/java/com/xero/models/accounting/ExternalLink.java index 14e2b127..6f656f3d 100644 --- a/src/main/java/com/xero/models/accounting/ExternalLink.java +++ b/src/main/java/com/xero/models/accounting/ExternalLink.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -59,13 +59,13 @@ public String toString() { } @JsonCreator - public static LinkTypeEnum fromValue(String text) { + public static LinkTypeEnum fromValue(String value) { for (LinkTypeEnum b : LinkTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -160,7 +160,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ExternalLink {\n"); - sb.append(" linkType: ").append(toIndentedString(linkType)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/HistoryRecord.java b/src/main/java/com/xero/models/accounting/HistoryRecord.java index d35b078f..b0def605 100644 --- a/src/main/java/com/xero/models/accounting/HistoryRecord.java +++ b/src/main/java/com/xero/models/accounting/HistoryRecord.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -143,7 +143,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class HistoryRecord {\n"); - sb.append(" details: ").append(toIndentedString(details)).append("\n"); sb.append(" changes: ").append(toIndentedString(changes)).append("\n"); sb.append(" user: ").append(toIndentedString(user)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/HistoryRecords.java b/src/main/java/com/xero/models/accounting/HistoryRecords.java index 47dc25b1..1a11dd52 100644 --- a/src/main/java/com/xero/models/accounting/HistoryRecords.java +++ b/src/main/java/com/xero/models/accounting/HistoryRecords.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class HistoryRecords { @JsonProperty("HistoryRecords") - private List historyRecords = null; + private List historyRecords = new ArrayList(); public HistoryRecords historyRecords(List historyRecords) { this.historyRecords = historyRecords; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class HistoryRecords {\n"); - sb.append(" historyRecords: ").append(toIndentedString(historyRecords)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Invoice.java b/src/main/java/com/xero/models/accounting/Invoice.java index e1860865..4aea66e8 100644 --- a/src/main/java/com/xero/models/accounting/Invoice.java +++ b/src/main/java/com/xero/models/accounting/Invoice.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -68,13 +68,13 @@ public String toString() { } @JsonCreator - public static TypeEnum fromValue(String text) { + public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -100,7 +100,7 @@ public static TypeEnum fromValue(String text) { @JsonProperty("LineAmountTypes") - private LineAmountTypes lineAmountTypes = null; + private LineAmountTypes lineAmountTypes; @JsonProperty("InvoiceNumber") @@ -120,7 +120,7 @@ public static TypeEnum fromValue(String text) { @JsonProperty("CurrencyCode") - private CurrencyCode currencyCode = null; + private CurrencyCode currencyCode; @JsonProperty("CurrencyRate") @@ -159,13 +159,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -215,15 +215,15 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Payments") - private List payments = null; + private List payments = new ArrayList(); @JsonProperty("Prepayments") - private List prepayments = null; + private List prepayments = new ArrayList(); @JsonProperty("Overpayments") - private List overpayments = null; + private List overpayments = new ArrayList(); @JsonProperty("AmountDue") @@ -247,11 +247,11 @@ public static StatusEnum fromValue(String text) { @JsonProperty("CreditNotes") - private List creditNotes = null; + private List creditNotes = new ArrayList(); @JsonProperty("Attachments") - private List attachments = null; + private List attachments = new ArrayList(); @JsonProperty("HasErrors") @@ -263,7 +263,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); public Invoice type(TypeEnum type) { this.type = type; @@ -857,7 +857,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Invoice {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/InvoiceReminder.java b/src/main/java/com/xero/models/accounting/InvoiceReminder.java index 9f278afa..8d74819b 100644 --- a/src/main/java/com/xero/models/accounting/InvoiceReminder.java +++ b/src/main/java/com/xero/models/accounting/InvoiceReminder.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -73,7 +73,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InvoiceReminder {\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/InvoiceReminders.java b/src/main/java/com/xero/models/accounting/InvoiceReminders.java index d80e7c3d..b9f8856e 100644 --- a/src/main/java/com/xero/models/accounting/InvoiceReminders.java +++ b/src/main/java/com/xero/models/accounting/InvoiceReminders.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class InvoiceReminders { @JsonProperty("InvoiceReminders") - private List invoiceReminders = null; + private List invoiceReminders = new ArrayList(); public InvoiceReminders invoiceReminders(List invoiceReminders) { this.invoiceReminders = invoiceReminders; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InvoiceReminders {\n"); - sb.append(" invoiceReminders: ").append(toIndentedString(invoiceReminders)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Invoices.java b/src/main/java/com/xero/models/accounting/Invoices.java index 71ef7503..b0fc6406 100644 --- a/src/main/java/com/xero/models/accounting/Invoices.java +++ b/src/main/java/com/xero/models/accounting/Invoices.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Invoices { @JsonProperty("Invoices") - private List invoices = null; + private List invoices = new ArrayList(); public Invoices invoices(List invoices) { this.invoices = invoices; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Invoices {\n"); - sb.append(" invoices: ").append(toIndentedString(invoices)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Item.java b/src/main/java/com/xero/models/accounting/Item.java index 61091493..6e3e2de4 100644 --- a/src/main/java/com/xero/models/accounting/Item.java +++ b/src/main/java/com/xero/models/accounting/Item.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -92,7 +92,7 @@ public class Item { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); public Item code(String code) { this.code = code; @@ -409,7 +409,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Item {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" inventoryAssetAccountCode: ").append(toIndentedString(inventoryAssetAccountCode)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Items.java b/src/main/java/com/xero/models/accounting/Items.java index 1534c130..9a3bdcfe 100644 --- a/src/main/java/com/xero/models/accounting/Items.java +++ b/src/main/java/com/xero/models/accounting/Items.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Items { @JsonProperty("Items") - private List items = null; + private List items = new ArrayList(); public Items items(List items) { this.items = items; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Items {\n"); - sb.append(" items: ").append(toIndentedString(items)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Journal.java b/src/main/java/com/xero/models/accounting/Journal.java index 513b1de7..2cf3c14b 100644 --- a/src/main/java/com/xero/models/accounting/Journal.java +++ b/src/main/java/com/xero/models/accounting/Journal.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -129,13 +129,13 @@ public String toString() { } @JsonCreator - public static SourceTypeEnum fromValue(String text) { + public static SourceTypeEnum fromValue(String value) { for (SourceTypeEnum b : SourceTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -145,7 +145,7 @@ public static SourceTypeEnum fromValue(String text) { @JsonProperty("JournalLines") - private List journalLines = null; + private List journalLines = new ArrayList(); public Journal journalID(UUID journalID) { this.journalID = journalID; @@ -320,7 +320,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Journal {\n"); - sb.append(" journalID: ").append(toIndentedString(journalID)).append("\n"); sb.append(" journalDate: ").append(toIndentedString(journalDate)).append("\n"); sb.append(" journalNumber: ").append(toIndentedString(journalNumber)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/JournalLine.java b/src/main/java/com/xero/models/accounting/JournalLine.java index abe29f53..8aa780b7 100644 --- a/src/main/java/com/xero/models/accounting/JournalLine.java +++ b/src/main/java/com/xero/models/accounting/JournalLine.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -47,7 +47,7 @@ public class JournalLine { @JsonProperty("AccountType") - private AccountType accountType = null; + private AccountType accountType; @JsonProperty("AccountName") @@ -79,7 +79,7 @@ public class JournalLine { @JsonProperty("TrackingCategories") - private List trackingCategories = null; + private List trackingCategories = new ArrayList(); public JournalLine journalLineID(UUID journalLineID) { this.journalLineID = journalLineID; @@ -330,7 +330,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class JournalLine {\n"); - sb.append(" journalLineID: ").append(toIndentedString(journalLineID)).append("\n"); sb.append(" accountID: ").append(toIndentedString(accountID)).append("\n"); sb.append(" accountCode: ").append(toIndentedString(accountCode)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Journals.java b/src/main/java/com/xero/models/accounting/Journals.java index 2029effd..1520449c 100644 --- a/src/main/java/com/xero/models/accounting/Journals.java +++ b/src/main/java/com/xero/models/accounting/Journals.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Journals { @JsonProperty("Journals") - private List journals = null; + private List journals = new ArrayList(); public Journals journals(List journals) { this.journals = journals; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Journals {\n"); - sb.append(" journals: ").append(toIndentedString(journals)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/LineAmountTypes.java b/src/main/java/com/xero/models/accounting/LineAmountTypes.java index 48464551..2098a717 100644 --- a/src/main/java/com/xero/models/accounting/LineAmountTypes.java +++ b/src/main/java/com/xero/models/accounting/LineAmountTypes.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -48,13 +48,13 @@ public String toString() { } @JsonCreator - public static LineAmountTypes fromValue(String text) { + public static LineAmountTypes fromValue(String value) { for (LineAmountTypes b : LineAmountTypes.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/src/main/java/com/xero/models/accounting/LineItem.java b/src/main/java/com/xero/models/accounting/LineItem.java index 5f271b93..a7340d7a 100644 --- a/src/main/java/com/xero/models/accounting/LineItem.java +++ b/src/main/java/com/xero/models/accounting/LineItem.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -70,7 +70,7 @@ public class LineItem { @JsonProperty("Tracking") - private List tracking = null; + private List tracking = new ArrayList(); @JsonProperty("DiscountRate") @@ -338,7 +338,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class LineItem {\n"); - sb.append(" lineItemID: ").append(toIndentedString(lineItemID)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/LineItemTracking.java b/src/main/java/com/xero/models/accounting/LineItemTracking.java index 5c5fa5f5..ac58d3b8 100644 --- a/src/main/java/com/xero/models/accounting/LineItemTracking.java +++ b/src/main/java/com/xero/models/accounting/LineItemTracking.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -120,7 +120,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class LineItemTracking {\n"); - sb.append(" trackingCategoryID: ").append(toIndentedString(trackingCategoryID)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" option: ").append(toIndentedString(option)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/LinkedTransaction.java b/src/main/java/com/xero/models/accounting/LinkedTransaction.java index 6049d789..f2d9ba32 100644 --- a/src/main/java/com/xero/models/accounting/LinkedTransaction.java +++ b/src/main/java/com/xero/models/accounting/LinkedTransaction.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -88,13 +88,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -125,13 +125,13 @@ public String toString() { } @JsonCreator - public static TypeEnum fromValue(String text) { + public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -168,13 +168,13 @@ public String toString() { } @JsonCreator - public static SourceTransactionTypeCodeEnum fromValue(String text) { + public static SourceTransactionTypeCodeEnum fromValue(String value) { for (SourceTransactionTypeCodeEnum b : SourceTransactionTypeCodeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -184,7 +184,7 @@ public static SourceTransactionTypeCodeEnum fromValue(String text) { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); public LinkedTransaction sourceTransactionID(UUID sourceTransactionID) { this.sourceTransactionID = sourceTransactionID; @@ -425,7 +425,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class LinkedTransaction {\n"); - sb.append(" sourceTransactionID: ").append(toIndentedString(sourceTransactionID)).append("\n"); sb.append(" sourceLineItemID: ").append(toIndentedString(sourceLineItemID)).append("\n"); sb.append(" contactID: ").append(toIndentedString(contactID)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/LinkedTransactions.java b/src/main/java/com/xero/models/accounting/LinkedTransactions.java index 8d180cdb..5ddf5c5c 100644 --- a/src/main/java/com/xero/models/accounting/LinkedTransactions.java +++ b/src/main/java/com/xero/models/accounting/LinkedTransactions.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class LinkedTransactions { @JsonProperty("LinkedTransactions") - private List linkedTransactions = null; + private List linkedTransactions = new ArrayList(); public LinkedTransactions linkedTransactions(List linkedTransactions) { this.linkedTransactions = linkedTransactions; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class LinkedTransactions {\n"); - sb.append(" linkedTransactions: ").append(toIndentedString(linkedTransactions)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/ManualJournal.java b/src/main/java/com/xero/models/accounting/ManualJournal.java index 3915492f..24657b25 100644 --- a/src/main/java/com/xero/models/accounting/ManualJournal.java +++ b/src/main/java/com/xero/models/accounting/ManualJournal.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -51,7 +51,7 @@ public class ManualJournal { @JsonProperty("LineAmountTypes") - private LineAmountTypes lineAmountTypes = null; + private LineAmountTypes lineAmountTypes; /** * See Manual Journal Status Codes @@ -82,13 +82,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -118,15 +118,15 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Warnings") - private List warnings = null; + private List warnings = new ArrayList(); @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); @JsonProperty("Attachments") - private List attachments = null; + private List attachments = new ArrayList(); public ManualJournal narration(String narration) { this.narration = narration; @@ -408,7 +408,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ManualJournal {\n"); - sb.append(" narration: ").append(toIndentedString(narration)).append("\n"); sb.append(" journalLines: ").append(toIndentedString(journalLines)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/ManualJournalLine.java b/src/main/java/com/xero/models/accounting/ManualJournalLine.java index e92ae2d5..b66e89e0 100644 --- a/src/main/java/com/xero/models/accounting/ManualJournalLine.java +++ b/src/main/java/com/xero/models/accounting/ManualJournalLine.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ public class ManualJournalLine { @JsonProperty("Tracking") - private List tracking = null; + private List tracking = new ArrayList(); @JsonProperty("TaxAmount") @@ -175,7 +175,7 @@ public ManualJournalLine isBlank(Boolean isBlank) { * is the line blank * @return isBlank **/ - @ApiModelProperty(value = "is the line blank") + @ApiModelProperty(example = "false", value = "is the line blank") public Boolean getIsBlank() { return isBlank; } @@ -213,7 +213,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ManualJournalLine {\n"); - sb.append(" lineAmount: ").append(toIndentedString(lineAmount)).append("\n"); sb.append(" accountCode: ").append(toIndentedString(accountCode)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/ManualJournals.java b/src/main/java/com/xero/models/accounting/ManualJournals.java index 48e9f523..693712d5 100644 --- a/src/main/java/com/xero/models/accounting/ManualJournals.java +++ b/src/main/java/com/xero/models/accounting/ManualJournals.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class ManualJournals { @JsonProperty("ManualJournals") - private List manualJournals = null; + private List manualJournals = new ArrayList(); public ManualJournals manualJournals(List manualJournals) { this.manualJournals = manualJournals; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ManualJournals {\n"); - sb.append(" manualJournals: ").append(toIndentedString(manualJournals)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/OnlineInvoice.java b/src/main/java/com/xero/models/accounting/OnlineInvoice.java index 61ee00db..4954f94e 100644 --- a/src/main/java/com/xero/models/accounting/OnlineInvoice.java +++ b/src/main/java/com/xero/models/accounting/OnlineInvoice.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -73,7 +73,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class OnlineInvoice {\n"); - sb.append(" onlineInvoiceUrl: ").append(toIndentedString(onlineInvoiceUrl)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/OnlineInvoices.java b/src/main/java/com/xero/models/accounting/OnlineInvoices.java index 2e0ef538..a127fa05 100644 --- a/src/main/java/com/xero/models/accounting/OnlineInvoices.java +++ b/src/main/java/com/xero/models/accounting/OnlineInvoices.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class OnlineInvoices { @JsonProperty("OnlineInvoices") - private List onlineInvoices = null; + private List onlineInvoices = new ArrayList(); public OnlineInvoices onlineInvoices(List onlineInvoices) { this.onlineInvoices = onlineInvoices; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class OnlineInvoices {\n"); - sb.append(" onlineInvoices: ").append(toIndentedString(onlineInvoices)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Organisation.java b/src/main/java/com/xero/models/accounting/Organisation.java index 82ec0536..07c93238 100644 --- a/src/main/java/com/xero/models/accounting/Organisation.java +++ b/src/main/java/com/xero/models/accounting/Organisation.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -101,13 +101,13 @@ public String toString() { } @JsonCreator - public static VersionEnum fromValue(String text) { + public static VersionEnum fromValue(String value) { for (VersionEnum b : VersionEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -152,13 +152,13 @@ public String toString() { } @JsonCreator - public static OrganisationTypeEnum fromValue(String text) { + public static OrganisationTypeEnum fromValue(String value) { for (OrganisationTypeEnum b : OrganisationTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -168,11 +168,11 @@ public static OrganisationTypeEnum fromValue(String text) { @JsonProperty("BaseCurrency") - private CurrencyCode baseCurrency = null; + private CurrencyCode baseCurrency; @JsonProperty("CountryCode") - private CountryCode countryCode = null; + private CountryCode countryCode; @JsonProperty("IsDemoCompany") @@ -235,13 +235,13 @@ public String toString() { } @JsonCreator - public static SalesTaxBasisEnum fromValue(String text) { + public static SalesTaxBasisEnum fromValue(String value) { for (SalesTaxBasisEnum b : SalesTaxBasisEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -298,13 +298,13 @@ public String toString() { } @JsonCreator - public static SalesTaxPeriodEnum fromValue(String text) { + public static SalesTaxPeriodEnum fromValue(String value) { for (SalesTaxPeriodEnum b : SalesTaxPeriodEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -334,7 +334,7 @@ public static SalesTaxPeriodEnum fromValue(String text) { @JsonProperty("Timezone") - private TimeZone timezone = null; + private TimeZone timezone; /** * Organisation Type @@ -373,13 +373,13 @@ public String toString() { } @JsonCreator - public static OrganisationEntityTypeEnum fromValue(String text) { + public static OrganisationEntityTypeEnum fromValue(String value) { for (OrganisationEntityTypeEnum b : OrganisationEntityTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -434,13 +434,13 @@ public String toString() { } @JsonCreator - public static PropertyClassEnum fromValue(String text) { + public static PropertyClassEnum fromValue(String value) { for (PropertyClassEnum b : PropertyClassEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -473,13 +473,13 @@ public String toString() { } @JsonCreator - public static EditionEnum fromValue(String text) { + public static EditionEnum fromValue(String value) { for (EditionEnum b : EditionEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -493,15 +493,15 @@ public static EditionEnum fromValue(String text) { @JsonProperty("Addresses") - private List
addresses = null; + private List
addresses = new ArrayList
(); @JsonProperty("Phones") - private List phones = null; + private List phones = new ArrayList(); @JsonProperty("ExternalLinks") - private List externalLinks = null; + private List externalLinks = new ArrayList(); @JsonProperty("PaymentTerms") @@ -1161,7 +1161,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Organisation {\n"); - sb.append(" organisationID: ").append(toIndentedString(organisationID)).append("\n"); sb.append(" apIKey: ").append(toIndentedString(apIKey)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Organisations.java b/src/main/java/com/xero/models/accounting/Organisations.java index c4c8f0b5..ce4907b1 100644 --- a/src/main/java/com/xero/models/accounting/Organisations.java +++ b/src/main/java/com/xero/models/accounting/Organisations.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Organisations { @JsonProperty("Organisations") - private List organisations = null; + private List organisations = new ArrayList(); public Organisations organisations(List organisations) { this.organisations = organisations; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Organisations {\n"); - sb.append(" organisations: ").append(toIndentedString(organisations)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Overpayment.java b/src/main/java/com/xero/models/accounting/Overpayment.java index 905798ab..da18a76b 100644 --- a/src/main/java/com/xero/models/accounting/Overpayment.java +++ b/src/main/java/com/xero/models/accounting/Overpayment.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -65,13 +65,13 @@ public String toString() { } @JsonCreator - public static TypeEnum fromValue(String text) { + public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -114,13 +114,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -130,11 +130,11 @@ public static StatusEnum fromValue(String text) { @JsonProperty("LineAmountTypes") - private LineAmountTypes lineAmountTypes = null; + private LineAmountTypes lineAmountTypes; @JsonProperty("LineItems") - private List lineItems = null; + private List lineItems = new ArrayList(); @JsonProperty("SubTotal") @@ -154,7 +154,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("CurrencyCode") - private CurrencyCode currencyCode = null; + private CurrencyCode currencyCode; @JsonProperty("OverpaymentID") @@ -170,11 +170,11 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Allocations") - private List allocations = null; + private List allocations = new ArrayList(); @JsonProperty("Payments") - private List payments = null; + private List payments = new ArrayList(); @JsonProperty("HasAttachments") @@ -182,7 +182,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Attachments") - private List attachments = null; + private List attachments = new ArrayList(); public Overpayment type(TypeEnum type) { this.type = type; @@ -580,7 +580,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Overpayment {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Overpayments.java b/src/main/java/com/xero/models/accounting/Overpayments.java index daad2f56..d5fdb43b 100644 --- a/src/main/java/com/xero/models/accounting/Overpayments.java +++ b/src/main/java/com/xero/models/accounting/Overpayments.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Overpayments { @JsonProperty("Overpayments") - private List overpayments = null; + private List overpayments = new ArrayList(); public Overpayments overpayments(List overpayments) { this.overpayments = overpayments; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Overpayments {\n"); - sb.append(" overpayments: ").append(toIndentedString(overpayments)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Payment.java b/src/main/java/com/xero/models/accounting/Payment.java index 95e958ab..120720a1 100644 --- a/src/main/java/com/xero/models/accounting/Payment.java +++ b/src/main/java/com/xero/models/accounting/Payment.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -116,13 +116,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -167,13 +167,13 @@ public String toString() { } @JsonCreator - public static PaymentTypeEnum fromValue(String text) { + public static PaymentTypeEnum fromValue(String value) { for (PaymentTypeEnum b : PaymentTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -211,7 +211,7 @@ public static PaymentTypeEnum fromValue(String text) { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); public Payment invoice(Invoice invoice) { this.invoice = invoice; @@ -662,7 +662,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Payment {\n"); - sb.append(" invoice: ").append(toIndentedString(invoice)).append("\n"); sb.append(" creditNote: ").append(toIndentedString(creditNote)).append("\n"); sb.append(" prepayment: ").append(toIndentedString(prepayment)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/PaymentService.java b/src/main/java/com/xero/models/accounting/PaymentService.java index b737b287..8b8dc01e 100644 --- a/src/main/java/com/xero/models/accounting/PaymentService.java +++ b/src/main/java/com/xero/models/accounting/PaymentService.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -54,7 +54,7 @@ public class PaymentService { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); public PaymentService paymentServiceID(UUID paymentServiceID) { this.paymentServiceID = paymentServiceID; @@ -200,7 +200,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PaymentService {\n"); - sb.append(" paymentServiceID: ").append(toIndentedString(paymentServiceID)).append("\n"); sb.append(" paymentServiceName: ").append(toIndentedString(paymentServiceName)).append("\n"); sb.append(" paymentServiceUrl: ").append(toIndentedString(paymentServiceUrl)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/PaymentServices.java b/src/main/java/com/xero/models/accounting/PaymentServices.java index b1b2139c..c0c60db0 100644 --- a/src/main/java/com/xero/models/accounting/PaymentServices.java +++ b/src/main/java/com/xero/models/accounting/PaymentServices.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class PaymentServices { @JsonProperty("PaymentServices") - private List paymentServices = null; + private List paymentServices = new ArrayList(); public PaymentServices paymentServices(List paymentServices) { this.paymentServices = paymentServices; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PaymentServices {\n"); - sb.append(" paymentServices: ").append(toIndentedString(paymentServices)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/PaymentTerm.java b/src/main/java/com/xero/models/accounting/PaymentTerm.java index 047c722e..9bead8d3 100644 --- a/src/main/java/com/xero/models/accounting/PaymentTerm.java +++ b/src/main/java/com/xero/models/accounting/PaymentTerm.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -97,7 +97,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PaymentTerm {\n"); - sb.append(" bills: ").append(toIndentedString(bills)).append("\n"); sb.append(" sales: ").append(toIndentedString(sales)).append("\n"); sb.append("}"); diff --git a/src/main/java/com/xero/models/accounting/PaymentTermType.java b/src/main/java/com/xero/models/accounting/PaymentTermType.java index 95a823d4..b2770734 100644 --- a/src/main/java/com/xero/models/accounting/PaymentTermType.java +++ b/src/main/java/com/xero/models/accounting/PaymentTermType.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,13 +49,13 @@ public String toString() { } @JsonCreator - public static PaymentTermType fromValue(String text) { + public static PaymentTermType fromValue(String value) { for (PaymentTermType b : PaymentTermType.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/src/main/java/com/xero/models/accounting/Payments.java b/src/main/java/com/xero/models/accounting/Payments.java index 4a84d241..32e620f8 100644 --- a/src/main/java/com/xero/models/accounting/Payments.java +++ b/src/main/java/com/xero/models/accounting/Payments.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Payments { @JsonProperty("Payments") - private List payments = null; + private List payments = new ArrayList(); public Payments payments(List payments) { this.payments = payments; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Payments {\n"); - sb.append(" payments: ").append(toIndentedString(payments)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Phone.java b/src/main/java/com/xero/models/accounting/Phone.java index 6aa4feb3..ab9750db 100644 --- a/src/main/java/com/xero/models/accounting/Phone.java +++ b/src/main/java/com/xero/models/accounting/Phone.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -59,13 +59,13 @@ public String toString() { } @JsonCreator - public static PhoneTypeEnum fromValue(String text) { + public static PhoneTypeEnum fromValue(String value) { for (PhoneTypeEnum b : PhoneTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -183,7 +183,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Phone {\n"); - sb.append(" phoneType: ").append(toIndentedString(phoneType)).append("\n"); sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); sb.append(" phoneAreaCode: ").append(toIndentedString(phoneAreaCode)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Prepayment.java b/src/main/java/com/xero/models/accounting/Prepayment.java index d1e45c6e..6606c382 100644 --- a/src/main/java/com/xero/models/accounting/Prepayment.java +++ b/src/main/java/com/xero/models/accounting/Prepayment.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -64,13 +64,13 @@ public String toString() { } @JsonCreator - public static TypeEnum fromValue(String text) { + public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -113,13 +113,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -129,11 +129,11 @@ public static StatusEnum fromValue(String text) { @JsonProperty("LineAmountTypes") - private LineAmountTypes lineAmountTypes = null; + private LineAmountTypes lineAmountTypes; @JsonProperty("LineItems") - private List lineItems = null; + private List lineItems = new ArrayList(); @JsonProperty("SubTotal") @@ -153,7 +153,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("CurrencyCode") - private CurrencyCode currencyCode = null; + private CurrencyCode currencyCode; @JsonProperty("PrepaymentID") @@ -169,7 +169,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Allocations") - private List allocations = null; + private List allocations = new ArrayList(); @JsonProperty("HasAttachments") @@ -177,7 +177,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Attachments") - private List attachments = null; + private List attachments = new ArrayList(); public Prepayment type(TypeEnum type) { this.type = type; @@ -548,7 +548,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Prepayment {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Prepayments.java b/src/main/java/com/xero/models/accounting/Prepayments.java index 8ff84dfe..f2eb7824 100644 --- a/src/main/java/com/xero/models/accounting/Prepayments.java +++ b/src/main/java/com/xero/models/accounting/Prepayments.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Prepayments { @JsonProperty("Prepayments") - private List prepayments = null; + private List prepayments = new ArrayList(); public Prepayments prepayments(List prepayments) { this.prepayments = prepayments; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Prepayments {\n"); - sb.append(" prepayments: ").append(toIndentedString(prepayments)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Purchase.java b/src/main/java/com/xero/models/accounting/Purchase.java index f98034f6..07db1394 100644 --- a/src/main/java/com/xero/models/accounting/Purchase.java +++ b/src/main/java/com/xero/models/accounting/Purchase.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -142,7 +142,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Purchase {\n"); - sb.append(" unitPrice: ").append(toIndentedString(unitPrice)).append("\n"); sb.append(" accountCode: ").append(toIndentedString(accountCode)).append("\n"); sb.append(" coGSAccountCode: ").append(toIndentedString(coGSAccountCode)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/PurchaseOrder.java b/src/main/java/com/xero/models/accounting/PurchaseOrder.java index 210d53ff..ec020591 100644 --- a/src/main/java/com/xero/models/accounting/PurchaseOrder.java +++ b/src/main/java/com/xero/models/accounting/PurchaseOrder.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -57,7 +57,7 @@ public class PurchaseOrder { @JsonProperty("LineAmountTypes") - private LineAmountTypes lineAmountTypes = null; + private LineAmountTypes lineAmountTypes; @JsonProperty("PurchaseOrderNumber") @@ -73,7 +73,7 @@ public class PurchaseOrder { @JsonProperty("CurrencyCode") - private CurrencyCode currencyCode = null; + private CurrencyCode currencyCode; /** * See Purchase Order Status Codes @@ -106,13 +106,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -182,15 +182,15 @@ public static StatusEnum fromValue(String text) { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); @JsonProperty("Warnings") - private List warnings = null; + private List warnings = new ArrayList(); @JsonProperty("Attachments") - private List attachments = null; + private List attachments = new ArrayList(); public PurchaseOrder contact(Contact contact) { this.contact = contact; @@ -712,7 +712,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PurchaseOrder {\n"); - sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/PurchaseOrders.java b/src/main/java/com/xero/models/accounting/PurchaseOrders.java index 910b0af5..a7e5f4e8 100644 --- a/src/main/java/com/xero/models/accounting/PurchaseOrders.java +++ b/src/main/java/com/xero/models/accounting/PurchaseOrders.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class PurchaseOrders { @JsonProperty("PurchaseOrders") - private List purchaseOrders = null; + private List purchaseOrders = new ArrayList(); public PurchaseOrders purchaseOrders(List purchaseOrders) { this.purchaseOrders = purchaseOrders; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PurchaseOrders {\n"); - sb.append(" purchaseOrders: ").append(toIndentedString(purchaseOrders)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Receipt.java b/src/main/java/com/xero/models/accounting/Receipt.java index 6c732e92..1b5d2600 100644 --- a/src/main/java/com/xero/models/accounting/Receipt.java +++ b/src/main/java/com/xero/models/accounting/Receipt.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -61,7 +61,7 @@ public class Receipt { @JsonProperty("LineAmountTypes") - private LineAmountTypes lineAmountTypes = null; + private LineAmountTypes lineAmountTypes; @JsonProperty("SubTotal") @@ -108,13 +108,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -140,11 +140,11 @@ public static StatusEnum fromValue(String text) { @JsonProperty("ValidationErrors") - private List validationErrors = null; + private List validationErrors = new ArrayList(); @JsonProperty("Attachments") - private List attachments = null; + private List attachments = new ArrayList(); public Receipt date(LocalDate date) { this.date = date; @@ -476,7 +476,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Receipt {\n"); - sb.append(" date: ").append(toIndentedString(date)).append("\n"); sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); sb.append(" lineitems: ").append(toIndentedString(lineitems)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Receipts.java b/src/main/java/com/xero/models/accounting/Receipts.java index c385a814..fcdd7d22 100644 --- a/src/main/java/com/xero/models/accounting/Receipts.java +++ b/src/main/java/com/xero/models/accounting/Receipts.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Receipts { @JsonProperty("Receipts") - private List receipts = null; + private List receipts = new ArrayList(); public Receipts receipts(List receipts) { this.receipts = receipts; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Receipts {\n"); - sb.append(" receipts: ").append(toIndentedString(receipts)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/RepeatingInvoice.java b/src/main/java/com/xero/models/accounting/RepeatingInvoice.java index 4ff880df..26887660 100644 --- a/src/main/java/com/xero/models/accounting/RepeatingInvoice.java +++ b/src/main/java/com/xero/models/accounting/RepeatingInvoice.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -62,13 +62,13 @@ public String toString() { } @JsonCreator - public static TypeEnum fromValue(String text) { + public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -86,11 +86,11 @@ public static TypeEnum fromValue(String text) { @JsonProperty("LineItems") - private List lineItems = null; + private List lineItems = new ArrayList(); @JsonProperty("LineAmountTypes") - private LineAmountTypes lineAmountTypes = null; + private LineAmountTypes lineAmountTypes; @JsonProperty("Reference") @@ -102,7 +102,7 @@ public static TypeEnum fromValue(String text) { @JsonProperty("CurrencyCode") - private CurrencyCode currencyCode = null; + private CurrencyCode currencyCode; /** * One of the following - DRAFT or AUTHORISED – See Invoice Status Codes @@ -129,13 +129,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -169,7 +169,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Attachments") - private List attachments = null; + private List attachments = new ArrayList(); public RepeatingInvoice type(TypeEnum type) { this.type = type; @@ -513,7 +513,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class RepeatingInvoice {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); sb.append(" schedule: ").append(toIndentedString(schedule)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/RepeatingInvoices.java b/src/main/java/com/xero/models/accounting/RepeatingInvoices.java index 1b3ba222..b1f99816 100644 --- a/src/main/java/com/xero/models/accounting/RepeatingInvoices.java +++ b/src/main/java/com/xero/models/accounting/RepeatingInvoices.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class RepeatingInvoices { @JsonProperty("RepeatingInvoices") - private List repeatingInvoices = null; + private List repeatingInvoices = new ArrayList(); public RepeatingInvoices repeatingInvoices(List repeatingInvoices) { this.repeatingInvoices = repeatingInvoices; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class RepeatingInvoices {\n"); - sb.append(" repeatingInvoices: ").append(toIndentedString(repeatingInvoices)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Report.java b/src/main/java/com/xero/models/accounting/Report.java index 54366391..55350c12 100644 --- a/src/main/java/com/xero/models/accounting/Report.java +++ b/src/main/java/com/xero/models/accounting/Report.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -63,13 +63,13 @@ public String toString() { } @JsonCreator - public static ReportTypeEnum fromValue(String text) { + public static ReportTypeEnum fromValue(String value) { for (ReportTypeEnum b : ReportTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -91,7 +91,7 @@ public static ReportTypeEnum fromValue(String text) { @JsonProperty("Contacts") - private List contacts = null; + private List contacts = new ArrayList(); public Report reportID(String reportID) { this.reportID = reportID; @@ -256,7 +256,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Report {\n"); - sb.append(" reportID: ").append(toIndentedString(reportID)).append("\n"); sb.append(" reportName: ").append(toIndentedString(reportName)).append("\n"); sb.append(" reportType: ").append(toIndentedString(reportType)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/ReportAttribute.java b/src/main/java/com/xero/models/accounting/ReportAttribute.java index 936f7f33..371c8688 100644 --- a/src/main/java/com/xero/models/accounting/ReportAttribute.java +++ b/src/main/java/com/xero/models/accounting/ReportAttribute.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -96,7 +96,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ReportAttribute {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append("}"); diff --git a/src/main/java/com/xero/models/accounting/ReportCell.java b/src/main/java/com/xero/models/accounting/ReportCell.java index ef5ffcf0..d0fbde43 100644 --- a/src/main/java/com/xero/models/accounting/ReportCell.java +++ b/src/main/java/com/xero/models/accounting/ReportCell.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -37,7 +37,7 @@ public class ReportCell { @JsonProperty("Attributes") - private List attributes = null; + private List attributes = new ArrayList(); public ReportCell value(String value) { this.value = value; @@ -107,7 +107,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ReportCell {\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); sb.append("}"); diff --git a/src/main/java/com/xero/models/accounting/ReportFields.java b/src/main/java/com/xero/models/accounting/ReportFields.java index 08b94afb..250e10e9 100644 --- a/src/main/java/com/xero/models/accounting/ReportFields.java +++ b/src/main/java/com/xero/models/accounting/ReportFields.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -119,7 +119,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ReportFields {\n"); - sb.append(" fieldID: ").append(toIndentedString(fieldID)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/ReportRow.java b/src/main/java/com/xero/models/accounting/ReportRow.java index 38edcd57..623bcb94 100644 --- a/src/main/java/com/xero/models/accounting/ReportRow.java +++ b/src/main/java/com/xero/models/accounting/ReportRow.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -34,7 +34,7 @@ public class ReportRow { @JsonProperty("RowType") - private RowType rowType = null; + private RowType rowType; @JsonProperty("Title") @@ -42,7 +42,7 @@ public class ReportRow { @JsonProperty("Cells") - private List cells = null; + private List cells = new ArrayList(); public ReportRow rowType(RowType rowType) { this.rowType = rowType; @@ -131,7 +131,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ReportRow {\n"); - sb.append(" rowType: ").append(toIndentedString(rowType)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" cells: ").append(toIndentedString(cells)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/ReportRows.java b/src/main/java/com/xero/models/accounting/ReportRows.java index 077ac0a6..6454a0cf 100644 --- a/src/main/java/com/xero/models/accounting/ReportRows.java +++ b/src/main/java/com/xero/models/accounting/ReportRows.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -35,7 +35,7 @@ public class ReportRows { @JsonProperty("RowType") - private RowType rowType = null; + private RowType rowType; @JsonProperty("Title") @@ -43,11 +43,11 @@ public class ReportRows { @JsonProperty("Cells") - private List cells = null; + private List cells = new ArrayList(); @JsonProperty("Rows") - private List rows = null; + private List rows = new ArrayList(); public ReportRows rowType(RowType rowType) { this.rowType = rowType; @@ -163,7 +163,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ReportRows {\n"); - sb.append(" rowType: ").append(toIndentedString(rowType)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" cells: ").append(toIndentedString(cells)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/ReportWithRow.java b/src/main/java/com/xero/models/accounting/ReportWithRow.java index 92b0c5ee..33ba4acc 100644 --- a/src/main/java/com/xero/models/accounting/ReportWithRow.java +++ b/src/main/java/com/xero/models/accounting/ReportWithRow.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -51,7 +51,7 @@ public class ReportWithRow { @JsonProperty("ReportTitles") - private List reportTitles = null; + private List reportTitles = new ArrayList(); @JsonProperty("ReportDate") @@ -63,11 +63,11 @@ public class ReportWithRow { @JsonProperty("Rows") - private List rows = null; + private List rows = new ArrayList(); @JsonProperty("Fields") - private List fields = null; + private List fields = new ArrayList(); public ReportWithRow reportID(String reportID) { this.reportID = reportID; @@ -286,7 +286,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ReportWithRow {\n"); - sb.append(" reportID: ").append(toIndentedString(reportID)).append("\n"); sb.append(" reportName: ").append(toIndentedString(reportName)).append("\n"); sb.append(" reportTitle: ").append(toIndentedString(reportTitle)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/ReportWithRows.java b/src/main/java/com/xero/models/accounting/ReportWithRows.java index 42b8293c..d588d022 100644 --- a/src/main/java/com/xero/models/accounting/ReportWithRows.java +++ b/src/main/java/com/xero/models/accounting/ReportWithRows.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class ReportWithRows { @JsonProperty("Reports") - private List reports = null; + private List reports = new ArrayList(); public ReportWithRows reports(List reports) { this.reports = reports; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ReportWithRows {\n"); - sb.append(" reports: ").append(toIndentedString(reports)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/Reports.java b/src/main/java/com/xero/models/accounting/Reports.java index 8c1c5684..fe8d74f6 100644 --- a/src/main/java/com/xero/models/accounting/Reports.java +++ b/src/main/java/com/xero/models/accounting/Reports.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Reports { @JsonProperty("Reports") - private List reports = null; + private List reports = new ArrayList(); public Reports reports(List reports) { this.reports = reports; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Reports {\n"); - sb.append(" reports: ").append(toIndentedString(reports)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/RequestEmpty.java b/src/main/java/com/xero/models/accounting/RequestEmpty.java index 7622d1c5..0df84f4e 100644 --- a/src/main/java/com/xero/models/accounting/RequestEmpty.java +++ b/src/main/java/com/xero/models/accounting/RequestEmpty.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -73,7 +73,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class RequestEmpty {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/RowType.java b/src/main/java/com/xero/models/accounting/RowType.java index 169d245d..69eb1cd5 100644 --- a/src/main/java/com/xero/models/accounting/RowType.java +++ b/src/main/java/com/xero/models/accounting/RowType.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,13 +49,13 @@ public String toString() { } @JsonCreator - public static RowType fromValue(String text) { + public static RowType fromValue(String value) { for (RowType b : RowType.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/src/main/java/com/xero/models/accounting/Schedule.java b/src/main/java/com/xero/models/accounting/Schedule.java index 35adf516..6e5c86a8 100644 --- a/src/main/java/com/xero/models/accounting/Schedule.java +++ b/src/main/java/com/xero/models/accounting/Schedule.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -58,13 +58,13 @@ public String toString() { } @JsonCreator - public static UnitEnum fromValue(String text) { + public static UnitEnum fromValue(String value) { for (UnitEnum b : UnitEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -105,13 +105,13 @@ public String toString() { } @JsonCreator - public static DueDateTypeEnum fromValue(String text) { + public static DueDateTypeEnum fromValue(String value) { for (DueDateTypeEnum b : DueDateTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -286,7 +286,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Schedule {\n"); - sb.append(" period: ").append(toIndentedString(period)).append("\n"); sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); sb.append(" dueDate: ").append(toIndentedString(dueDate)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/TaxComponent.java b/src/main/java/com/xero/models/accounting/TaxComponent.java index c09d0a6b..afd018fd 100644 --- a/src/main/java/com/xero/models/accounting/TaxComponent.java +++ b/src/main/java/com/xero/models/accounting/TaxComponent.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -142,7 +142,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TaxComponent {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" rate: ").append(toIndentedString(rate)).append("\n"); sb.append(" isCompound: ").append(toIndentedString(isCompound)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/TaxRate.java b/src/main/java/com/xero/models/accounting/TaxRate.java index 1b0d4734..fbb38608 100644 --- a/src/main/java/com/xero/models/accounting/TaxRate.java +++ b/src/main/java/com/xero/models/accounting/TaxRate.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -41,7 +41,7 @@ public class TaxRate { @JsonProperty("TaxComponents") - private List taxComponents = null; + private List taxComponents = new ArrayList(); /** * See Status Codes @@ -70,13 +70,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -137,13 +137,13 @@ public String toString() { } @JsonCreator - public static ReportTaxTypeEnum fromValue(String text) { + public static ReportTaxTypeEnum fromValue(String value) { for (ReportTaxTypeEnum b : ReportTaxTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -374,7 +374,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TaxRate {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" taxType: ").append(toIndentedString(taxType)).append("\n"); sb.append(" taxComponents: ").append(toIndentedString(taxComponents)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/TaxRates.java b/src/main/java/com/xero/models/accounting/TaxRates.java index 064a2ddf..10fd7dd1 100644 --- a/src/main/java/com/xero/models/accounting/TaxRates.java +++ b/src/main/java/com/xero/models/accounting/TaxRates.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class TaxRates { @JsonProperty("TaxRates") - private List taxRates = null; + private List taxRates = new ArrayList(); public TaxRates taxRates(List taxRates) { this.taxRates = taxRates; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TaxRates {\n"); - sb.append(" taxRates: ").append(toIndentedString(taxRates)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/TaxType.java b/src/main/java/com/xero/models/accounting/TaxType.java index 47b6162c..a43ffe58 100644 --- a/src/main/java/com/xero/models/accounting/TaxType.java +++ b/src/main/java/com/xero/models/accounting/TaxType.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -146,13 +146,13 @@ public String toString() { } @JsonCreator - public static TaxType fromValue(String text) { + public static TaxType fromValue(String value) { for (TaxType b : TaxType.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/src/main/java/com/xero/models/accounting/TenNinteyNineContact.java b/src/main/java/com/xero/models/accounting/TenNinteyNineContact.java index f7cca3d2..182dc2e9 100644 --- a/src/main/java/com/xero/models/accounting/TenNinteyNineContact.java +++ b/src/main/java/com/xero/models/accounting/TenNinteyNineContact.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -557,7 +557,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TenNinteyNineContact {\n"); - sb.append(" box1: ").append(toIndentedString(box1)).append("\n"); sb.append(" box2: ").append(toIndentedString(box2)).append("\n"); sb.append(" box3: ").append(toIndentedString(box3)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/TimeZone.java b/src/main/java/com/xero/models/accounting/TimeZone.java index 2168fd53..7044b0e5 100644 --- a/src/main/java/com/xero/models/accounting/TimeZone.java +++ b/src/main/java/com/xero/models/accounting/TimeZone.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -256,13 +256,13 @@ public String toString() { } @JsonCreator - public static TimeZone fromValue(String text) { + public static TimeZone fromValue(String value) { for (TimeZone b : TimeZone.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/src/main/java/com/xero/models/accounting/TrackingCategories.java b/src/main/java/com/xero/models/accounting/TrackingCategories.java index e6367543..e6837d44 100644 --- a/src/main/java/com/xero/models/accounting/TrackingCategories.java +++ b/src/main/java/com/xero/models/accounting/TrackingCategories.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class TrackingCategories { @JsonProperty("TrackingCategories") - private List trackingCategories = null; + private List trackingCategories = new ArrayList(); public TrackingCategories trackingCategories(List trackingCategories) { this.trackingCategories = trackingCategories; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TrackingCategories {\n"); - sb.append(" trackingCategories: ").append(toIndentedString(trackingCategories)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/TrackingCategory.java b/src/main/java/com/xero/models/accounting/TrackingCategory.java index aae66469..e039e83a 100644 --- a/src/main/java/com/xero/models/accounting/TrackingCategory.java +++ b/src/main/java/com/xero/models/accounting/TrackingCategory.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -75,13 +75,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -91,7 +91,7 @@ public static StatusEnum fromValue(String text) { @JsonProperty("Options") - private List options = null; + private List options = new ArrayList(); public TrackingCategory trackingCategoryID(UUID trackingCategoryID) { this.trackingCategoryID = trackingCategoryID; @@ -237,7 +237,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TrackingCategory {\n"); - sb.append(" trackingCategoryID: ").append(toIndentedString(trackingCategoryID)).append("\n"); sb.append(" trackingOptionID: ").append(toIndentedString(trackingOptionID)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/TrackingOption.java b/src/main/java/com/xero/models/accounting/TrackingOption.java index fb188a83..c1f91378 100644 --- a/src/main/java/com/xero/models/accounting/TrackingOption.java +++ b/src/main/java/com/xero/models/accounting/TrackingOption.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -64,13 +64,13 @@ public String toString() { } @JsonCreator - public static StatusEnum fromValue(String text) { + public static StatusEnum fromValue(String value) { for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -180,7 +180,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TrackingOption {\n"); - sb.append(" trackingOptionID: ").append(toIndentedString(trackingOptionID)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/TrackingOptions.java b/src/main/java/com/xero/models/accounting/TrackingOptions.java index 05c385ea..5e344dc0 100644 --- a/src/main/java/com/xero/models/accounting/TrackingOptions.java +++ b/src/main/java/com/xero/models/accounting/TrackingOptions.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class TrackingOptions { @JsonProperty("Options") - private List options = null; + private List options = new ArrayList(); public TrackingOptions options(List options) { this.options = options; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TrackingOptions {\n"); - sb.append(" options: ").append(toIndentedString(options)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/User.java b/src/main/java/com/xero/models/accounting/User.java index 2951a9cc..cd56d02b 100644 --- a/src/main/java/com/xero/models/accounting/User.java +++ b/src/main/java/com/xero/models/accounting/User.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -87,13 +87,13 @@ public String toString() { } @JsonCreator - public static OrganisationRoleEnum fromValue(String text) { + public static OrganisationRoleEnum fromValue(String value) { for (OrganisationRoleEnum b : OrganisationRoleEnum.values()) { - if (String.valueOf(b.value).equals(text)) { + if (b.value.equals(value)) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -256,7 +256,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class User {\n"); - sb.append(" userID: ").append(toIndentedString(userID)).append("\n"); sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n"); sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Users.java b/src/main/java/com/xero/models/accounting/Users.java index e4be429d..16295bb0 100644 --- a/src/main/java/com/xero/models/accounting/Users.java +++ b/src/main/java/com/xero/models/accounting/Users.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,7 +33,7 @@ public class Users { @JsonProperty("Users") - private List users = null; + private List users = new ArrayList(); public Users users(List users) { this.users = users; @@ -84,7 +84,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Users {\n"); - sb.append(" users: ").append(toIndentedString(users)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/accounting/ValidationError.java b/src/main/java/com/xero/models/accounting/ValidationError.java index d052deba..fe8a8730 100644 --- a/src/main/java/com/xero/models/accounting/ValidationError.java +++ b/src/main/java/com/xero/models/accounting/ValidationError.java @@ -2,7 +2,7 @@ * Accounting API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 2.0.0 + * The version of the OpenAPI document: 2.0.0 * Contact: api@xero.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -73,7 +73,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ValidationError {\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/test/.gitignore b/src/test/.gitignore deleted file mode 100644 index 9bb88d37..00000000 --- a/src/test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.DS_Store diff --git a/src/test/java/com/xero/api/XeroClientTest.java b/src/test/java/com/xero/api/XeroClientTest.java deleted file mode 100644 index 418345d2..00000000 --- a/src/test/java/com/xero/api/XeroClientTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.xero.api; - -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public class XeroClientTest { - - private XeroClient xeroClient; - - @Before - public void setup() { - xeroClient = new XeroClient(null, null); - } - - @Test - public void testNormalizeFileNameForURI() { - assertEquals("1527238288566.png", xeroClient.normalizeFileNameForURI("1527238288566.png")); - assertEquals("V12_abc.png", xeroClient.normalizeFileNameForURI("V12 abc.png")); - assertEquals("Ab1_23ab.png", xeroClient.normalizeFileNameForURI("Ab1 23ab.png")); - assertEquals("abc.png", xeroClient.normalizeFileNameForURI(" abc.png ")); - assertEquals("a-b.png", xeroClient.normalizeFileNameForURI("a-b.png")); - assertEquals("a_b.png", xeroClient.normalizeFileNameForURI("a_b.png")); - assertEquals("a__b.png", xeroClient.normalizeFileNameForURI("a b.png")); - assertEquals("a~b.png", xeroClient.normalizeFileNameForURI("a~b.png")); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java deleted file mode 100644 index a9d507f5..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.CustomJsonConfig; -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiAccountsTest { - - CustomJsonConfig config; - - ApiClient apiClientForAccounting; - AccountingApi accountingApi; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - accountingApi = new AccountingApi(config); - accountingApi.setApiClient(apiClientForAccounting); - accountingApi.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - - public void tearDown() { - accountingApi = null; - apiClientForAccounting = null; - } - - @Test - public void testGetAccounts() throws Exception { - System.out.println("@Test - getAccounts"); - - - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - - Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); - assert(accounts.getAccounts().size() == 2); - assertThat(accounts.getAccounts().get(0).getCode(), is(equalTo("091"))); - assertThat(accounts.getAccounts().get(0).getName(), is(equalTo("Business Savings Account"))); - assertThat(accounts.getAccounts().get(0).getAccountID().toString(), is(equalTo("ebd06280-af70-4bed-97c6-7451a454ad85"))); - assertThat(accounts.getAccounts().get(0).getType(), is(equalTo(com.xero.models.accounting.AccountType.BANK))); - assertThat(accounts.getAccounts().get(0).getBankAccountNumber(), is(equalTo("0209087654321050"))); - assertThat(accounts.getAccounts().get(0).getBankAccountType(), is(equalTo(com.xero.models.accounting.Account.BankAccountTypeEnum.BANK))); - assertThat(accounts.getAccounts().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(accounts.getAccounts().get(0).getTaxType(), is(equalTo("NONE"))); - } - - @Test - public void testGetAccount() throws Exception { - System.out.println("@Test - getAccount"); - UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - - Accounts oneAccount = accountingApi.getAccount(accountID); - assertThat(oneAccount.getAccounts().get(0).getName(), is(equalTo("FooBar"))); - assertThat(oneAccount.getAccounts().get(0).getCode(), is(equalTo("123456"))); - } - - @Test - public void testCreateAccount() throws Exception { - System.out.println("@Test - createAccount"); - - Account acct = null; - Accounts newAccount = accountingApi.createAccount(acct); - assertThat(newAccount.getAccounts().get(0).getName(), is(equalTo("Foobar"))); - } - - @Test - public void testUpdateAccount() throws Exception { - System.out.println("@Test - updateAccount"); - - UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - Accounts accts = null; - Accounts updatedAccount = accountingApi.updateAccount(accountID, accts); - assertThat(updatedAccount.getAccounts().get(0).getName(), is(equalTo("BarFoo"))); - } - - @Test - public void testDeleteAccount() throws Exception { - System.out.println("@Test - deleteAccount"); - - UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - Accounts deleteAccount = accountingApi.deleteAccount(accountID); - assertThat(deleteAccount.getAccounts().get(0).getStatus().toString(), is(equalTo("DELETED"))); - } - - @Test - public void testGetAccountAttachments() throws Exception { - System.out.println("@Test - getAccountAttachments"); - - UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - Attachments accountsAttachments = accountingApi.getAccountAttachments(accountID); - assertThat(accountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("52a643be-cd5c-489f-9778-53a9fd337756"))); - assertThat(accountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); - assertThat(accountsAttachments.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); - assertThat(accountsAttachments.getAttachments().get(0).getUrl().toString(), is(equalTo("https://api.xero.com/api.xro/2.0/Accounts/da962997-a8bd-4dff-9616-01cdc199283f/Attachments/sample5.jpg"))); - - - } - - @Test - public void testCreateAccountAttachmentByFileName() throws Exception { - System.out.println("@Test - createAccountAttachmentByFileName"); - - UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] bytes = IOUtils.toByteArray(inputStream); - String newFileName = "sample5.jpg"; - Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(accountID, newFileName, bytes); - - assertThat(createAccountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("ab95b276-9dce-4925-9077-439818ba270f"))); - assertThat(createAccountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); - assertThat(createAccountsAttachments.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); - assertThat(createAccountsAttachments.getAttachments().get(0).getUrl().toString(), is(equalTo("https://api.xero.com/api.xro/2.0/Accounts/da962997-a8bd-4dff-9616-01cdc199283f/Attachments/sample5.jpg"))); - } - - @Test - public void testUpdateAccountAttachmentByFileName() throws Exception { - System.out.println("@Test - updateAccountAttachmentByFileName"); - - UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] bytes = IOUtils.toByteArray(inputStream); - String newFileName = "sample5.jpg"; - Attachments createAccountsAttachments = accountingApi.updateAccountAttachmentByFileName(accountID, newFileName, bytes); - - assertThat(createAccountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("3fa85f64-5717-4562-b3fc-2c963f66afa6"))); - assertThat(createAccountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); - assertThat(createAccountsAttachments.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); - assertThat(createAccountsAttachments.getAttachments().get(0).getUrl().toString(), is(equalTo("https://api.xero.com/api.xro/2.0/Accounts/da962997-a8bd-4dff-9616-01cdc199283f/Attachments/sample5.jpg"))); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java deleted file mode 100644 index ebfb4507..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java +++ /dev/null @@ -1,224 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.api.client.*; -import com.xero.models.accounting.*; -import com.xero.example.CustomJsonConfig; -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiBankTransactionTest { - - CustomJsonConfig config; - - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void testGetBankTransactions() throws Exception { - System.out.println("@Test - getBankTransactions"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - Integer page = null; - Integer unitdp = null; - BankTransactions response = api.getBankTransactions(ifModifiedSince, where, order, page, unitdp); - assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("db54aab0-ad40-4ced-bcff-0940ba20db2c")))); - assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); - assertThat(response.getBankTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE))); - assertThat(response.getBankTransactions().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.USD))); - assertThat(response.getBankTransactions().get(0).getIsReconciled(), is(equalTo(false))); - assertThat(response.getBankTransactions().get(0).getIsReconciled(), is(equalTo(false))); - assertThat(response.getBankTransactions().get(0).getSubTotal(), is(equalTo(10.0))); - assertThat(response.getBankTransactions().get(0).getTotal(), is(equalTo(10.0))); - //System.out.println(response.getBankTransactions().get(0).toString()); - } - - @Test - public void testGetBankTransaction() throws Exception { - System.out.println("@Test - getBankTransaction"); - UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - BankTransactions response = api.getBankTransaction(bankTransactionID); - assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("db54aab0-ad40-4ced-bcff-0940ba20db2c")))); - assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); - assertThat(response.getBankTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE))); - assertThat(response.getBankTransactions().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.USD))); - assertThat(response.getBankTransactions().get(0).getIsReconciled(), is(equalTo(false))); - assertThat(response.getBankTransactions().get(0).getSubTotal(), is(equalTo(10.0))); - assertThat(response.getBankTransactions().get(0).getTotal(), is(equalTo(10.0))); - //System.out.println(response.getBankTransactions().get(0).toString()); - } - - @Test - public void testUpdateBankTransaction() throws Exception { - System.out.println("@Test - updateBankTransaction"); - UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - BankTransactions newBankTransactions = null; - BankTransactions response = api.updateBankTransaction(bankTransactionID,newBankTransactions); - - assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("1289c190-e46d-434b-9628-463ffdb52f00")))); - assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); - assertThat(response.getBankTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.BankTransaction.TypeEnum.SPEND))); - assertThat(response.getBankTransactions().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.USD))); - assertThat(response.getBankTransactions().get(0).getIsReconciled(), is(equalTo(false))); - assertThat(response.getBankTransactions().get(0).getSubTotal(), is(equalTo(18.26))); - assertThat(response.getBankTransactions().get(0).getTotal(), is(equalTo(20.00))); - //System.out.println(response.getBankTransactions().get(0).toString()); - } - - @Test - public void testCreateBankTransaction() throws Exception { - System.out.println("@Test - createBankTransaction"); - BankTransactions newBankTransactions = null; - BankTransactions response = api.createBankTransaction(newBankTransactions,null); - - assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("1289c190-e46d-434b-9628-463ffdb52f00")))); - assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); - assertThat(response.getBankTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.BankTransaction.TypeEnum.SPEND))); - assertThat(response.getBankTransactions().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.USD))); - assertThat(response.getBankTransactions().get(0).getIsReconciled(), is(equalTo(false))); - assertThat(response.getBankTransactions().get(0).getSubTotal(), is(equalTo(18.26))); - assertThat(response.getBankTransactions().get(0).getTotal(), is(equalTo(20.00))); - //System.out.println(response.getBankTransactions().get(0).toString()); - } - - - @Test - public void createBankTransactionAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - createBankTransactionAttachmentByFileNameTest"); - UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - String fileName = "sample5.jpg"; - - Attachments response = api.createBankTransactionAttachmentByFileName(bankTransactionID, fileName, body); - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b")))); - assertThat(response.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl().toString(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransactions/db54aab0-ad40-4ced-bcff-0940ba20db2c/Attachments/sample5.jpg"))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - - @Test - public void getBankTransactionAttachmentsTest() throws IOException { - System.out.println("@Test - getBankTransactionAttachmentsTest"); - UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - Attachments response = api.getBankTransactionAttachments(bankTransactionID); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransactions/db54aab0-ad40-4ced-bcff-0940ba20db2c/Attachments/sample5.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal(2878711)))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - @Test - public void updateBankTransactionAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - updateBankTransactionAttachmentByFileNameTest"); - UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - String fileName = "sample5.jpg"; - - Attachments response = api.updateBankTransactionAttachmentByFileName(bankTransactionID, fileName, body); - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b")))); - assertThat(response.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl().toString(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransactions/db54aab0-ad40-4ced-bcff-0940ba20db2c/Attachments/sample5.jpg"))); - - } - - @Test - public void testGetBankTransactionsHistory() throws Exception { - System.out.println("@Test - getBankTransactionsHistory"); - UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - HistoryRecords hr = api.getBankTransactionsHistory(bankTransactionID); - assertThat(hr.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); - assertThat(hr.getHistoryRecords().get(0).getChanges(), is(equalTo("Attached a file"))); - //System.out.println(hr.getHistoryRecords().toString()); - } - - @Test - public void testCreateBankTransactionHistoryRecord() throws Exception { - System.out.println("@Test - createBankTransactionHistoryRecord - not implemented"); - - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = api.createBankTransactionHistoryRecord(bankTransactionID,newHistoryRecords); - //assertThat(newHistory.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); - System.out.println(newHistory.getHistoryRecords().toString()); - */ - } - -} diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java deleted file mode 100644 index 6a648a5b..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiBankTransferTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void getBankTransfersTest() throws Exception { - System.out.println("@Test - getBankTransfers"); - - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - - BankTransfers response = api.getBankTransfers(ifModifiedSince, where, order); - assertThat(response.getBankTransfers().get(0).getBankTransferID(), is(equalTo(UUID.fromString("6221458a-ef7a-4d5f-9b1c-1b96ce03833c")))); - assertThat(response.getBankTransfers().get(0).getFromBankTransactionID(), is(equalTo(UUID.fromString("a3eca480-bc04-4292-9bbd-5c57b8ba12b4")))); - assertThat(response.getBankTransfers().get(0).getToBankTransactionID(), is(equalTo(UUID.fromString("4ca13f40-f3a0-4530-a442-a600f5696118")))); - assertThat(response.getBankTransfers().get(0).getFromBankAccount().getName(), is(equalTo("Business Wells Fargo"))); - assertThat(response.getBankTransfers().get(0).getFromBankAccount().getAccountID(), is(equalTo(UUID.fromString("6f7594f2-f059-4d56-9e67-47ac9733bfe9")))); - assertThat(response.getBankTransfers().get(0).getToBankAccount().getName(), is(equalTo("My Savings"))); - assertThat(response.getBankTransfers().get(0).getToBankAccount().getAccountID(), is(equalTo(UUID.fromString("7e5e243b-9fcd-4aef-8e3a-c70be1e39bfa")))); - //System.out.println(response.getBankTransfers().get(0).toString()); - } - - @Test - public void getBankTransferTest() throws IOException { - System.out.println("@Test - getBankTransfer"); - - UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - BankTransfers response = api.getBankTransfer(bankTransferID); - assertThat(response.getBankTransfers().get(0).getBankTransferID(), is(equalTo(UUID.fromString("6221458a-ef7a-4d5f-9b1c-1b96ce03833c")))); - assertThat(response.getBankTransfers().get(0).getFromBankTransactionID(), is(equalTo(UUID.fromString("a3eca480-bc04-4292-9bbd-5c57b8ba12b4")))); - assertThat(response.getBankTransfers().get(0).getToBankTransactionID(), is(equalTo(UUID.fromString("4ca13f40-f3a0-4530-a442-a600f5696118")))); - assertThat(response.getBankTransfers().get(0).getFromBankAccount().getName(), is(equalTo("Business Wells Fargo"))); - assertThat(response.getBankTransfers().get(0).getFromBankAccount().getAccountID(), is(equalTo(UUID.fromString("6f7594f2-f059-4d56-9e67-47ac9733bfe9")))); - assertThat(response.getBankTransfers().get(0).getToBankAccount().getName(), is(equalTo("My Savings"))); - assertThat(response.getBankTransfers().get(0).getToBankAccount().getAccountID(), is(equalTo(UUID.fromString("7e5e243b-9fcd-4aef-8e3a-c70be1e39bfa")))); - //System.out.println(response.getBankTransfers().get(0).toString()); - } - - @Test - public void createBankTransferTest() throws IOException { - System.out.println("@Test - createBankTransfer"); - - BankTransfers bankTransfers = null; - BankTransfers response = api.createBankTransfer(bankTransfers); - assertThat(response.getBankTransfers().get(0).getBankTransferID(), is(equalTo(UUID.fromString("76eea4b6-f026-464c-b6f3-5fb39a196145")))); - assertThat(response.getBankTransfers().get(0).getFromBankTransactionID(), is(equalTo(UUID.fromString("e4059952-5acb-4a56-b076-53fad85f2930")))); - assertThat(response.getBankTransfers().get(0).getToBankAccount().getName(), is(equalTo("Business Wells Fargo"))); - assertThat(response.getBankTransfers().get(0).getToBankAccount().getAccountID(), is(equalTo(UUID.fromString("6f7594f2-f059-4d56-9e67-47ac9733bfe9")))); - assertThat(response.getBankTransfers().get(0).getFromBankAccount().getName(), is(equalTo("My Savings"))); - assertThat(response.getBankTransfers().get(0).getFromBankAccount().getAccountID(), is(equalTo(UUID.fromString("7e5e243b-9fcd-4aef-8e3a-c70be1e39bfa")))); - //System.out.println(response.getBankTransfers().get(0).toString()); - } - @Test - public void getBankTransferHistoryTest() throws IOException { - System.out.println("@Test - getBankTransferHistoryTest"); - - UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - HistoryRecords response = api.getBankTransferHistory(bankTransferID); - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Attached a file"))); - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Attached the file sample2.jpg through the Xero API using Xero API Partner"))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void createBankTransferHistoryRecordTest() throws IOException { - System.out.println("@Test - createBankTransferHistoryRecordTest - not implemented at this time"); - - //HistoryRecords historyRecords = null; - //HistoryRecords response = api.createBankTransferHistoryRecord(bankTransferID, historyRecords); - // TODO: test validations - } - - @Test - public void createBankTransferAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - createBankTransferAttachmentByFileNameTest"); - - UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - String fileName = "sample5.jpg"; - - Attachments response = api.createBankTransferAttachmentByFileName(bankTransferID, fileName, body); - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("9478be4c-c707-48c1-b4a7-83d8eaf442b5")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransfers/6221458a-ef7a-4d5f-9b1c-1b96ce03833c/Attachments/sample5.jpg"))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - @Test - public void getBankTransferAttachmentsTest() throws IOException { - System.out.println("@Test - getBankTransferAttachmentsTest"); - - UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - Attachments response = api.getBankTransferAttachments(bankTransferID); - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("e05a6fd8-0e47-47a9-9799-b809c8267260")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransfers/6221458a-ef7a-4d5f-9b1c-1b96ce03833c/Attachments/HelloWorld.jpg"))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - @Test - public void updateBankTransferAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - updateBankTransferAttachmentByFileNameTest"); - - UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - String fileName = "sample5.jpg"; - - Attachments response = api.updateBankTransferAttachmentByFileName(bankTransferID, fileName, body); - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("0851935c-c4c5-4de8-9247-ce22efde6f82")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransfers/6221458a-ef7a-4d5f-9b1c-1b96ce03833c/Attachments/sample5.jpg"))); - //System.out.println(response.getAttachments().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java deleted file mode 100644 index 089474e9..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; -import com.xero.example.CustomJsonConfig; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiBatchPaymentTest { - CustomJsonConfig config; - - ApiClient apiClientForAccounting; - AccountingApi accountingApi; - Map params; - - OffsetDateTime ifModifiedSince; - String where; - String order; - boolean summarizeErrors; - String ids; - boolean includeArchived; - String invoiceNumbers; - String contactIDs; - String statuses; - boolean createdByMyApp; - UUID batchPaymentID; - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - accountingApi = new AccountingApi(config); - accountingApi.setApiClient(apiClientForAccounting); - accountingApi.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - ifModifiedSince = null; - where = null; - order = null; - summarizeErrors = false; - ids= null; - includeArchived = false; - invoiceNumbers = null; - contactIDs = null; - statuses = null; - createdByMyApp = false; - batchPaymentID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - accountingApi = null; - apiClientForAccounting = null; - } - - @Test - public void testGetBatchPayment() throws Exception { - System.out.println("@Test - getBatchPayment"); - BatchPayments batchPayments = accountingApi.getBatchPayments(ifModifiedSince, where, order); - assertThat(batchPayments.getBatchPayments().get(0).getBatchPaymentID().toString(), is(equalTo("d0e9bbbf-5b8a-48b6-906a-035591fcb061"))); - assertThat(batchPayments.getBatchPayments().get(0).getReference(), is(equalTo("Hello World"))); - //System.out.println(batchPayments.getBatchPayments().toString()); - } - - @Test - public void testCreateBatchPayment() throws Exception { - System.out.println("@Test - createBatchPayment"); - - BatchPayments createBatchPayments = new BatchPayments(); - BatchPayment createBatchPayment = new BatchPayment(); - createBatchPayments.addBatchPaymentsItem(createBatchPayment); - BatchPayments newBatchPayments = accountingApi.createBatchPayment(createBatchPayments); - assertThat(newBatchPayments.getBatchPayments().get(0).getBatchPaymentID().toString(), is(equalTo("d318c343-208e-49fe-b04a-45642349bcf1"))); - assertThat(newBatchPayments.getBatchPayments().get(0).getReference(), is(equalTo("Foobar123"))); - //System.out.println(newBatchPayments.getBatchPayments().toString()); - } - - @Test - public void testGetBatchPaymentsHistory() throws Exception { - System.out.println("@Test - getBatchPaymentHistory"); - - HistoryRecords hr = accountingApi.getBatchPaymentHistory(batchPaymentID); - assertThat(hr.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); - assertThat(hr.getHistoryRecords().get(0).getChanges(), is(equalTo("Approved"))); - //System.out.println(hr.getHistoryRecords().toString()); - } - - @Test - public void testcreateBatchPaymentHistoryRecord() throws Exception { - System.out.println("@Test - createBatchPaymentHistoryRecord"); - - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createBatchPaymentHistoryRecord(batchPaymentID,newHistoryRecords); - assertThat(newHistory.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); - //System.out.println(newHistory.getHistoryRecords().toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java deleted file mode 100644 index 1632476a..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; -import com.xero.example.CustomJsonConfig; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiBrandingThemeTest { - - CustomJsonConfig config; - - ApiClient apiClientForAccounting; - AccountingApi accountingApi; - Map params; - - OffsetDateTime ifModifiedSince; - String where; - String order; - boolean summarizeErrors; - String ids; - boolean includeArchived; - String invoiceNumbers; - String contactIDs; - String statuses; - boolean createdByMyApp; - UUID brandingThemeId; - UUID paymentServiceId; - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - accountingApi = new AccountingApi(config); - accountingApi.setApiClient(apiClientForAccounting); - accountingApi.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - ifModifiedSince = null; - where = null; - order = null; - summarizeErrors = false; - ids= null; - includeArchived = false; - invoiceNumbers = null; - contactIDs = null; - statuses = null; - createdByMyApp = false; - brandingThemeId = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - paymentServiceId = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - - public void tearDown() { - accountingApi = null; - apiClientForAccounting = null; - } - - @Test - public void testGetBrandingThemes() throws Exception { - System.out.println("@Test - getBrandingThemes"); - - BrandingThemes bt = accountingApi.getBrandingThemes(); - assertThat(bt.getBrandingThemes().get(0).getBrandingThemeID().toString(), is(equalTo("dabc7637-62c1-4941-8a6e-ee44fa5090e7"))); - assertThat(bt.getBrandingThemes().get(0).getName(), is(equalTo("Standard"))); - //System.out.println(bt.toString()); - } - - @Test - public void testGetBrandingTheme() throws Exception { - System.out.println("@Test - getBrandingTheme"); - - BrandingThemes oneBrandingTheme = accountingApi.getBrandingTheme(brandingThemeId); - assertThat(oneBrandingTheme.getBrandingThemes().get(0).getBrandingThemeID().toString(), is(equalTo("dabc7637-62c1-4941-8a6e-ee44fa5090e7"))); - assertThat(oneBrandingTheme.getBrandingThemes().get(0).getName(), is(equalTo("Standard"))); - //System.out.println(bt.toString()); - } - - @Test - public void testGetBrandingThemePaymentServices() throws Exception { - System.out.println("@Test - getBrandingThemePaymentServices"); - - PaymentServices paymentServicesForBrandingTheme = accountingApi.getBrandingThemePaymentServices(brandingThemeId); - assertThat(paymentServicesForBrandingTheme.getPaymentServices().get(1).getPaymentServiceID().toString(), is(equalTo("dede7858-14e3-4a46-bf95-4d4cc491e645"))); - assertThat(paymentServicesForBrandingTheme.getPaymentServices().get(1).getPaymentServiceName(), is(equalTo("ACME Payment"))); - //System.out.println(paymentServicesForBrandingTheme.toString()); - } - - @Test - public void testCreateBrandingThemePaymentServices() throws Exception { - System.out.println("@Test - createBrandingThemePaymentServices"); - - PaymentService btPaymentService = new PaymentService(); - btPaymentService.setPaymentServiceID(paymentServiceId); - btPaymentService.setPaymentServiceName("ACME Payments"); - btPaymentService.setPaymentServiceUrl("http://www.mydomain.com/paymentservice"); - btPaymentService.setPayNowText("Pay Now"); - PaymentServices response = accountingApi.createBrandingThemePaymentServices(brandingThemeId, btPaymentService); - assertThat(response.getPaymentServices().get(0).getPaymentServiceID().toString(), is(equalTo("dede7858-14e3-4a46-bf95-4d4cc491e645"))); - assertThat(response.getPaymentServices().get(0).getPaymentServiceName(), is(equalTo("ACME Payments"))); - assertThat(response.getPaymentServices().get(0).getPaymentServiceUrl(), is(equalTo("https://www.payupnow.com/"))); - assertThat(response.getPaymentServices().get(0).getPayNowText(), is(equalTo("Pay Now"))); - - //System.out.println(response.toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java deleted file mode 100644 index 579cbda0..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiContactGroupTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void getContactGroupsTest() throws IOException { - System.out.println("@Test - getContactGroupsTest"); - - String where = null; - String order = null; - ContactGroups response = api.getContactGroups(where, order); - assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("d7a86b80-8dac-4d89-a334-9dcf5753676c")))); - assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Suppliers"))); - assertThat(response.getContactGroups().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ContactGroup.StatusEnum.ACTIVE))); - //System.out.println(response.getContactGroups().get(0).toString()); - } - - @Test - public void getContactGroupTest() throws IOException { - System.out.println("@Test - getContactGroupTest"); - - UUID contactGroupID = UUID.fromString("17b44ed7-4389-4162-91cb-3dd5766e4e22"); - ContactGroups response = api.getContactGroup(contactGroupID); - - assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("17b44ed7-4389-4162-91cb-3dd5766e4e22")))); - assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Oasis"))); - assertThat(response.getContactGroups().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ContactGroup.StatusEnum.ACTIVE))); - assertThat(response.getContactGroups().get(0).getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("4e1753b9-018a-4775-b6aa-1bc7871cfee3")))); - assertThat(response.getContactGroups().get(0).getContacts().get(0).getName(), is(equalTo("Noel Gallagher"))); - assertThat(response.getContactGroups().get(0).getContacts().get(1).getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getContactGroups().get(0).getContacts().get(1).getName(), is(equalTo("Liam Gallagher"))); - //System.out.println(response.getContactGroups().get(0).toString()); - } - - @Test - public void createContactGroupTest() throws IOException { - System.out.println("@Test - createContactGroupTest"); - - ContactGroups contactGroups = null; - ContactGroups response = api.createContactGroup(contactGroups); - assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("d7a86b80-8dac-4d89-a334-9dcf5753676c")))); - assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Suppliers"))); - assertThat(response.getContactGroups().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ContactGroup.StatusEnum.ACTIVE))); - //System.out.println(response.getContactGroups().get(0).toString()); - } - - @Test - public void updateContactGroupTest() throws IOException { - System.out.println("@Test - updateContactGroupTest"); - - UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); - ContactGroups contactGroups = null; - ContactGroups response = api.updateContactGroup(contactGroupID, contactGroups); - assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5")))); - assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Supplier Vendor"))); - assertThat(response.getContactGroups().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ContactGroup.StatusEnum.ACTIVE))); - //System.out.println(response.getContactGroups().get(0).toString()); - } - - @Test - public void createContactGroupContactsTest() throws IOException { - System.out.println("@Test - createContactGroupContactsTest"); - - UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); - Contacts contacts = null; - Contacts response = api.createContactGroupContacts(contactGroupID, contacts); - assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("a3675fc4-f8dd-4f03-ba5b-f1870566bcd7")))); - //System.out.println(response.getContacts().get(0).toString()); - } - - @Test - public void deleteContactGroupContactTest() throws IOException { - System.out.println("@Test - deleteContactGroupContactTest"); - - UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); - UUID contactID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); - api.deleteContactGroupContact(contactGroupID, contactID); - } - - @Test - public void deleteContactGroupContactsTest() throws IOException { - System.out.println("@Test - deleteContactGroupContactsTest"); - - UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); - api.deleteContactGroupContacts(contactGroupID); - } - -} diff --git a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java deleted file mode 100644 index 22b57b7b..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java +++ /dev/null @@ -1,293 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiContactsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void getContactsTest() throws IOException { - System.out.println("@Test - getContactsTest"); - - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - String ids = null; - Boolean includeArchived = null; - Contacts response = api.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); - - assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("5cc8cf28-567e-4d43-b287-687cfcaec47c")))); - assertThat(response.getContacts().get(0).getName(), is(equalTo("Katherine Warren"))); - assertThat(response.getContacts().get(0).getFirstName(), is(equalTo("Katherine"))); - assertThat(response.getContacts().get(0).getLastName(), is(equalTo("Warren"))); - assertThat(response.getContacts().get(0).getEmailAddress(), is(equalTo("kat.warren@clampett.com"))); - assertThat(response.getContacts().get(0).getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); - assertThat(response.getContacts().get(0).getAddresses().get(1).getAddressType(), is(equalTo(com.xero.models.accounting.Address.AddressTypeEnum.POBOX))); - assertThat(response.getContacts().get(0).getAddresses().get(1).getCity(), is(equalTo("Palo Alto"))); - assertThat(response.getContacts().get(0).getAddresses().get(1).getRegion(), is(equalTo("CA"))); - assertThat(response.getContacts().get(0).getAddresses().get(1).getPostalCode(), is(equalTo("94020"))); - assertThat(response.getContacts().get(0).getAddresses().get(1).getCountry(), is(equalTo("United States"))); - assertThat(response.getContacts().get(0).getPhones().get(1).getPhoneType(), is(equalTo(com.xero.models.accounting.Phone.PhoneTypeEnum.DEFAULT))); - assertThat(response.getContacts().get(0).getPhones().get(1).getPhoneNumber(), is(equalTo("847-1294"))); - assertThat(response.getContacts().get(0).getPhones().get(1).getPhoneAreaCode(), is(equalTo("(626)"))); - assertThat(response.getContacts().get(0).getIsSupplier(), is(equalTo(true))); - assertThat(response.getContacts().get(0).getIsCustomer(), is(equalTo(true))); - assertThat(response.getContacts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-08-21T13:49:04.227-07:00")))); - assertThat(response.getContacts().get(0).getBalances().getAccountsReceivable().getOutstanding(), is(equalTo(760.0))); - assertThat(response.getContacts().get(0).getBalances().getAccountsReceivable().getOverdue(), is(equalTo(920.0))); - assertThat(response.getContacts().get(0).getBalances().getAccountsPayable().getOutstanding(), is(equalTo(231.6))); - assertThat(response.getContacts().get(0).getBalances().getAccountsPayable().getOverdue(), is(equalTo(360.0))); - assertThat(response.getContacts().get(0).getHasAttachments(), is(equalTo(false))); - //System.out.println(response.getContacts().get(0).toString()); - } - - @Test - public void getContactTest() throws IOException { - System.out.println("@Test - getContactTest"); - - UUID contactID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Contacts response = api.getContact(contactID); - - assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d")))); - assertThat(response.getContacts().get(0).getContactNumber(), is(equalTo("SB2"))); - assertThat(response.getContacts().get(0).getAccountNumber(), is(equalTo("1234567"))); - assertThat(response.getContacts().get(0).getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); - assertThat(response.getContacts().get(0).getName(), is(equalTo("Acme Parts Co."))); - assertThat(response.getContacts().get(0).getFirstName(), is(equalTo("Blake"))); - assertThat(response.getContacts().get(0).getLastName(), is(equalTo("Kohler"))); - assertThat(response.getContacts().get(0).getEmailAddress(), is(equalTo("bk@krave.co"))); - assertThat(response.getContacts().get(0).getSkypeUserName(), is(equalTo("blake"))); - assertThat(response.getContacts().get(0).getContactPersons().get(0).getFirstName(), is(equalTo("Sue"))); - assertThat(response.getContacts().get(0).getContactPersons().get(0).getLastName(), is(equalTo("Johnson"))); - assertThat(response.getContacts().get(0).getContactPersons().get(0).getEmailAddress(), is(equalTo("sue.johnson@krave.com"))); - assertThat(response.getContacts().get(0).getContactPersons().get(0).getIncludeInEmails(), is(equalTo(true))); - assertThat(response.getContacts().get(0).getBankAccountDetails(), is(equalTo("12334567"))); - assertThat(response.getContacts().get(0).getTaxNumber(), is(equalTo("123-22-3456"))); - assertThat(response.getContacts().get(0).getAccountsReceivableTaxType(), is(equalTo("TAX003"))); - assertThat(response.getContacts().get(0).getAccountsPayableTaxType(), is(equalTo("TAX022"))); - assertThat(response.getContacts().get(0).getAddresses().get(0).getAddressType(), is(equalTo(com.xero.models.accounting.Address.AddressTypeEnum.STREET))); - assertThat(response.getContacts().get(0).getAddresses().get(0).getAddressLine1(), is(equalTo("123 Fake Street"))); - assertThat(response.getContacts().get(0).getAddresses().get(0).getCity(), is(equalTo("Vancouver"))); - assertThat(response.getContacts().get(0).getAddresses().get(0).getRegion(), is(equalTo("British Columbia"))); - assertThat(response.getContacts().get(0).getAddresses().get(0).getPostalCode(), is(equalTo("V6B 2T4"))); - assertThat(response.getContacts().get(0).getPhones().get(0).getPhoneType(), is(equalTo(com.xero.models.accounting.Phone.PhoneTypeEnum.DDI))); - assertThat(response.getContacts().get(0).getPhones().get(0).getPhoneCountryCode(), is(equalTo("4"))); - assertThat(response.getContacts().get(0).getPhones().get(0).getPhoneNumber(), is(equalTo("489-44493"))); - assertThat(response.getContacts().get(0).getPhones().get(0).getPhoneAreaCode(), is(equalTo("345"))); - assertThat(response.getContacts().get(0).getIsSupplier(), is(equalTo(true))); - assertThat(response.getContacts().get(0).getIsCustomer(), is(equalTo(true))); - assertThat(response.getContacts().get(0).getDefaultCurrency(), is(equalTo(com.xero.models.accounting.CurrencyCode.USD))); - assertThat(response.getContacts().get(0).getSalesDefaultAccountCode(), is(equalTo("002"))); - assertThat(response.getContacts().get(0).getPurchasesDefaultAccountCode(), is(equalTo("660"))); - assertThat(response.getContacts().get(0).getWebsite(), is(equalTo("http://www.google.com"))); - assertThat(response.getContacts().get(0).getBrandingTheme().getBrandingThemeID(), is(equalTo(UUID.fromString("dabc7637-62c1-4941-8a6e-ee44fa5090e7")))); - assertThat(response.getContacts().get(0).getBrandingTheme().getName(), is(equalTo("Standard"))); - assertThat(response.getContacts().get(0).getBatchPayments().getDetails(), is(equalTo("biz checking"))); - assertThat(response.getContacts().get(0).getBatchPayments().getBankAccountNumber(), is(equalTo("12334567"))); - assertThat(response.getContacts().get(0).getBatchPayments().getBankAccountName(), is(equalTo("Citi Bank"))); - assertThat(response.getContacts().get(0).getDiscount(), is(equalTo(13.0))); - assertThat(response.getContacts().get(0).getBalances().getAccountsReceivable().getOutstanding(), is(equalTo(118.90))); - assertThat(response.getContacts().get(0).getBalances().getAccountsReceivable().getOverdue(), is(equalTo(136.90))); - assertThat(response.getContacts().get(0).getBalances().getAccountsPayable().getOutstanding(), is(equalTo(-43.60))); - assertThat(response.getContacts().get(0).getBalances().getAccountsPayable().getOverdue(), is(equalTo(40.00))); - assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getDay(), is(equalTo(Integer.parseInt("12")))); - assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.OFFOLLOWINGMONTH))); - assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getDay(), is(equalTo(Integer.parseInt("14")))); - assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.OFCURRENTMONTH))); - assertThat(response.getContacts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-01T09:02:57.193-08:00")))); - //System.out.println(response.getContacts().get(0).toString()); - } - - @Test - public void createContactTest() throws IOException { - System.out.println("@Test - createContactTest"); - - Contact contact = null; - Contacts response = api.createContact(contact); - assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("3ff6d40c-af9a-40a3-89ce-3c1556a25591")))); - assertThat(response.getContacts().get(0).getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); - assertThat(response.getContacts().get(0).getName(), is(equalTo("Foo9987"))); - assertThat(response.getContacts().get(0).getEmailAddress(), is(equalTo("sid32476@blah.com"))); - assertThat(response.getContacts().get(0).getPhones().get(3).getPhoneNumber(), is(equalTo("555-1212"))); - assertThat(response.getContacts().get(0).getPhones().get(3).getPhoneAreaCode(), is(equalTo("415"))); - assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getDay(), is(equalTo(Integer.parseInt("15")))); - assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.OFCURRENTMONTH))); - assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getDay(), is(equalTo(Integer.parseInt("10")))); - assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.DAYSAFTERBILLMONTH))); - //System.out.println(response.getContacts().get(0).toString()); - } - - @Test - public void updateContactTest() throws IOException { - System.out.println("@Test - updateContactTest"); - - UUID contactID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Contacts contacts = null; - Contacts response = api.updateContact(contactID,contacts); - assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("d5be01fb-b09f-4c3a-9c67-e10c2a03412c")))); - assertThat(response.getContacts().get(0).getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); - assertThat(response.getContacts().get(0).getName(), is(equalTo("FooBar"))); - assertThat(response.getContacts().get(0).getEmailAddress(), is(equalTo("sid30680@blah.com"))); - assertThat(response.getContacts().get(0).getPhones().get(3).getPhoneType(), is(equalTo(com.xero.models.accounting.Phone.PhoneTypeEnum.MOBILE))); - assertThat(response.getContacts().get(0).getPhones().get(3).getPhoneNumber(), is(equalTo("555-1212"))); - assertThat(response.getContacts().get(0).getPhones().get(3).getPhoneAreaCode(), is(equalTo("415"))); - assertThat(response.getContacts().get(0).getIsSupplier(), is(equalTo(false))); - assertThat(response.getContacts().get(0).getIsCustomer(), is(equalTo(false))); - assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getDay(), is(equalTo(Integer.parseInt("15")))); - assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.OFCURRENTMONTH))); - assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getDay(), is(equalTo(Integer.parseInt("10")))); - assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.DAYSAFTERBILLMONTH))); - assertThat(response.getContacts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-02-28T16:27:11.763-08:00")))); - assertThat(response.getContacts().get(0).getHasValidationErrors(), is(equalTo(false))); - //System.out.println(response.getContacts().get(0).toString()); - } - - @Test - public void getContactHistoryTest() throws IOException { - System.out.println("@Test - getContactHistoryTest"); - - UUID contactID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - HistoryRecords response = api.getContactHistory(contactID); - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Edited"))); - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Name changed from Foo9987 to Bar8156."))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-02-28T16:15:22.350-08:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void createContactHistoryTest() throws IOException { - System.out.println("@Test - createContactHistoryTest - not implemented at this time"); - - UUID contactID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - HistoryRecords historyRecords = null; - HistoryRecords response = api.createContactHistory(contactID, historyRecords); - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-02-28T16:15:24.272-08:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void createContactAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - createContactAttachmentByFileNameTest"); - - UUID contactID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - String fileName = "sample5.jpg"; - - Attachments response = api.createContactAttachmentByFileName(contactID, fileName, body); - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("27e37b01-6996-4ebe-836c-95fd472ad674")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Contacts/8138a266-fb42-49b2-a104-014b7045753d/Attachments/sample5.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - - @Test - public void getContactAttachmentsTest() throws IOException { - System.out.println("@Test - getContactAttachmentsTest"); - - UUID contactID = UUID.fromString("04e0a3e3-b116-456a-9f32-9706f0d33afa"); - Attachments response = api.getContactAttachments(contactID); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("04e0a3e3-b116-456a-9f32-9706f0d33afa")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Contacts/8138a266-fb42-49b2-a104-014b7045753d/Attachments/sample5.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - - - @Test - public void getContactCISSettingsTest() throws IOException { - System.out.println("@Test - getContactCISSettingsTest - not implemented"); - - //UUID contactID = null; - //CISSettings response = api.getContactCISSettings(contactID); - - // TODO: test validations - } - -} diff --git a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java deleted file mode 100644 index 112b1875..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java +++ /dev/null @@ -1,316 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiCreditNotesTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createCreditNoteTest() throws IOException { - System.out.println("@Test - createCreditNote"); - Boolean summarizeErrors = null; - CreditNotes creditNotes = null; - CreditNotes response = api.createCreditNote(summarizeErrors, creditNotes); - - assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT))); - assertThat(response.getCreditNotes().get(0).getStatus(), is(equalTo(com.xero.models.accounting.CreditNote.StatusEnum.DRAFT))); - assertThat(response.getCreditNotes().get(0).getSubTotal(), is(equalTo(40.0))); - assertThat(response.getCreditNotes().get(0).getSubTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getCreditNotes().get(0).getTotalTax(), is(equalTo(6.0))); - assertThat(response.getCreditNotes().get(0).getTotalTax().toString(), is(equalTo("6.0"))); - assertThat(response.getCreditNotes().get(0).getTotal(), is(equalTo(46.0))); - assertThat(response.getCreditNotes().get(0).getTotal().toString(), is(equalTo("46.0"))); - assertThat(response.getCreditNotes().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T11:05:02.650-08:00")))); - assertThat(response.getCreditNotes().get(0).getCreditNoteID(), is(equalTo(UUID.fromString("f9256f04-5a99-4680-acb9-6b4639cc439a")))); - assertThat(response.getCreditNotes().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getCreditNotes().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getCreditNotes().get(0).getRemainingCredit(), is(equalTo(46.0))); - assertThat(response.getCreditNotes().get(0).getRemainingCredit().toString(), is(equalTo("46.0"))); - assertThat(response.getCreditNotes().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("An existing Credit Note with the specified CreditNoteID could not be found"))); - assertThat(response.getCreditNotes().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getCreditNotes().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getDescription(), is(equalTo("Foobar"))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getQuantity(), is(equalTo(2.0))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getTaxType(), is(equalTo("INPUT2"))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("400"))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(6.0))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(40.0))); - //System.out.println(response.getCreditNotes().get(0).toString()); - } - - @Test - public void createCreditNoteAllocationTest() throws IOException { - System.out.println("@Test - createCreditNoteAllocation"); - UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Allocations allocations = null; - Allocations response = api.createCreditNoteAllocation(creditNoteID, allocations); - - assertThat(response.getAllocations().get(0).getAmount(), is(equalTo(1.0))); - assertThat(response.getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 04)))); - //System.out.println(response.getAllocations().get(0).toString()); - } - - @Test - public void createCreditNoteAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - createCreditNoteAttachmentByFileName"); - UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - String fileName = "sample5.jpg"; - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - Attachments response = api.createCreditNoteAttachmentByFileName(creditNoteID, fileName, body); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("91bbae3f-5de5-4e3d-875f-8662f25897bd")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/CreditNotes/249f15fa-f2a7-4acc-8769-0984103f2225/Attachments/sample5.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - - @Test - public void createCreditNoteHistoryTest() throws IOException { - System.out.println("@Test - createCreditNoteHistory"); - UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords historyRecords = null; - HistoryRecords response = api.createCreditNoteHistory(creditNoteID, historyRecords); - - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T15:29:04.585-08:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getCreditNoteTest() throws IOException { - System.out.println("@Test - getCreditNote"); - UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - CreditNotes response = api.getCreditNote(creditNoteID); - - assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCRECCREDIT))); - assertThat(response.getCreditNotes().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 04)))); - assertThat(response.getCreditNotes().get(0).getStatus(), is(equalTo(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED))); - assertThat(response.getCreditNotes().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getCreditNotes().get(0).getSubTotal(), is(equalTo(30.0))); - assertThat(response.getCreditNotes().get(0).getSubTotal().toString(), is(equalTo("30.0"))); - assertThat(response.getCreditNotes().get(0).getTotalTax(), is(equalTo(4.5))); - assertThat(response.getCreditNotes().get(0).getTotalTax().toString(), is(equalTo("4.5"))); - assertThat(response.getCreditNotes().get(0).getTotal(), is(equalTo(34.5))); - assertThat(response.getCreditNotes().get(0).getTotal().toString(), is(equalTo("34.5"))); - assertThat(response.getCreditNotes().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T10:59:06.157-08:00")))); - assertThat(response.getCreditNotes().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getCreditNotes().get(0).getCreditNoteID(), is(equalTo(UUID.fromString("249f15fa-f2a7-4acc-8769-0984103f2225")))); - assertThat(response.getCreditNotes().get(0).getCreditNoteNumber(), is(equalTo("CN-0005"))); - assertThat(response.getCreditNotes().get(0).getReference(), is(equalTo("US Tour"))); - assertThat(response.getCreditNotes().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getCreditNotes().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getCreditNotes().get(0).getRemainingCredit(), is(equalTo(32.5))); - assertThat(response.getCreditNotes().get(0).getRemainingCredit().toString(), is(equalTo("32.5"))); - assertThat(response.getCreditNotes().get(0).getHasAttachments(), is(equalTo(true))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getReference(), is(equalTo("Too much"))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 13)))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getAmount(), is(equalTo(2.0))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("6b037c9b-2e5d-4905-84d3-eabfb3438242")))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getHasAccount(), is(equalTo(false))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); - //System.out.println(response.getCreditNotes().get(0).toString()); - } - - @Test - public void getCreditNoteAttachmentsTest() throws IOException { - System.out.println("@Test - getCreditNoteAttachments"); - UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Attachments response = api.getCreditNoteAttachments(creditNoteID); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("b7eb1fc9-a0f9-4e8e-9373-6689f5350832")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.png"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/png"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/CreditNotes/249f15fa-f2a7-4acc-8769-0984103f2225/Attachments/HelloWorld.png"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("76091")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - @Test - public void getCreditNoteHistoryTest() throws IOException { - System.out.println("@Test - getCreditNoteHistory"); - UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = api.getCreditNoteHistory(creditNoteID); - - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Cash Refunded"))); - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Payment made to Liam Gallagher on 14 March 2019 for 2.00. There is 32.50 credit remaining on this credit note."))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T10:59:06.157-08:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - - @Test - public void getCreditNotesTest() throws IOException { - System.out.println("@Test - getCreditNotes"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - Integer page = null; - CreditNotes response = api.getCreditNotes(ifModifiedSince, where, order, page); - - assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCRECCREDIT))); - assertThat(response.getCreditNotes().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 04)))); - assertThat(response.getCreditNotes().get(0).getStatus(), is(equalTo(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED))); - assertThat(response.getCreditNotes().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getCreditNotes().get(0).getSubTotal(), is(equalTo(30.0))); - assertThat(response.getCreditNotes().get(0).getSubTotal().toString(), is(equalTo("30.0"))); - assertThat(response.getCreditNotes().get(0).getTotalTax(), is(equalTo(4.5))); - assertThat(response.getCreditNotes().get(0).getTotalTax().toString(), is(equalTo("4.5"))); - assertThat(response.getCreditNotes().get(0).getTotal(), is(equalTo(34.5))); - assertThat(response.getCreditNotes().get(0).getTotal().toString(), is(equalTo("34.5"))); - assertThat(response.getCreditNotes().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T10:59:06.157-08:00")))); - assertThat(response.getCreditNotes().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getCreditNotes().get(0).getCreditNoteID(), is(equalTo(UUID.fromString("249f15fa-f2a7-4acc-8769-0984103f2225")))); - assertThat(response.getCreditNotes().get(0).getCreditNoteNumber(), is(equalTo("CN-0005"))); - assertThat(response.getCreditNotes().get(0).getReference(), is(equalTo("US Tour"))); - assertThat(response.getCreditNotes().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getCreditNotes().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getCreditNotes().get(0).getRemainingCredit(), is(equalTo(32.5))); - assertThat(response.getCreditNotes().get(0).getRemainingCredit().toString(), is(equalTo("32.5"))); - assertThat(response.getCreditNotes().get(0).getHasAttachments(), is(equalTo(true))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getReference(), is(equalTo("Too much"))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 13)))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getAmount(), is(equalTo(2.0))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("6b037c9b-2e5d-4905-84d3-eabfb3438242")))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getHasAccount(), is(equalTo(false))); - assertThat(response.getCreditNotes().get(0).getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void updateCreditNoteTest() throws IOException { - System.out.println("@Test - updateCreditNote"); - UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - CreditNotes creditNotes = null; - CreditNotes response = api.updateCreditNote(creditNoteID, creditNotes); - - assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT))); - assertThat(response.getCreditNotes().get(0).getDate(), is(equalTo(LocalDate.of(2019, 01, 04)))); - assertThat(response.getCreditNotes().get(0).getStatus(), is(equalTo(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED))); - assertThat(response.getCreditNotes().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getDescription(), is(equalTo("Foobar"))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getQuantity(), is(equalTo(2.0))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getTaxType(), is(equalTo("INPUT2"))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("400"))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(6.0))); - assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(40.0))); - assertThat(response.getCreditNotes().get(0).getSubTotal(), is(equalTo(40.0))); - assertThat(response.getCreditNotes().get(0).getSubTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getCreditNotes().get(0).getTotalTax(), is(equalTo(6.0))); - assertThat(response.getCreditNotes().get(0).getTotalTax().toString(), is(equalTo("6.0"))); - assertThat(response.getCreditNotes().get(0).getTotal(), is(equalTo(46.0))); - assertThat(response.getCreditNotes().get(0).getTotal().toString(), is(equalTo("46.0"))); - assertThat(response.getCreditNotes().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T11:05:04.223-08:00")))); - assertThat(response.getCreditNotes().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getCreditNotes().get(0).getCreditNoteID(), is(equalTo(UUID.fromString("f9256f04-5a99-4680-acb9-6b4639cc439a")))); - assertThat(response.getCreditNotes().get(0).getReference(), is(equalTo("HelloWorld"))); - assertThat(response.getCreditNotes().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getCreditNotes().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getCreditNotes().get(0).getRemainingCredit(), is(equalTo(46.0))); - assertThat(response.getCreditNotes().get(0).getRemainingCredit().toString(), is(equalTo("46.0"))); - //System.out.println(response.getCreditNotes().get(0).toString()); - } - - @Test - public void updateCreditNoteAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - updateCreditNoteAttachmentByFileName"); - UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - String fileName = "sample5.jpg"; - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - Attachments response = api.updateCreditNoteAttachmentByFileName(creditNoteID, fileName, body); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("103e49f1-e47c-4b4d-b5e8-77d9d00fa70a")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/CreditNotes/249f15fa-f2a7-4acc-8769-0984103f2225/Attachments/HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java deleted file mode 100644 index 0b4337c5..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiEmployeesTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createEmployeeTest() throws IOException { - System.out.println("@Test - createEmployee"); - Employees employees = null; - Employees response = api.createEmployee(employees); - - assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("e1ada26b-a10e-4065-a941-af34b53740e3")))); - assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); - assertThat(response.getEmployees().get(0).getFirstName(), is(equalTo("Nick"))); - assertThat(response.getEmployees().get(0).getLastName(), is(equalTo("Fury"))); - assertThat(response.getEmployees().get(0).getExternalLink().getUrl(), is(equalTo("http://twitter.com/#!/search/Nick+Fury"))); - assertThat(response.getEmployees().get(0).getExternalLink().getDescription(), is(equalTo("Go to external link"))); - assertThat(response.getEmployees().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:18:56.463-07:00")))); - //System.out.println(response.getEmployees().get(0).toString()); - } - - @Test - public void getEmployeeTest() throws IOException { - System.out.println("@Test - getEmployee"); - UUID employeeID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Employees response = api.getEmployee(employeeID); - - assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("972615c5-ad3d-47a0-b579-20370d374578")))); - assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); - assertThat(response.getEmployees().get(0).getFirstName(), is(equalTo("Tony"))); - assertThat(response.getEmployees().get(0).getLastName(), is(equalTo("Stark"))); - assertThat(response.getEmployees().get(0).getExternalLink().getUrl(), is(equalTo("http://twitter.com/#!/search/Stark+Industries"))); - assertThat(response.getEmployees().get(0).getExternalLink().getDescription(), is(equalTo("Go to external link"))); - assertThat(response.getEmployees().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:18:01.593-07:00")))); - //System.out.println(response.getEmployees().get(0).toString()); - } - - - @Test - public void getEmployeesTest() throws IOException { - System.out.println("@Test - getEmployees"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - Employees response = api.getEmployees(ifModifiedSince, where, order); - - assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("972615c5-ad3d-47a0-b579-20370d374578")))); - assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); - assertThat(response.getEmployees().get(0).getFirstName(), is(equalTo("Tony"))); - assertThat(response.getEmployees().get(0).getLastName(), is(equalTo("Stark"))); - assertThat(response.getEmployees().get(0).getExternalLink().getUrl(), is(equalTo("http://twitter.com/#!/search/Stark+Industries"))); - assertThat(response.getEmployees().get(0).getExternalLink().getDescription(), is(equalTo("Go to external link"))); - assertThat(response.getEmployees().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:18:01.593-07:00")))); - //System.out.println(response.getEmployees().get(0).toString()); - } - - @Test - public void updateEmployeeTest() throws IOException { - System.out.println("@Test - updateEmployee"); - UUID employeeID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Employees employees = null; - Employees response = api.updateEmployee(employeeID, employees); - - assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("ad3db144-6362-459c-8c36-5d31d196e629")))); - assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); - assertThat(response.getEmployees().get(0).getFirstName(), is(equalTo("Bruce"))); - assertThat(response.getEmployees().get(0).getLastName(), is(equalTo("Banner"))); - assertThat(response.getEmployees().get(0).getExternalLink().getUrl(), is(equalTo("http://twitter.com/#!/search/Nick+Fury"))); - assertThat(response.getEmployees().get(0).getExternalLink().getDescription(), is(equalTo("Go to external link"))); - assertThat(response.getEmployees().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:24:41.303-07:00")))); - //System.out.println(response.getEmployees().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java deleted file mode 100644 index 320a7b7a..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiExpenseClaimsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createExpenseClaimTest() throws IOException { - System.out.println("@Test - createExpenseClaim"); - ExpenseClaims expenseClaims = null; - Boolean summarizeErrors = null; - ExpenseClaims response = api.createExpenseClaim(expenseClaims, summarizeErrors); - - assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); - assertThat(response.getExpenseClaims().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED))); - assertThat(response.getExpenseClaims().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); - assertThat(response.getExpenseClaims().get(0).getUser().getFirstName(), is(equalTo("API "))); - assertThat(response.getExpenseClaims().get(0).getUser().getLastName(), is(equalTo("Team"))); - assertThat(response.getExpenseClaims().get(0).getUser().getEmailAddress(), is(equalTo("api@xero.com"))); - assertThat(response.getExpenseClaims().get(0).getUser().getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-11-29T04:06:19.217-08:00")))); - assertThat(response.getExpenseClaims().get(0).getUser().getIsSubscriber(), is(equalTo(true))); - assertThat(response.getExpenseClaims().get(0).getUser().getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); - assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 11)))); - assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("dc1c7f6d-0a4c-402f-acac-551d62ce5816")))); - assertThat(response.getExpenseClaims().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:37:30.107-07:00")))); - assertThat(response.getExpenseClaims().get(0).getTotal(), is(equalTo(40.0))); - assertThat(response.getExpenseClaims().get(0).getTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getExpenseClaims().get(0).getAmountDue(), is(equalTo(40.0))); - assertThat(response.getExpenseClaims().get(0).getAmountDue().toString(), is(equalTo("40.0"))); - assertThat(response.getExpenseClaims().get(0).getAmountPaid(), is(equalTo(0.0))); - assertThat(response.getExpenseClaims().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); - //assertThat(response.getExpenseClaims().get(0).getPayments(), is(equalTo("CONTAINER_PLACEHOLDER"))); - //assertThat(response.getExpenseClaims().get(0).getPaymentDueDate(), is(equalTo(LocalDate.of(YYYY, MM, DD)))); - //assertThat(response.getExpenseClaims().get(0).getReportingDate(), is(equalTo(LocalDate.of(YYYY, MM, DD)))); - //assertThat(response.getExpenseClaims().get(0).getReceiptID(), is(equalTo(UUID.fromString("UUID_PLACEHOLDER")))); - //System.out.println(response.getExpenseClaims().get(0).toString()); - } - - @Test - public void createExpenseClaimHistoryTest() throws IOException { - System.out.println("@Test - createExpenseClaimHistory not implemented"); - UUID expenseClaimID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords historyRecords = null; - //HistoryRecords response = api.createExpenseClaimHistory(expenseClaimID, historyRecords); - - // TODO: test validations - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getExpenseClaimTest() throws IOException { - System.out.println("@Test - getExpenseClaim"); - UUID expenseClaimID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - ExpenseClaims response = api.getExpenseClaim(expenseClaimID); - - assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); - assertThat(response.getExpenseClaims().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED))); - assertThat(response.getExpenseClaims().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); - assertThat(response.getExpenseClaims().get(0).getUser().getFirstName(), is(equalTo("API "))); - assertThat(response.getExpenseClaims().get(0).getUser().getLastName(), is(equalTo("Team"))); - assertThat(response.getExpenseClaims().get(0).getUser().getEmailAddress(), is(equalTo("api@xero.com"))); - assertThat(response.getExpenseClaims().get(0).getUser().getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-11-29T04:06:19.217-08:00")))); - assertThat(response.getExpenseClaims().get(0).getUser().getIsSubscriber(), is(equalTo(true))); - assertThat(response.getExpenseClaims().get(0).getUser().getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); - assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 11)))); - assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("dc1c7f6d-0a4c-402f-acac-551d62ce5816")))); - assertThat(response.getExpenseClaims().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:37:31.767-07:00")))); - assertThat(response.getExpenseClaims().get(0).getTotal(), is(equalTo(40.0))); - assertThat(response.getExpenseClaims().get(0).getTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getExpenseClaims().get(0).getAmountDue(), is(equalTo(40.0))); - assertThat(response.getExpenseClaims().get(0).getAmountDue().toString(), is(equalTo("40.0"))); - assertThat(response.getExpenseClaims().get(0).getAmountPaid(), is(equalTo(0.0))); - assertThat(response.getExpenseClaims().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); - //System.out.println(response.getExpenseClaims().get(0).toString()); - } - - @Test - public void getExpenseClaimHistoryTest() throws IOException { - System.out.println("@Test - getExpenseClaimHistory"); - UUID expenseClaimID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = api.getExpenseClaimHistory(expenseClaimID); - - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Voided"))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:37:36.747-07:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getExpenseClaimsTest() throws IOException { - System.out.println("@Test - getExpenseClaims"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - ExpenseClaims response = api.getExpenseClaims(ifModifiedSince, where, order); - - // TODO: test validations - assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); - assertThat(response.getExpenseClaims().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED))); - assertThat(response.getExpenseClaims().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); - assertThat(response.getExpenseClaims().get(0).getUser().getFirstName(), is(equalTo("API "))); - assertThat(response.getExpenseClaims().get(0).getUser().getLastName(), is(equalTo("Team"))); - assertThat(response.getExpenseClaims().get(0).getUser().getEmailAddress(), is(equalTo("api@xero.com"))); - assertThat(response.getExpenseClaims().get(0).getUser().getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-11-29T04:06:19.217-08:00")))); - assertThat(response.getExpenseClaims().get(0).getUser().getIsSubscriber(), is(equalTo(true))); - assertThat(response.getExpenseClaims().get(0).getUser().getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); - assertThat(response.getExpenseClaims().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:37:31.767-07:00")))); - assertThat(response.getExpenseClaims().get(0).getTotal(), is(equalTo(40.0))); - assertThat(response.getExpenseClaims().get(0).getTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getExpenseClaims().get(0).getAmountDue(), is(equalTo(40.0))); - assertThat(response.getExpenseClaims().get(0).getAmountDue().toString(), is(equalTo("40.0"))); - assertThat(response.getExpenseClaims().get(0).getAmountPaid(), is(equalTo(0.0))); - assertThat(response.getExpenseClaims().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); - //System.out.println(response.getExpenseClaims().get(0).toString()); - } - - @Test - public void updateExpenseClaimTest() throws IOException { - System.out.println("@Test - updateExpenseClaim"); - UUID expenseClaimID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - ExpenseClaims expenseClaims = null; - ExpenseClaims response = api.updateExpenseClaim(expenseClaimID, expenseClaims); - - // TODO: test validations - assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); - assertThat(response.getExpenseClaims().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED))); - assertThat(response.getExpenseClaims().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); - assertThat(response.getExpenseClaims().get(0).getUser().getFirstName(), is(equalTo("API "))); - assertThat(response.getExpenseClaims().get(0).getUser().getLastName(), is(equalTo("Team"))); - assertThat(response.getExpenseClaims().get(0).getUser().getEmailAddress(), is(equalTo("api@xero.com"))); - assertThat(response.getExpenseClaims().get(0).getUser().getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-11-29T04:06:19.217-08:00")))); - assertThat(response.getExpenseClaims().get(0).getUser().getIsSubscriber(), is(equalTo(true))); - assertThat(response.getExpenseClaims().get(0).getUser().getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); - assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 11)))); - assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("dc1c7f6d-0a4c-402f-acac-551d62ce5816")))); - assertThat(response.getExpenseClaims().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:37:31.767-07:00")))); - assertThat(response.getExpenseClaims().get(0).getTotal(), is(equalTo(40.0))); - assertThat(response.getExpenseClaims().get(0).getTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getExpenseClaims().get(0).getAmountDue(), is(equalTo(40.0))); - assertThat(response.getExpenseClaims().get(0).getAmountDue().toString(), is(equalTo("40.0"))); - assertThat(response.getExpenseClaims().get(0).getAmountPaid(), is(equalTo(0.0))); - assertThat(response.getExpenseClaims().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); - //System.out.println(response.getExpenseClaims().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java deleted file mode 100644 index c1490cc3..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java +++ /dev/null @@ -1,368 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiInvoicesTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createInvoiceTest() throws IOException { - System.out.println("@Test - createInvoice"); - Invoices invoices = null; - Boolean summarizeErrors = null; - Invoices response = api.createInvoice(invoices, summarizeErrors); - - assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); - assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 10)))); - assertThat(response.getInvoices().get(0).getDueDate(), is(equalTo(LocalDate.of(2018, 12, 9)))); - assertThat(response.getInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getInvoices().get(0).getInvoiceNumber(), is(equalTo("INV-0007"))); - assertThat(response.getInvoices().get(0).getReference(), is(equalTo("Website Design"))); - assertThat(response.getInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getInvoices().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getInvoices().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED))); - assertThat(response.getInvoices().get(0).getSentToContact(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getSubTotal(), is(equalTo(40.0))); - assertThat(response.getInvoices().get(0).getSubTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getInvoices().get(0).getTotalTax(), is(equalTo(0.0))); - assertThat(response.getInvoices().get(0).getTotalTax().toString(), is(equalTo("0.0"))); - assertThat(response.getInvoices().get(0).getTotal(), is(equalTo(40.0))); - assertThat(response.getInvoices().get(0).getTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getInvoices().get(0).getInvoiceID(), is(equalTo(UUID.fromString("ed255415-e141-4150-aab7-89c3bbbb851c")))); - assertThat(response.getInvoices().get(0).getIsDiscounted(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getAmountDue(), is(equalTo(40.0))); - assertThat(response.getInvoices().get(0).getAmountDue().toString(), is(equalTo("40.0"))); - assertThat(response.getInvoices().get(0).getAmountPaid(), is(equalTo(0.0))); - assertThat(response.getInvoices().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); - assertThat(response.getInvoices().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:58:46.117-07:00")))); - assertThat(response.getInvoices().get(0).getHasErrors(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getInvoices().get(0).getContact().getName(), is(equalTo("Liam Gallagher"))); - assertThat(response.getInvoices().get(0).getContact().getFirstName(), is(equalTo("Liam"))); - assertThat(response.getInvoices().get(0).getContact().getLastName(), is(equalTo("Gallagher"))); - assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getFirstName(), is(equalTo("Debbie"))); - assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getLastName(), is(equalTo("Gwyther"))); - assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getEmailAddress(), is(equalTo("debbie@rockstar.com"))); - assertThat(response.getInvoices().get(0).getContact().getContactGroups().get(0).getName(), is(equalTo("Oasis"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("5f7a612b-fdcc-4d33-90fa-a9f6bc6db32f")))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getDescription(), is(equalTo("Acme Tires"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getQuantity(), is(equalTo(2.0))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxType(), is(equalTo("NONE"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(0.))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(40.0))); - //System.out.println(response.getInvoices().get(0).toString()); - } - - @Test - public void createInvoiceHistoryTest() throws IOException { - System.out.println("@Test - createInvoiceHistory"); - UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords historyRecords = null; - HistoryRecords response = api.createInvoiceHistory(invoiceID, historyRecords); - - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T12:08:03.349-07:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getInvoiceTest() throws IOException { - System.out.println("@Test - getInvoiceTest"); - UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Invoices response = api.getInvoice(invoiceID); - - assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); - assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,06)))); - assertThat(response.getInvoices().get(0).getDueDate(), is(equalTo(LocalDate.of(2019, 03, 12)))); - assertThat(response.getInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getInvoices().get(0).getInvoiceNumber(), is(equalTo("INV-0006"))); - assertThat(response.getInvoices().get(0).getReference(), is(equalTo("Tour"))); - assertThat(response.getInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getInvoices().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getInvoices().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Invoice.StatusEnum.PAID))); - assertThat(response.getInvoices().get(0).getSentToContact(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getSubTotal(), is(equalTo(148062.76))); - assertThat(response.getInvoices().get(0).getSubTotal().toString(), is(equalTo("148062.76"))); - assertThat(response.getInvoices().get(0).getTotalTax(), is(equalTo(0.0))); - assertThat(response.getInvoices().get(0).getTotalTax().toString(), is(equalTo("0.0"))); - assertThat(response.getInvoices().get(0).getTotal(), is(equalTo(148062.76))); - assertThat(response.getInvoices().get(0).getTotal().toString(), is(equalTo("148062.76"))); - assertThat(response.getInvoices().get(0).getInvoiceID(), is(equalTo(UUID.fromString("a03ffcd2-5d91-4c7e-b483-318584e9e439")))); - assertThat(response.getInvoices().get(0).getIsDiscounted(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getAmountDue(), is(equalTo(0.0))); - assertThat(response.getInvoices().get(0).getAmountDue().toString(), is(equalTo("0.0"))); - assertThat(response.getInvoices().get(0).getAmountPaid().toString(), is(equalTo("148062.76"))); - assertThat(response.getInvoices().get(0).getAmountPaid(), is(equalTo(148062.76))); - assertThat(response.getInvoices().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-07T09:59:28.133-08:00")))); - assertThat(response.getInvoices().get(0).getHasErrors(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getInvoices().get(0).getContact().getName(), is(equalTo("Liam Gallagher"))); - assertThat(response.getInvoices().get(0).getContact().getFirstName(), is(equalTo("Liam"))); - assertThat(response.getInvoices().get(0).getContact().getLastName(), is(equalTo("Gallagher"))); - assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getFirstName(), is(equalTo("Debbie"))); - assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getLastName(), is(equalTo("Gwyther"))); - assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getEmailAddress(), is(equalTo("debbie@rockstar.com"))); - assertThat(response.getInvoices().get(0).getContact().getContactGroups().get(0).getName(), is(equalTo("Oasis"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("b18f39d9-7739-4246-9288-72afe939d2d5")))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getDescription(), is(equalTo("Guitars Fender Strat"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(148062.76))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getItemCode(), is(equalTo("123"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxType(), is(equalTo("NONE"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(0.0))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(148062.76))); - assertThat(response.getInvoices().get(0).getHasAttachments(), is(equalTo(true))); - assertThat(response.getInvoices().get(0).getFullyPaidOnDate(), is(equalTo(LocalDate.of(2019,03,18)))); - assertThat(response.getInvoices().get(0).getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,18)))); - assertThat(response.getInvoices().get(0).getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getInvoices().get(0).getPayments().get(0).getAmount(), is(equalTo(148062.76))); - assertThat(response.getInvoices().get(0).getPayments().get(0).getReference(), is(equalTo("Yahoo"))); - assertThat(response.getInvoices().get(0).getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("38928000-e9a0-420c-8884-f624bab2a351")))); - assertThat(response.getInvoices().get(0).getPayments().get(0).getHasAccount(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("3a2fe7e0-fac7-4ea2-afb2-31cedaabd294")))); - assertThat(response.getInvoices().get(0).getAttachments().get(0).getFileName(), is(equalTo("helo-heros.jpg"))); - assertThat(response.getInvoices().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Invoices/a03ffcd2-5d91-4c7e-b483-318584e9e439/Attachments/helo-heros.jpg"))); - assertThat(response.getInvoices().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getInvoices().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/jpeg"))); - assertThat(response.getInvoices().get(0).getStatusAttributeString(), is(equalTo("ERROR"))); - assertThat(response.getInvoices().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Invoice # must be unique."))); - //System.out.println(response.getInvoices().get(0).toString()); - } - - @Test - public void getInvoiceAttachmentsTest() throws IOException { - System.out.println("@Test - getInvoiceAttachments"); - UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Attachments response = api.getInvoiceAttachments(invoiceID); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("9808ad7f-c8d4-41cf-995e-bc29cb76fd2c")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("foobar.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Invoices/4074292c-09b3-456d-84e7-add864c6c39b/Attachments/foobar.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - @Test - public void getInvoiceHistoryTest() throws IOException { - System.out.println("@Test - getInvoiceHistory"); - UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = api.getInvoiceHistory(invoiceID); - - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Paid"))); - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Payment received from Liam Gallagher on 19 March 2019 for 148,062.76. This invoice has been fully paid."))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-07T09:59:28.133-08:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getInvoicesTest() throws IOException { - System.out.println("@Test - getInvoices"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - String ids = null; - String invoiceNumbers = null; - String contactIDs = null; - String statuses = null; - Integer page = null; - Boolean includeArchived = null; - Boolean createdByMyApp = null; - Integer unitdp = null; - Invoices response = api.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); - - assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); - assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2018,10,19)))); - assertThat(response.getInvoices().get(0).getDueDate(), is(equalTo(LocalDate.of(2018,12,29)))); - assertThat(response.getInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getInvoices().get(0).getInvoiceNumber(), is(equalTo("INV-0001"))); - assertThat(response.getInvoices().get(0).getReference(), is(equalTo("Red Fish, Blue Fish"))); - assertThat(response.getInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getInvoices().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getInvoices().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Invoice.StatusEnum.VOIDED))); - assertThat(response.getInvoices().get(0).getSentToContact(), is(equalTo(true))); - assertThat(response.getInvoices().get(0).getSubTotal(), is(equalTo(40.0))); - assertThat(response.getInvoices().get(0).getSubTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getInvoices().get(0).getTotalTax(), is(equalTo(0.0))); - assertThat(response.getInvoices().get(0).getTotalTax().toString(), is(equalTo("0.0"))); - assertThat(response.getInvoices().get(0).getTotal(), is(equalTo(40.0))); - assertThat(response.getInvoices().get(0).getTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getInvoices().get(0).getInvoiceID(), is(equalTo(UUID.fromString("d4956132-ed94-4dd7-9eaa-aa22dfdf06f2")))); - assertThat(response.getInvoices().get(0).getIsDiscounted(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getAmountDue(), is(equalTo(0.0))); - assertThat(response.getInvoices().get(0).getAmountDue().toString(), is(equalTo("0.0"))); - assertThat(response.getInvoices().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); - assertThat(response.getInvoices().get(0).getAmountPaid(), is(equalTo(0.0))); - assertThat(response.getInvoices().get(0).getAmountCredited().toString(), is(equalTo("0.0"))); - assertThat(response.getInvoices().get(0).getAmountCredited(), is(equalTo(0.0))); - assertThat(response.getInvoices().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:31:30.160-07:00")))); - assertThat(response.getInvoices().get(0).getHasErrors(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("a3675fc4-f8dd-4f03-ba5b-f1870566bcd7")))); - assertThat(response.getInvoices().get(0).getContact().getName(), is(equalTo("Barney Rubble-83203"))); - //System.out.println(response.getInvoices().get(0).toString()); - } - - @Test - public void getOnlineInvoiceTest() throws IOException { - System.out.println("@Test - getOnlineInvoice"); - UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - OnlineInvoices response = api.getOnlineInvoice(invoiceID); - - assertThat(response.getOnlineInvoices().get(0).getOnlineInvoiceUrl(), is(equalTo("https://in.xero.com/bCWCCfytGdTXoJam9HENWlQt07G6zcDaj4gQojHu"))); - //System.out.println(response.getOnlineInvoices().get(0).toString()); - } - - @Test - public void updateInvoiceTest() throws IOException { - System.out.println("@Test - updateInvoice"); - UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Invoices invoices = null; - Invoices response = api.updateInvoice(invoiceID, invoices); - - assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); - assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,10)))); - assertThat(response.getInvoices().get(0).getDueDate(), is(equalTo(LocalDate.of(2019, 03, 11)))); - assertThat(response.getInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getInvoices().get(0).getInvoiceNumber(), is(equalTo("INV-0008"))); - assertThat(response.getInvoices().get(0).getReference(), is(equalTo("My the Force be With You"))); - assertThat(response.getInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getInvoices().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getInvoices().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Invoice.StatusEnum.SUBMITTED))); - assertThat(response.getInvoices().get(0).getSentToContact(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getSubTotal(), is(equalTo(500.0))); - assertThat(response.getInvoices().get(0).getSubTotal().toString(), is(equalTo("500.0"))); - assertThat(response.getInvoices().get(0).getTotalTax(), is(equalTo(75.0))); - assertThat(response.getInvoices().get(0).getTotalTax().toString(), is(equalTo("75.0"))); - assertThat(response.getInvoices().get(0).getTotal(), is(equalTo(575.0))); - assertThat(response.getInvoices().get(0).getTotal().toString(), is(equalTo("575.0"))); - assertThat(response.getInvoices().get(0).getInvoiceID(), is(equalTo(UUID.fromString("4074292c-09b3-456d-84e7-add864c6c39b")))); - assertThat(response.getInvoices().get(0).getIsDiscounted(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getAmountDue(), is(equalTo(575.0))); - assertThat(response.getInvoices().get(0).getAmountDue().toString(), is(equalTo("575.0"))); - assertThat(response.getInvoices().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); - assertThat(response.getInvoices().get(0).getAmountPaid(), is(equalTo(0.0))); - assertThat(response.getInvoices().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T11:42:08.987-07:00")))); - assertThat(response.getInvoices().get(0).getHasErrors(), is(equalTo(false))); - assertThat(response.getInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("be392c72-c121-4f83-9512-03ac71e54c20")))); - assertThat(response.getInvoices().get(0).getContact().getName(), is(equalTo("Luke Skywalker"))); - assertThat(response.getInvoices().get(0).getContact().getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("6de1bf9f-de95-4c47-9287-37305db758c9")))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getDescription(), is(equalTo("Light Saber"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(500.00))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxType(), is(equalTo("OUTPUT2"))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(75.0))); - assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(500.00))); - //System.out.println(response.getInvoices().get(0).toString()); - } - - @Test - public void updateInvoiceAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - updateInvoiceAttachmentByFileName"); - UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - String fileName = "sample5.jpg"; - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - Attachments response = api.updateInvoiceAttachmentByFileName(invoiceID, fileName, body); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("08085449-fda3-45f4-a685-ff44c8a29ee3")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Invoices/4074292c-09b3-456d-84e7-add864c6c39b/Attachments/HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - @Test - public void getInvoiceRemindersTest() throws IOException { - System.out.println("@Test - getInvoiceReminders"); - InvoiceReminders response = api.getInvoiceReminders(); - - assertThat(response.getInvoiceReminders().get(0).getEnabled(), is(equalTo(false))); - //System.out.println(response.getInvoiceReminders().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java deleted file mode 100644 index b37a9b7e..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiItemsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createItemTest() throws IOException { - System.out.println("@Test - createItem"); - Items items = null; - Items response = api.createItem(items); - - assertThat(response.getItems().get(0).getCode(), is(equalTo("abc65591"))); - assertThat(response.getItems().get(0).getName(), is(equalTo("Hello11350"))); - assertThat(response.getItems().get(0).getIsSold(), is(equalTo(true))); - assertThat(response.getItems().get(0).getIsPurchased(), is(equalTo(true))); - assertThat(response.getItems().get(0).getDescription(), is(equalTo("foobar"))); - assertThat(response.getItems().get(0).getIsTrackedAsInventory(), is(equalTo(false))); - assertThat(response.getItems().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T12:17:51.707-07:00")))); - assertThat(response.getItems().get(0).getItemID(), is(equalTo(UUID.fromString("a4544d51-48f6-441f-a623-99ecbced6ab7")))); - assertThat(response.getItems().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Price List Item with Code 'abc' already exists"))); - //System.out.println(response.getItems().get(0).toString()); - } - - @Test - public void createItemHistoryTest() throws IOException { - System.out.println("@Test - createItemHistory - not implemented"); - UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords historyRecords = null; - //HistoryRecords response = api.createItemHistory(itemID, historyRecords); - // TODO: test validations - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getItemTest() throws IOException { - System.out.println("@Test - getItem"); - UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Items response = api.getItem(itemID); - - assertThat(response.getItems().get(0).getCode(), is(equalTo("123"))); - assertThat(response.getItems().get(0).getInventoryAssetAccountCode(), is(equalTo("630"))); - assertThat(response.getItems().get(0).getName(), is(equalTo("Guitars"))); - assertThat(response.getItems().get(0).getIsSold(), is(equalTo(true))); - assertThat(response.getItems().get(0).getIsPurchased(), is(equalTo(true))); - assertThat(response.getItems().get(0).getDescription(), is(equalTo("Guitars Fender Strat"))); - assertThat(response.getItems().get(0).getPurchaseDescription(), is(equalTo("Brand new Fender Strats"))); - assertThat(response.getItems().get(0).getPurchaseDetails().getUnitPrice(), is(equalTo(2500.0))); - assertThat(response.getItems().get(0).getPurchaseDetails().getCoGSAccountCode(), is(equalTo("310"))); - assertThat(response.getItems().get(0).getPurchaseDetails().getTaxType(), is(equalTo("INPUT2"))); - assertThat(response.getItems().get(0).getSalesDetails().getUnitPrice(), is(equalTo(5000.0))); - assertThat(response.getItems().get(0).getSalesDetails().getAccountCode(), is(equalTo("200"))); - assertThat(response.getItems().get(0).getSalesDetails().getTaxType(), is(equalTo("OUTPUT2"))); - assertThat(response.getItems().get(0).getIsTrackedAsInventory(), is(equalTo(true))); - assertThat(response.getItems().get(0).getTotalCostPool(), is(equalTo(25000.0))); - assertThat(response.getItems().get(0).getTotalCostPool().toString(), is(equalTo("25000.0"))); - assertThat(response.getItems().get(0).getQuantityOnHand(), is(equalTo(10.0))); - assertThat(response.getItems().get(0).getQuantityOnHand().toString(), is(equalTo("10.0"))); - assertThat(response.getItems().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T12:41:49.387-07:00")))); - assertThat(response.getItems().get(0).getItemID(), is(equalTo(UUID.fromString("c8c54d65-f3f2-452d-926e-bf450b12fb07")))); - //System.out.println(response.getItems().get(0).toString()); - } - - @Test - public void getItemHistoryTest() throws IOException { - System.out.println("@Test - getItemHistory"); - UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = api.getItemHistory(itemID); - - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Created"))); - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Item 123 - Guitars created."))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-07T09:57:56-08:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getItemsTest() throws IOException { - System.out.println("@Test - getItems"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - Integer unitdp = null; - Items response = api.getItems(ifModifiedSince, where, order, unitdp); - - assertThat(response.getItems().get(0).getCode(), is(equalTo("123"))); - assertThat(response.getItems().get(0).getName(), is(equalTo("Guitars"))); - assertThat(response.getItems().get(0).getIsSold(), is(equalTo(true))); - assertThat(response.getItems().get(0).getIsPurchased(), is(equalTo(false))); - assertThat(response.getItems().get(0).getDescription(), is(equalTo("Guitars Fender Strat"))); - assertThat(response.getItems().get(0).getSalesDetails().getUnitPrice(), is(equalTo(5000.0))); - assertThat(response.getItems().get(0).getSalesDetails().getAccountCode(), is(equalTo("200"))); - assertThat(response.getItems().get(0).getSalesDetails().getTaxType(), is(equalTo("OUTPUT2"))); - assertThat(response.getItems().get(0).getIsTrackedAsInventory(), is(equalTo(false))); - assertThat(response.getItems().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-07T09:57:56.267-08:00")))); - assertThat(response.getItems().get(0).getItemID(), is(equalTo(UUID.fromString("c8c54d65-f3f2-452d-926e-bf450b12fb07")))); - //System.out.println(response.getItems().get(0).toString()); - } - - @Test - public void updateItemTest() throws IOException { - System.out.println("@Test - updateItem"); - UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Items items = null; - Items response = api.updateItem(itemID, items); - - assertThat(response.getItems().get(0).getCode(), is(equalTo("abc38306"))); - assertThat(response.getItems().get(0).getName(), is(equalTo("Hello8746"))); - assertThat(response.getItems().get(0).getIsSold(), is(equalTo(true))); - assertThat(response.getItems().get(0).getIsPurchased(), is(equalTo(true))); - assertThat(response.getItems().get(0).getDescription(), is(equalTo("Hello Xero"))); - assertThat(response.getItems().get(0).getIsTrackedAsInventory(), is(equalTo(false))); - assertThat(response.getItems().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T12:29:18.924-07:00")))); - assertThat(response.getItems().get(0).getItemID(), is(equalTo(UUID.fromString("a7e87086-e0ae-4df2-83d7-e26e9a6b7786")))); - //System.out.println(response.getItems().get(0).toString()); - } - - @Test - public void deleteItemTest() throws IOException { - System.out.println("@Test - deleteItem"); - UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - api.deleteItem(itemID); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java deleted file mode 100644 index ae1007f0..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiJournalsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void getJournalTest() throws IOException { - System.out.println("@Test - getJournal"); - UUID journalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Journals response = api.getJournal(journalID); - - assertThat(response.getJournals().get(0).getJournalID(), is(equalTo(UUID.fromString("1b31feeb-aa23-404c-8c19-24c827c53661")))); - assertThat(response.getJournals().get(0).getJournalDate(), is(equalTo(LocalDate.of(2018,10,19)))); - assertThat(response.getJournals().get(0).getJournalNumber(), is(equalTo("1"))); - assertThat(response.getJournals().get(0).getCreatedDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:30:43.467-07:00")))); - assertThat(response.getJournals().get(0).getReference(), is(equalTo("Red Fish, Blue Fish"))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getJournalLineID(), is(equalTo(UUID.fromString("81e6b1bf-d812-4f87-8dc4-698558ae043e")))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountID(), is(equalTo(UUID.fromString("b94495d0-44ab-4199-a1d0-427a4877e100")))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountCode(), is(equalTo("610"))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountType(), is(equalTo(com.xero.models.accounting.AccountType.CURRENT))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountName(), is(equalTo("Accounts Receivable"))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getNetAmount(), is(equalTo(40.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getNetAmount().toString(), is(equalTo("40.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getGrossAmount(), is(equalTo(40.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getGrossAmount().toString(), is(equalTo("40.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getTaxAmount(), is(equalTo(0.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getTaxAmount().toString(), is(equalTo("0.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getJournalLineID(), is(equalTo(UUID.fromString("ad221a8c-ebee-4c1b-88ed-d574e27e8803")))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountID(), is(equalTo(UUID.fromString("e0a5d892-9f9f-44f0-a153-5cb7db125170")))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountCode(), is(equalTo("200"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountType(), is(equalTo(com.xero.models.accounting.AccountType.REVENUE))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountName(), is(equalTo("Sales"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getDescription(), is(equalTo("Acme Tires"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getNetAmount(), is(equalTo(-40.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getNetAmount().toString(), is(equalTo("-40.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getGrossAmount(), is(equalTo(-40.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getGrossAmount().toString(), is(equalTo("-40.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxAmount(), is(equalTo(0.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxAmount().toString(), is(equalTo("0.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxType(), is(equalTo("NONE"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxName(), is(equalTo("No GST"))); - //System.out.println(response.getJournals().get(0).toString()); - } - - - @Test - public void getJournalsTest() throws IOException { - System.out.println("@Test - getJournals"); - OffsetDateTime ifModifiedSince = null; - Integer offset = null; - Boolean paymentsOnly = null; - Journals response = api.getJournals(ifModifiedSince, offset, paymentsOnly); - - assertThat(response.getJournals().get(0).getJournalID(), is(equalTo(UUID.fromString("1b31feeb-aa23-404c-8c19-24c827c53661")))); - assertThat(response.getJournals().get(0).getJournalDate(), is(equalTo(LocalDate.of(2018,10,19)))); - assertThat(response.getJournals().get(0).getJournalNumber(), is(equalTo("1"))); - assertThat(response.getJournals().get(0).getCreatedDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:30:43.467-07:00")))); - assertThat(response.getJournals().get(0).getReference(), is(equalTo("Red Fish, Blue Fish"))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getJournalLineID(), is(equalTo(UUID.fromString("81e6b1bf-d812-4f87-8dc4-698558ae043e")))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountID(), is(equalTo(UUID.fromString("b94495d0-44ab-4199-a1d0-427a4877e100")))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountCode(), is(equalTo("610"))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountType(), is(equalTo(com.xero.models.accounting.AccountType.CURRENT))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountName(), is(equalTo("Accounts Receivable"))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getNetAmount(), is(equalTo(40.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getNetAmount().toString(), is(equalTo("40.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getGrossAmount(), is(equalTo(40.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getGrossAmount().toString(), is(equalTo("40.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getTaxAmount(), is(equalTo(0.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(0).getTaxAmount().toString(), is(equalTo("0.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getJournalLineID(), is(equalTo(UUID.fromString("ad221a8c-ebee-4c1b-88ed-d574e27e8803")))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountID(), is(equalTo(UUID.fromString("e0a5d892-9f9f-44f0-a153-5cb7db125170")))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountCode(), is(equalTo("200"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountType(), is(equalTo(com.xero.models.accounting.AccountType.REVENUE))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountName(), is(equalTo("Sales"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getDescription(), is(equalTo("Acme Tires"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getNetAmount(), is(equalTo(-40.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getNetAmount().toString(), is(equalTo("-40.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getGrossAmount(), is(equalTo(-40.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getGrossAmount().toString(), is(equalTo("-40.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxAmount(), is(equalTo(0.0))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxAmount().toString(), is(equalTo("0.0"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxType(), is(equalTo("NONE"))); - assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxName(), is(equalTo("No GST"))); - //System.out.println(response.getJournals().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java deleted file mode 100644 index 75fd8587..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiLinkedTransactionsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createLinkedTransactionTest() throws IOException { - System.out.println("@Test - createLinkedTransaction"); - LinkedTransactions linkedTransactions = null; - LinkedTransactions response = api.createLinkedTransaction(linkedTransactions); - - assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("a848644a-f20f-4630-98c3-386bd7505631")))); - assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("b0df260d-3cc8-4ced-9bd6-41924f624ed3")))); - assertThat(response.getLinkedTransactions().get(0).getLinkedTransactionID(), is(equalTo(UUID.fromString("e9684b6c-4df9-45a0-917b-85cc29857008")))); - assertThat(response.getLinkedTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.LinkedTransaction.StatusEnum.DRAFT))); - assertThat(response.getLinkedTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.LinkedTransaction.TypeEnum.BILLABLEEXPENSE))); - assertThat(response.getLinkedTransactions().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T17:37:35-07:00")))); - assertThat(response.getLinkedTransactions().get(0).getSourceTransactionTypeCode(), is(equalTo(com.xero.models.accounting.LinkedTransaction.SourceTransactionTypeCodeEnum.ACCPAY))); - assertThat(response.getLinkedTransactions().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("The SourceLineItemID and SourceTransactionID do not match"))); - //System.out.println(response.getLinkedTransactions().get(0).toString()); - } - - @Test - public void deleteLinkedTransactionTest() throws IOException { - System.out.println("@Test - deleteLinkedTransaction"); - UUID linkedTransactionID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - api.deleteLinkedTransaction(linkedTransactionID); - } - - @Test - public void getLinkedTransactionTest() throws IOException { - System.out.println("@Test - getLinkedTransaction"); - UUID linkedTransactionID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - LinkedTransactions response = api.getLinkedTransaction(linkedTransactionID); - - assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("aec416dd-38ea-40dc-9f0b-813c8c71f87f")))); - assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("77e0b23b-5b79-4f4b-ae20-c9031d41442f")))); - assertThat(response.getLinkedTransactions().get(0).getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getLinkedTransactions().get(0).getTargetTransactionID(), is(equalTo(UUID.fromString("83693fc1-5b05-4807-b190-109d4a85dd5f")))); - assertThat(response.getLinkedTransactions().get(0).getTargetLineItemID(), is(equalTo(UUID.fromString("d5128ff1-0f39-4d2a-a6d5-46dfaf5f075c")))); - assertThat(response.getLinkedTransactions().get(0).getLinkedTransactionID(), is(equalTo(UUID.fromString("5cf7d9c0-b9a7-4433-a2dc-ae3c11bba39b")))); - assertThat(response.getLinkedTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.LinkedTransaction.StatusEnum.ONDRAFT))); - assertThat(response.getLinkedTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.LinkedTransaction.TypeEnum.BILLABLEEXPENSE))); - assertThat(response.getLinkedTransactions().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T16:46:31-07:00")))); - assertThat(response.getLinkedTransactions().get(0).getSourceTransactionTypeCode(), is(equalTo(com.xero.models.accounting.LinkedTransaction.SourceTransactionTypeCodeEnum.ACCPAY))); - //System.out.println(response.getLinkedTransactions().get(0).toString()); - } - - @Test - public void getLinkedTransactionsTest() throws IOException { - System.out.println("@Test - getLinkedTransactions"); - Integer page = null; - String linkedTransactionID = null; - String sourceTransactionID = null; - String contactID = null; - String status = null; - String targetTransactionID = null; - LinkedTransactions response = api.getLinkedTransactions(page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); - - assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("aec416dd-38ea-40dc-9f0b-813c8c71f87f")))); - assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("77e0b23b-5b79-4f4b-ae20-c9031d41442f")))); - assertThat(response.getLinkedTransactions().get(0).getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getLinkedTransactions().get(0).getTargetTransactionID(), is(equalTo(UUID.fromString("83693fc1-5b05-4807-b190-109d4a85dd5f")))); - assertThat(response.getLinkedTransactions().get(0).getTargetLineItemID(), is(equalTo(UUID.fromString("d5128ff1-0f39-4d2a-a6d5-46dfaf5f075c")))); - assertThat(response.getLinkedTransactions().get(0).getLinkedTransactionID(), is(equalTo(UUID.fromString("5cf7d9c0-b9a7-4433-a2dc-ae3c11bba39b")))); - assertThat(response.getLinkedTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.LinkedTransaction.StatusEnum.ONDRAFT))); - assertThat(response.getLinkedTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.LinkedTransaction.TypeEnum.BILLABLEEXPENSE))); - assertThat(response.getLinkedTransactions().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T16:46:31-07:00")))); - assertThat(response.getLinkedTransactions().get(0).getSourceTransactionTypeCode(), is(equalTo(com.xero.models.accounting.LinkedTransaction.SourceTransactionTypeCodeEnum.ACCPAY))); - //System.out.println(response.getLinkedTransactions().get(0).toString()); - } - - @Test - public void updateLinkedTransactionTest() throws IOException { - System.out.println("@Test - updateLinkedTransaction"); - UUID linkedTransactionID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - LinkedTransactions linkedTransactions = null; - LinkedTransactions response = api.updateLinkedTransaction(linkedTransactionID, linkedTransactions); - - assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("a848644a-f20f-4630-98c3-386bd7505631")))); - assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("b0df260d-3cc8-4ced-9bd6-41924f624ed3")))); - assertThat(response.getLinkedTransactions().get(0).getContactID(), is(equalTo(UUID.fromString("4e1753b9-018a-4775-b6aa-1bc7871cfee3")))); - assertThat(response.getLinkedTransactions().get(0).getLinkedTransactionID(), is(equalTo(UUID.fromString("e9684b6c-4df9-45a0-917b-85cc29857008")))); - assertThat(response.getLinkedTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.LinkedTransaction.StatusEnum.DRAFT))); - assertThat(response.getLinkedTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.LinkedTransaction.TypeEnum.BILLABLEEXPENSE))); - assertThat(response.getLinkedTransactions().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T17:37:35-07:00")))); - assertThat(response.getLinkedTransactions().get(0).getSourceTransactionTypeCode(), is(equalTo(com.xero.models.accounting.LinkedTransaction.SourceTransactionTypeCodeEnum.ACCPAY))); - //System.out.println(response.getLinkedTransactions().get(0).toString()); - } -} \ No newline at end of file diff --git a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java deleted file mode 100644 index 949721aa..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java +++ /dev/null @@ -1,252 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiManualJournalsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createManualJournalTest() throws IOException { - System.out.println("@Test - createManualJournal"); - ManualJournals manualJournals = null; - ManualJournals response = api.createManualJournal(manualJournals); - - assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Foo bar"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount(), is(equalTo(100.0))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount().toString(), is(equalTo("100.0"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getAccountCode(), is(equalTo("400"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getDescription(), is(equalTo("Hello there"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getTaxType(), is(equalTo("NONE"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getIsBlank(), is(equalTo(false))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount(), is(equalTo(-100.0))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount().toString(), is(equalTo("-100.0"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getAccountCode(), is(equalTo("400"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getDescription(), is(equalTo("Goodbye"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTaxType(), is(equalTo("NONE"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTracking().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("6a68adde-f210-4465-b0a9-0d8cc6f50762")))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTracking().get(0).getTrackingOptionID(), is(equalTo(UUID.fromString("dc54c220-0140-495a-b925-3246adc0075f")))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTracking().get(0).getName(), is(equalTo("Simpsons"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTracking().get(0).getOption(), is(equalTo("Bart"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getIsBlank(), is(equalTo(false))); - assertThat(response.getManualJournals().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,13)))); - assertThat(response.getManualJournals().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); - assertThat(response.getManualJournals().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ManualJournal.StatusEnum.DRAFT))); - assertThat(response.getManualJournals().get(0).getShowOnCashBasisReports(), is(equalTo(true))); - assertThat(response.getManualJournals().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-14T13:39:32.920-07:00")))); - assertThat(response.getManualJournals().get(0).getManualJournalID(), is(equalTo(UUID.fromString("d312dd5e-a53e-46d1-9d51-c569ef4570b7")))); - assertThat(response.getManualJournals().get(0).getWarnings().get(0).getMessage(), is(equalTo("Account code '476' has been removed as it does not match a recognised account."))); - assertThat(response.getManualJournals().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("The total debits (100.00) must equal total credits (-10.00)"))); - //System.out.println(response.getManualJournals().get(0).toString()); - } - - - @Test - public void createManualJournalAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - createManualJournalAttachmentByFileName"); - UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - String fileName = "sample5.jpg"; - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - Attachments response = api.createManualJournalAttachmentByFileName(manualJournalID, fileName, body); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("47ac97ff-d4f9-48a0-8a8e-49fae29129e7")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("foobar.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/ManualJournals/0b159335-606b-485f-b51b-97b3b32bad32/Attachments/foobar.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - @Test - public void getManualJournalTest() throws IOException { - System.out.println("@Test - getManualJournal"); - UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - ManualJournals response = api.getManualJournal(manualJournalID); - - assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("These aren't the droids you are looking for"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount(), is(equalTo(100.0))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount().toString(), is(equalTo("100.0"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getAccountCode(), is(equalTo("429"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getDescription(), is(equalTo("These aren't the droids you are looking for"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getTaxType(), is(equalTo("NONE"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getIsBlank(), is(equalTo(false))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount(), is(equalTo(-100.0))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount().toString(), is(equalTo("-100.0"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getAccountCode(), is(equalTo("200"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getDescription(), is(equalTo("Yes the are"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTaxType(), is(equalTo("NONE"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getIsBlank(), is(equalTo(false))); - assertThat(response.getManualJournals().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); - assertThat(response.getManualJournals().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); - assertThat(response.getManualJournals().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ManualJournal.StatusEnum.POSTED))); - assertThat(response.getManualJournals().get(0).getShowOnCashBasisReports(), is(equalTo(true))); - assertThat(response.getManualJournals().get(0).getHasAttachments(), is(equalTo(true))); - assertThat(response.getManualJournals().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T19:19:48.147-07:00")))); - assertThat(response.getManualJournals().get(0).getManualJournalID(), is(equalTo(UUID.fromString("99cb8353-ce73-4a5d-8e0d-8b0edf86cfc4")))); - assertThat(response.getManualJournals().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("166ca8f8-8bc6-4780-8466-a0e474d586ea")))); - assertThat(response.getManualJournals().get(0).getAttachments().get(0).getFileName(), is(equalTo("giphy.gif"))); - assertThat(response.getManualJournals().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/manualjournal/99cb8353-ce73-4a5d-8e0d-8b0edf86cfc4/Attachments/giphy.gif"))); - assertThat(response.getManualJournals().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/gif"))); - assertThat(response.getManualJournals().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("495727")))); - //System.out.println(response.getManualJournals().get(0).toString()); - } - - @Test - public void getManualJournalAttachmentsTest() throws IOException { - System.out.println("@Test - getManualJournalAttachments"); - UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Attachments response = api.getManualJournalAttachments(manualJournalID); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("16e86f32-3e25-4209-8662-c0dfd91b654c")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/ManualJournals/0b159335-606b-485f-b51b-97b3b32bad32/Attachments/HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - @Test - public void getManualJournalsTest() throws IOException { - System.out.println("@Test - getManualJournals"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - Integer page = null; - ManualJournals response = api.getManualJournals(ifModifiedSince, where, order, page); - - assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Reversal: These aren't the droids you are looking for"))); - assertThat(response.getManualJournals().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,20)))); - assertThat(response.getManualJournals().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); - assertThat(response.getManualJournals().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ManualJournal.StatusEnum.POSTED))); - assertThat(response.getManualJournals().get(0).getShowOnCashBasisReports(), is(equalTo(true))); - assertThat(response.getManualJournals().get(0).getHasAttachments(), is(equalTo(false))); - assertThat(response.getManualJournals().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T19:19:48.083-07:00")))); - assertThat(response.getManualJournals().get(0).getManualJournalID(), is(equalTo(UUID.fromString("0b159335-606b-485f-b51b-97b3b32bad32")))); - //System.out.println(response.getManualJournals().get(0).toString()); - } - - @Test - public void updateManualJournalTest() throws IOException { - System.out.println("@Test - updateManualJournal"); - UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - ManualJournals manualJournals = null; - ManualJournals response = api.updateManualJournal(manualJournalID, manualJournals); - - assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Hello Xero"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount(), is(equalTo(100.0))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount().toString(), is(equalTo("100.0"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getAccountCode(), is(equalTo("400"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getDescription(), is(equalTo("Hello there"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getTaxType(), is(equalTo("NONE"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getIsBlank(), is(equalTo(false))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount(), is(equalTo(-100.0))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount().toString(), is(equalTo("-100.0"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getAccountCode(), is(equalTo("400"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getDescription(), is(equalTo("Goodbye"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTaxType(), is(equalTo("NONE"))); - assertThat(response.getManualJournals().get(0).getHasAttachments(), is(equalTo(false))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getIsBlank(), is(equalTo(false))); - assertThat(response.getManualJournals().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,10)))); - assertThat(response.getManualJournals().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); - assertThat(response.getManualJournals().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ManualJournal.StatusEnum.DRAFT))); - assertThat(response.getManualJournals().get(0).getShowOnCashBasisReports(), is(equalTo(true))); - assertThat(response.getManualJournals().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T19:28:56.820-07:00")))); - assertThat(response.getManualJournals().get(0).getManualJournalID(), is(equalTo(UUID.fromString("07eac261-78ef-47a0-a0eb-a57b74137877")))); - //System.out.println(response.getManualJournals().get(0).toString()); - } - - @Test - public void updateManualJournalAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - updateManualJournalAttachmentByFileName"); - UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - String fileName = "sample5.jpg"; - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - Attachments response = api.updateManualJournalAttachmentByFileName(manualJournalID, fileName, body); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("16e86f32-3e25-4209-8662-c0dfd91b654c")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/ManualJournals/0b159335-606b-485f-b51b-97b3b32bad32/Attachments/HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java deleted file mode 100644 index 71e6108e..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiOrganisationsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void getOrganisationsTest() throws IOException { - System.out.println("@Test - getOrganisations"); - Organisations response = api.getOrganisations(); - - assertThat(response.getOrganisations().get(0).getOrganisationID(), is(equalTo(UUID.fromString("b2c885a9-4bb9-4a00-9b6e-6c2bf60b1a2b")))); - assertThat(response.getOrganisations().get(0).getApIKey(), is(equalTo("CTJ60UH519MXQIXEJSDPDALS3EOZ5Y"))); - assertThat(response.getOrganisations().get(0).getName(), is(equalTo("Dev Evangelist - Sid Test 3 (NZ-2016-02)"))); - assertThat(response.getOrganisations().get(0).getLegalName(), is(equalTo("Dev Evangelist - Sid Test 3 (NZ-2016-02)"))); - assertThat(response.getOrganisations().get(0).getPaysTax(), is(equalTo(true))); - assertThat(response.getOrganisations().get(0).getVersion(), is(equalTo(com.xero.models.accounting.Organisation.VersionEnum.NZ))); - assertThat(response.getOrganisations().get(0).getOrganisationType(), is(equalTo(com.xero.models.accounting.Organisation.OrganisationTypeEnum.COMPANY))); - assertThat(response.getOrganisations().get(0).getBaseCurrency(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getOrganisations().get(0).getCountryCode(), is(equalTo(com.xero.models.accounting.CountryCode.NZ))); - assertThat(response.getOrganisations().get(0).getIsDemoCompany(), is(equalTo(false))); - assertThat(response.getOrganisations().get(0).getOrganisationStatus(), is(equalTo("ACTIVE"))); - assertThat(response.getOrganisations().get(0).getFinancialYearEndDay(), is(equalTo(31))); - assertThat(response.getOrganisations().get(0).getFinancialYearEndMonth(), is(equalTo(3))); - assertThat(response.getOrganisations().get(0).getTaxNumber(), is(equalTo("071-138-054"))); - assertThat(response.getOrganisations().get(0).getSalesTaxBasis(), is(equalTo(com.xero.models.accounting.Organisation.SalesTaxBasisEnum.PAYMENTS))); - assertThat(response.getOrganisations().get(0).getSalesTaxPeriod(), is(equalTo(com.xero.models.accounting.Organisation.SalesTaxPeriodEnum.TWOMONTHS))); - assertThat(response.getOrganisations().get(0).getDefaultSalesTax(), is(equalTo("Tax Exclusive"))); - assertThat(response.getOrganisations().get(0).getDefaultPurchasesTax(), is(equalTo("Tax Exclusive"))); - assertThat(response.getOrganisations().get(0).getPeriodLockDate(), is(equalTo(LocalDate.of(2018,12,30)))); - assertThat(response.getOrganisations().get(0).getEndOfYearLockDate(), is(equalTo(LocalDate.of(2018,12,30)))); - assertThat(response.getOrganisations().get(0).getCreatedDateUTC(), is(equalTo(OffsetDateTime.parse("2016-02-18T12:29:53-08:00")))); - assertThat(response.getOrganisations().get(0).getTimezone(), is(equalTo(com.xero.models.accounting.TimeZone.NEWZEALANDSTANDARDTIME))); - assertThat(response.getOrganisations().get(0).getOrganisationEntityType(), is(equalTo(com.xero.models.accounting.Organisation.OrganisationEntityTypeEnum.COMPANY))); - assertThat(response.getOrganisations().get(0).getShortCode(), is(equalTo("!mBdtL"))); - assertThat(response.getOrganisations().get(0).getPropertyClass(), is(equalTo(com.xero.models.accounting.Organisation.PropertyClassEnum.PREMIUM))); - assertThat(response.getOrganisations().get(0).getEdition(), is(equalTo(com.xero.models.accounting.Organisation.EditionEnum.BUSINESS))); - //assertThat(response.getOrganisations().get(0).getRegistrationNumber(), is(equalTo("STRING_ONLY_PLACEHOLDER"))); - //assertThat(response.getOrganisations().get(0).getLineOfBusiness(), is(equalTo("STRING_ONLY_PLACEHOLDER"))); - //assertThat(response.getOrganisations().get(0).getAddresses(), is(equalTo("CONTAINER_PLACEHOLDER"))); - //assertThat(response.getOrganisations().get(0).getPhones(), is(equalTo("CONTAINER_PLACEHOLDER"))); - //assertThat(response.getOrganisations().get(0).getExternalLinks(), is(equalTo("CONTAINER_PLACEHOLDER"))); - //assertThat(response.getOrganisations().get(0).getPaymentTerms(), is(equalTo("MODEL_PLACEHOLDER"))); - //System.out.println(response.getOrganisations().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java deleted file mode 100644 index 98a0e58a..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiOverpaymentsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createOverpaymentAllocationTest() throws IOException { - System.out.println("@Test - createOverpaymentAllocation"); - UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Allocations allocations = null; - Allocations response = api.createOverpaymentAllocation(overpaymentID, allocations); - - // TODO: test validations - assertThat(response.getAllocations().get(0).getInvoice().getInvoiceID(), is(equalTo(UUID.fromString("c45720a1-ade3-4a38-a064-d15489be6841")))); - assertThat(response.getAllocations().get(0).getAmount(), is(equalTo(1.0))); - assertThat(response.getAllocations().get(0).getAmount().toString(), is(equalTo("1.0"))); - assertThat(response.getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); - //System.out.println(response.getAllocations().get(0).toString()); - } - - @Test - public void createOverpaymentHistoryTest() throws IOException { - System.out.println("@Test - createOverpaymentHistory - this is not implemented"); - UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords historyRecords = null; - //HistoryRecords response = api.createOverpaymentHistory(overpaymentID, historyRecords); - // TODO: test validations - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getOverpaymentTest() throws IOException { - System.out.println("@Test - getOverpayment"); - UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Overpayments response = api.getOverpayment(overpaymentID); - - //assertThat(response.getOverpayments().get(0).getType(), is(equalTo(com.xero.models.accounting.Overpayment.TypeEnum.SPEND-OVERPAYMENT))); - assertThat(response.getOverpayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); - assertThat(response.getOverpayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Overpayment.StatusEnum.AUTHORISED))); - assertThat(response.getOverpayments().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); - assertThat(response.getOverpayments().get(0).getSubTotal(), is(equalTo(3000.0))); - assertThat(response.getOverpayments().get(0).getSubTotal().toString(), is(equalTo("3000.0"))); - assertThat(response.getOverpayments().get(0).getTotalTax(), is(equalTo(0.0))); - assertThat(response.getOverpayments().get(0).getTotalTax().toString(), is(equalTo("0.0"))); - assertThat(response.getOverpayments().get(0).getTotal(), is(equalTo(3000.0))); - assertThat(response.getOverpayments().get(0).getTotal().toString(), is(equalTo("3000.0"))); - assertThat(response.getOverpayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-12T15:15:52.890-07:00")))); - assertThat(response.getOverpayments().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getOverpayments().get(0).getOverpaymentID(), is(equalTo(UUID.fromString("ed7f6041-c915-4667-bd1d-54c48e92161e")))); - assertThat(response.getOverpayments().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getOverpayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getOverpayments().get(0).getRemainingCredit(), is(equalTo(2999.0))); - assertThat(response.getOverpayments().get(0).getRemainingCredit().toString(), is(equalTo("2999.0"))); - assertThat(response.getOverpayments().get(0).getAllocations().get(0).getAmount(), is(equalTo(1.0))); - assertThat(response.getOverpayments().get(0).getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); - assertThat(response.getOverpayments().get(0).getAllocations().get(0).getInvoice().getInvoiceID(), is(equalTo(UUID.fromString("c45720a1-ade3-4a38-a064-d15489be6841")))); - assertThat(response.getOverpayments().get(0).getHasAttachments(), is(equalTo(true))); - assertThat(response.getOverpayments().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("247dd942-5245-47a7-adb1-4d9ea075b431")))); - assertThat(response.getOverpayments().get(0).getAttachments().get(0).getFileName(), is(equalTo("giphy.gif"))); - assertThat(response.getOverpayments().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/banktransaction/ed7f6041-c915-4667-bd1d-54c48e92161e/Attachments/giphy.gif"))); - assertThat(response.getOverpayments().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/gif"))); - assertThat(response.getOverpayments().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("495727")))); - assertThat(response.getOverpayments().get(0).getLineItems().get(0).getDescription(), is(equalTo("Broken TV deposit"))); - assertThat(response.getOverpayments().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); - assertThat(response.getOverpayments().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(3000.0))); - assertThat(response.getOverpayments().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("800"))); - assertThat(response.getOverpayments().get(0).getLineItems().get(0).getTaxType(), is(equalTo("NONE"))); - assertThat(response.getOverpayments().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(0.0))); - assertThat(response.getOverpayments().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(3000.0))); - //System.out.println(response.getOverpayments().get(0).toString()); - } - - @Test - public void getOverpaymentHistoryTest() throws IOException { - System.out.println("@Test - getOverpaymentHistory"); - UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = api.getOverpaymentHistory(overpaymentID); - - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Applied"))); - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Credit applied on 12 March 2019 for 1.00."))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-12T15:15:52.877-07:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getOverpaymentsTest() throws IOException { - System.out.println("@Test - getOverpayments"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - Integer page = null; - Integer unitdp = null; - Overpayments response = api.getOverpayments(ifModifiedSince, where, order, page,unitdp); - - //assertThat(response.getOverpayments().get(0).getType(), is(equalTo(com.xero.models.accounting.Overpayment.TypeEnum.SPEND-OVERPAYMENT))); - assertThat(response.getOverpayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); - assertThat(response.getOverpayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Overpayment.StatusEnum.AUTHORISED))); - assertThat(response.getOverpayments().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); - assertThat(response.getOverpayments().get(0).getSubTotal(), is(equalTo(500.0))); - assertThat(response.getOverpayments().get(0).getSubTotal().toString(), is(equalTo("500.0"))); - assertThat(response.getOverpayments().get(0).getTotalTax(), is(equalTo(0.0))); - assertThat(response.getOverpayments().get(0).getTotalTax().toString(), is(equalTo("0.0"))); - assertThat(response.getOverpayments().get(0).getTotal(), is(equalTo(500.0))); - assertThat(response.getOverpayments().get(0).getTotal().toString(), is(equalTo("500.0"))); - assertThat(response.getOverpayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-12T15:08:55.123-07:00")))); - assertThat(response.getOverpayments().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getOverpayments().get(0).getOverpaymentID(), is(equalTo(UUID.fromString("098b4dcb-5622-4699-87f8-9d40c4ccceb3")))); - assertThat(response.getOverpayments().get(0).getRemainingCredit(), is(equalTo(500.0))); - assertThat(response.getOverpayments().get(0).getRemainingCredit().toString(), is(equalTo("500.0"))); - assertThat(response.getOverpayments().get(0).getHasAttachments(), is(equalTo(false))); - //System.out.println(response.getOverpayments().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java deleted file mode 100644 index a7c3ecf2..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiPaymentServicesTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createPaymentServiceTest() throws IOException { - System.out.println("@Test - createPaymentService"); - PaymentServices paymentServices = null; - PaymentServices response = api.createPaymentService(paymentServices); - - assertThat(response.getPaymentServices().get(0).getPaymentServiceID(), is(equalTo(UUID.fromString("54b3b4f6-0443-4fba-bcd1-61ec0c35ca55")))); - assertThat(response.getPaymentServices().get(0).getPaymentServiceName(), is(equalTo("PayUpNow"))); - assertThat(response.getPaymentServices().get(0).getPaymentServiceUrl(), is(equalTo("https://www.payupnow.com/"))); - assertThat(response.getPaymentServices().get(0).getPayNowText(), is(equalTo("Time To Pay"))); - assertThat(response.getPaymentServices().get(0).getPaymentServiceType(), is(equalTo("Custom"))); - assertThat(response.getPaymentServices().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Payment service could not be found"))); - //System.out.println(response.getPaymentServices().get(0).toString()); - } - - @Test - public void getPaymentServicesTest() throws IOException { - System.out.println("@Test - getPaymentServices"); - PaymentServices response = api.getPaymentServices(); - - assertThat(response.getPaymentServices().get(0).getPaymentServiceID(), is(equalTo(UUID.fromString("54b3b4f6-0443-4fba-bcd1-61ec0c35ca55")))); - assertThat(response.getPaymentServices().get(0).getPaymentServiceName(), is(equalTo("PayUpNow"))); - assertThat(response.getPaymentServices().get(0).getPaymentServiceUrl(), is(equalTo("https://www.payupnow.com/"))); - assertThat(response.getPaymentServices().get(0).getPayNowText(), is(equalTo("Time To Pay"))); - assertThat(response.getPaymentServices().get(0).getPaymentServiceType(), is(equalTo("Custom"))); - //System.out.println(response.getPaymentServices().get(0).toString()); - } -} \ No newline at end of file diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java deleted file mode 100644 index 5d5a581d..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiPaymentsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createPaymentTest() throws IOException { - System.out.println("@Test - createPayment"); - Payments payments = null; - Payments response = api.createPayment(payments); - - assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0004"))); - assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("970"))); - assertThat(response.getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); - assertThat(response.getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getPayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getPayments().get(0).getAmount(), is(equalTo(1.0))); - assertThat(response.getPayments().get(0).getAmount().toString(), is(equalTo("1.0"))); - assertThat(response.getPayments().get(0).getIsReconciled(), is(equalTo(false))); - assertThat(response.getPayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Payment.StatusEnum.AUTHORISED))); - assertThat(response.getPayments().get(0).getPaymentType(), is(equalTo(com.xero.models.accounting.Payment.PaymentTypeEnum.ACCRECPAYMENT))); - assertThat(response.getPayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-12T16:10:38.623-07:00")))); - assertThat(response.getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("61ed71fc-01bf-4eb8-8419-8a18789ff45f")))); - assertThat(response.getPayments().get(0).getHasAccount(), is(equalTo(true))); - assertThat(response.getPayments().get(0).getHasValidationErrors(), is(equalTo(true))); - assertThat(response.getPayments().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Payment amount exceeds the amount outstanding on this document"))); - //System.out.println(response.getPayments().get(0).toString()); - } - - @Test - public void createPaymentHistoryTest() throws IOException { - System.out.println("@Test - createPaymentHistory"); - UUID paymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords historyRecords = null; - //HistoryRecords response = api.createPaymentHistory(paymentID, historyRecords); - // TODO: test validations - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void deletePaymentTest() throws IOException { - System.out.println("@Test - deletePayment"); - UUID paymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Payments payments = null; - Payments response = api.deletePayment(paymentID, payments); - - assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0006"))); - assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("980"))); - assertThat(response.getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,18)))); - assertThat(response.getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getPayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getPayments().get(0).getAmount(), is(equalTo(148062.76))); - assertThat(response.getPayments().get(0).getAmount().toString(), is(equalTo("148062.76"))); - assertThat(response.getPayments().get(0).getReference(), is(equalTo("Yahoo"))); - assertThat(response.getPayments().get(0).getIsReconciled(), is(equalTo(false))); - assertThat(response.getPayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Payment.StatusEnum.DELETED))); - assertThat(response.getPayments().get(0).getPaymentType(), is(equalTo(com.xero.models.accounting.Payment.PaymentTypeEnum.ACCRECPAYMENT))); - assertThat(response.getPayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-12T16:17:21.940-07:00")))); - assertThat(response.getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("38928000-e9a0-420c-8884-f624bab2a351")))); - assertThat(response.getPayments().get(0).getHasAccount(), is(equalTo(true))); - assertThat(response.getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); - //System.out.println(response.getPayments().get(0).toString()); - } - - @Test - public void getPaymentTest() throws IOException { - System.out.println("@Test - getPayment"); - UUID paymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Payments response = api.getPayment(paymentID); - - assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0002"))); - assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("970"))); - assertThat(response.getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2018,11,28)))); - assertThat(response.getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getPayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getPayments().get(0).getAmount(), is(equalTo(46.0))); - assertThat(response.getPayments().get(0).getAmount().toString(), is(equalTo("46.0"))); - assertThat(response.getPayments().get(0).getIsReconciled(), is(equalTo(false))); - assertThat(response.getPayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Payment.StatusEnum.AUTHORISED))); - assertThat(response.getPayments().get(0).getPaymentType(), is(equalTo(com.xero.models.accounting.Payment.PaymentTypeEnum.ACCRECPAYMENT))); - assertThat(response.getPayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:36:32.690-07:00")))); - assertThat(response.getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("99ea7f6b-c513-4066-bc27-b7c65dcd76c2")))); - assertThat(response.getPayments().get(0).getHasAccount(), is(equalTo(true))); - assertThat(response.getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); - //System.out.println(response.getPayments().get(0).toString()); - } - - @Test - public void getPaymentHistoryTest() throws IOException { - System.out.println("@Test - getPaymentHistory"); - UUID paymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = api.getPaymentHistory(paymentID); - - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Created"))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:36:32.690-07:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getPaymentsTest() throws IOException { - System.out.println("@Test - getPayments"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - Payments response = api.getPayments(ifModifiedSince, where, order); - - assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0002"))); - assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("970"))); - assertThat(response.getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2018,11,28)))); - assertThat(response.getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getPayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getPayments().get(0).getAmount(), is(equalTo(46.0))); - assertThat(response.getPayments().get(0).getAmount().toString(), is(equalTo("46.0"))); - assertThat(response.getPayments().get(0).getIsReconciled(), is(equalTo(false))); - assertThat(response.getPayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Payment.StatusEnum.AUTHORISED))); - assertThat(response.getPayments().get(0).getPaymentType(), is(equalTo(com.xero.models.accounting.Payment.PaymentTypeEnum.ACCRECPAYMENT))); - assertThat(response.getPayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:36:32.690-07:00")))); - assertThat(response.getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("99ea7f6b-c513-4066-bc27-b7c65dcd76c2")))); - assertThat(response.getPayments().get(0).getHasAccount(), is(equalTo(true))); - assertThat(response.getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); - //System.out.println(response.getPayments().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java deleted file mode 100644 index 3c3bce93..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiPrepaymentsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createPrepaymentAllocationTest() throws IOException { - System.out.println("@Test - createPrepaymentAllocation"); - UUID prepaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Allocations allocations = null; - Allocations response = api.createPrepaymentAllocation(prepaymentID, allocations); - - assertThat(response.getAllocations().get(0).getAmount(), is(equalTo(1.0))); - assertThat(response.getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); - assertThat(response.getAllocations().get(0).getInvoice().getInvoiceID(), is(equalTo(UUID.fromString("c7c37b83-ac95-45ea-88ba-8ad83a5f22fe")))); - //System.out.println(response.getAllocations().get(0).toString()); - } - - @Test - public void createPrepaymentHistoryTest() throws IOException { - System.out.println("@Test - createPrepaymentHistory"); - UUID prepaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords historyRecords = null; - //HistoryRecords response = api.createPrepaymentHistory(prepaymentID, historyRecords); - // TODO: test validations - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getPrepaymentTest() throws IOException { - System.out.println("@Test - getPrepayment"); - UUID prepaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Prepayments response = api.getPrepayment(prepaymentID); - - assertThat(response.getPrepayments().get(0).getType().toString(), is(equalTo("RECEIVE-PREPAYMENT"))); - assertThat(response.getPrepayments().get(0).getContact().getName(), is(equalTo("Luke Skywalker"))); - assertThat(response.getPrepayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); - assertThat(response.getPrepayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Prepayment.StatusEnum.AUTHORISED))); - assertThat(response.getPrepayments().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getPrepayments().get(0).getLineItems().get(0).getDescription(), is(equalTo("Light Speeder"))); - assertThat(response.getPrepayments().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); - assertThat(response.getPrepayments().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(3000.0))); - assertThat(response.getPrepayments().get(0).getLineItems().get(0).getTaxType(), is(equalTo("OUTPUT2"))); - assertThat(response.getPrepayments().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); - assertThat(response.getPrepayments().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(450.0))); - assertThat(response.getPrepayments().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(3000.0))); - assertThat(response.getPrepayments().get(0).getSubTotal(), is(equalTo(3000.0))); - assertThat(response.getPrepayments().get(0).getSubTotal().toString(), is(equalTo("3000.0"))); - assertThat(response.getPrepayments().get(0).getTotalTax(), is(equalTo(450.0))); - assertThat(response.getPrepayments().get(0).getTotalTax().toString(), is(equalTo("450.0"))); - assertThat(response.getPrepayments().get(0).getTotal(), is(equalTo(3450.0))); - assertThat(response.getPrepayments().get(0).getTotal().toString(), is(equalTo("3450.0"))); - assertThat(response.getPrepayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:13:44.850-07:00")))); - assertThat(response.getPrepayments().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getPrepayments().get(0).getPrepaymentID(), is(equalTo(UUID.fromString("ce0cddef-cf5a-4e59-b638-f225679115a7")))); - assertThat(response.getPrepayments().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getPrepayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getPrepayments().get(0).getRemainingCredit(), is(equalTo(3449.0))); - assertThat(response.getPrepayments().get(0).getRemainingCredit().toString(), is(equalTo("3449.0"))); - assertThat(response.getPrepayments().get(0).getHasAttachments(), is(equalTo(true))); - assertThat(response.getPrepayments().get(0).getAllocations().get(0).getAmount(), is(equalTo(1.0))); - assertThat(response.getPrepayments().get(0).getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); - assertThat(response.getPrepayments().get(0).getAllocations().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0004"))); - assertThat(response.getPrepayments().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("2ca06aa0-3629-474a-9401-553d4b7fa9b0")))); - assertThat(response.getPrepayments().get(0).getAttachments().get(0).getFileName(), is(equalTo("giphy.gif"))); - assertThat(response.getPrepayments().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/banktransaction/ce0cddef-cf5a-4e59-b638-f225679115a7/Attachments/giphy.gif"))); - assertThat(response.getPrepayments().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/gif"))); - assertThat(response.getPrepayments().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal(495727)))); - //System.out.println(response.getPrepayments().get(0).toString()); - } - - @Test - public void getPrepaymentHistoryTest() throws IOException { - System.out.println("@Test - getPrepaymentHistory"); - UUID prepaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = api.getPrepaymentHistory(prepaymentID); - - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Cash Refunded"))); - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Payment made to Tony Stark on 21 March 2019 for 2,300.00. There is no credit remaining on this prepayment."))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T07:58:10.407-07:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getPrepaymentsTest() throws IOException { - System.out.println("@Test - getPrepayments"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - Integer page = null; - Integer unitdp = null; - Prepayments response = api.getPrepayments(ifModifiedSince, where, order, page, unitdp); - - assertThat(response.getPrepayments().get(0).getType().toString(), is(equalTo("RECEIVE-PREPAYMENT"))); - assertThat(response.getPrepayments().get(0).getContact().getName(), is(equalTo("Luke Skywalker"))); - assertThat(response.getPrepayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); - assertThat(response.getPrepayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Prepayment.StatusEnum.AUTHORISED))); - assertThat(response.getPrepayments().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getPrepayments().get(0).getSubTotal(), is(equalTo(3000.0))); - assertThat(response.getPrepayments().get(0).getSubTotal().toString(), is(equalTo("3000.0"))); - assertThat(response.getPrepayments().get(0).getTotalTax(), is(equalTo(450.0))); - assertThat(response.getPrepayments().get(0).getTotalTax().toString(), is(equalTo("450.0"))); - assertThat(response.getPrepayments().get(0).getTotal(), is(equalTo(3450.0))); - assertThat(response.getPrepayments().get(0).getTotal().toString(), is(equalTo("3450.0"))); - assertThat(response.getPrepayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T07:59:47.730-07:00")))); - assertThat(response.getPrepayments().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getPrepayments().get(0).getPrepaymentID(), is(equalTo(UUID.fromString("ce0cddef-cf5a-4e59-b638-f225679115a7")))); - assertThat(response.getPrepayments().get(0).getRemainingCredit(), is(equalTo(3450.0))); - assertThat(response.getPrepayments().get(0).getRemainingCredit().toString(), is(equalTo("3450.0"))); - assertThat(response.getPrepayments().get(0).getHasAttachments(), is(equalTo(true))); - //System.out.println(response.getPrepayments().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java deleted file mode 100644 index b5710361..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java +++ /dev/null @@ -1,274 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiPurchaseOrdersTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createPurchaseOrderTest() throws IOException { - System.out.println("@Test - createPurchaseOrder"); - PurchaseOrders purchaseOrders = null; - Boolean summarizeErrors = null; - PurchaseOrders response = api.createPurchaseOrder(purchaseOrders, summarizeErrors); - - // TODO: test validations - assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("792b7e40-b9f2-47f0-8624-b09f4b0166dd")))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getDescription(), is(equalTo("Foobar"))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxType(), is(equalTo("INPUT2"))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("710"))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(3.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(20.0))); - assertThat(response.getPurchaseOrders().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); - assertThat(response.getPurchaseOrders().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderNumber(), is(equalTo("PO-0004"))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getPurchaseOrders().get(0).getStatus(), is(equalTo(com.xero.models.accounting.PurchaseOrder.StatusEnum.DRAFT))); - assertThat(response.getPurchaseOrders().get(0).getSentToContact(), is(equalTo(false))); - assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderID(), is(equalTo(UUID.fromString("56204648-8fbe-46f8-b09c-2125f7939533")))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getPurchaseOrders().get(0).getSubTotal(), is(equalTo(20.0))); - assertThat(response.getPurchaseOrders().get(0).getSubTotal().toString(), is(equalTo("20.0"))); - assertThat(response.getPurchaseOrders().get(0).getTotalTax(), is(equalTo(3.0))); - assertThat(response.getPurchaseOrders().get(0).getTotalTax().toString(), is(equalTo("3.0"))); - assertThat(response.getPurchaseOrders().get(0).getTotal(), is(equalTo(23.0))); - assertThat(response.getPurchaseOrders().get(0).getTotal().toString(), is(equalTo("23.0"))); - assertThat(response.getPurchaseOrders().get(0).getTotalDiscount(), is(equalTo(0.0))); - assertThat(response.getPurchaseOrders().get(0).getTotalDiscount().toString(), is(equalTo("0.0"))); - assertThat(response.getPurchaseOrders().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:22:26.077-07:00")))); - assertThat(response.getPurchaseOrders().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Order number must be unique"))); - assertThat(response.getPurchaseOrders().get(0).getWarnings().get(0).getMessage(), is(equalTo("Only AUTHORISED and BILLED purchase orders may have SentToContact updated."))); - //System.out.println(response.getPurchaseOrders().get(0).toString()); - } - - @Test - public void createPurchaseOrderHistoryTest() throws IOException { - System.out.println("@Test - createPurchaseOrderHistory"); - UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords historyRecords = null; - HistoryRecords response = api.createPurchaseOrderHistory(purchaseOrderID, historyRecords); - - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:39:39.354-07:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getPurchaseOrderTest() throws IOException { - System.out.println("@Test - getPurchaseOrder"); - UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - PurchaseOrders response = api.getPurchaseOrder(purchaseOrderID); - - assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("8a9d3eca-e052-43bc-9b87-221d0648c045")))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getDescription(), is(equalTo("Brand new Fender Strats"))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(2500.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getItemCode(), is(equalTo("123"))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxType(), is(equalTo("INPUT2"))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("630"))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(337.5))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(2250.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTracking().get(0).getName(), is(equalTo("Simpsons"))); - assertThat(response.getPurchaseOrders().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,25)))); - assertThat(response.getPurchaseOrders().get(0).getDeliveryDate(), is(equalTo(LocalDate.of(2019,03,27)))); - assertThat(response.getPurchaseOrders().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderNumber(), is(equalTo("PO-0006"))); - assertThat(response.getPurchaseOrders().get(0).getReference(), is(equalTo("foobar"))); - assertThat(response.getPurchaseOrders().get(0).getBrandingThemeID(), is(equalTo(UUID.fromString("414d4a87-46d6-4cfc-ab42-4e29d22e5076")))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getPurchaseOrders().get(0).getStatus(), is(equalTo(com.xero.models.accounting.PurchaseOrder.StatusEnum.DRAFT))); - assertThat(response.getPurchaseOrders().get(0).getSentToContact(), is(equalTo(false))); - assertThat(response.getPurchaseOrders().get(0).getDeliveryAddress(), is(equalTo("101 Grafton Road\nRoseneath\nWellington\n6011\nNew Zealand"))); - assertThat(response.getPurchaseOrders().get(0).getAttentionTo(), is(equalTo("CEO"))); - assertThat(response.getPurchaseOrders().get(0).getTelephone(), is(equalTo("64 123-2222"))); - assertThat(response.getPurchaseOrders().get(0).getDeliveryInstructions(), is(equalTo("Drop off at front door"))); - assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderID(), is(equalTo(UUID.fromString("15369a9f-17b6-4235-83c4-0029256d1c37")))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getPurchaseOrders().get(0).getSubTotal(), is(equalTo(2250.0))); - assertThat(response.getPurchaseOrders().get(0).getSubTotal().toString(), is(equalTo("2250.0"))); - assertThat(response.getPurchaseOrders().get(0).getTotalTax(), is(equalTo(337.5))); - assertThat(response.getPurchaseOrders().get(0).getTotalTax().toString(), is(equalTo("337.5"))); - assertThat(response.getPurchaseOrders().get(0).getTotal(), is(equalTo(2587.5))); - assertThat(response.getPurchaseOrders().get(0).getTotal().toString(), is(equalTo("2587.5"))); - assertThat(response.getPurchaseOrders().get(0).getTotalDiscount(), is(equalTo(250.0))); - assertThat(response.getPurchaseOrders().get(0).getTotalDiscount().toString(), is(equalTo("250.0"))); - assertThat(response.getPurchaseOrders().get(0).getHasAttachments(), is(equalTo(true))); - assertThat(response.getPurchaseOrders().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-26T11:47:09.823-07:00")))); - assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("7d94ccdc-ef7b-4806-87ac-8442f25e593b")))); - assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.png"))); - assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/png"))); - assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/PurchaseOrders/15369a9f-17b6-4235-83c4-0029256d1c37/Attachments/HelloWorld.png"))); - assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("76091")))); - assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getPurchaseOrders().get(0).toString()); - } - - @Test - public void getPurchaseOrderHistoryTest() throws IOException { - System.out.println("@Test - getPurchaseOrderHistory"); - UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = api.getPurchaseOrderHistory(purchaseOrderID); - - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Note"))); - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:22:28.670-07:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getPurchaseOrdersTest() throws IOException { - System.out.println("@Test - getPurchaseOrders"); - OffsetDateTime ifModifiedSince = null; - String status = null; - String dateFrom = null; - String dateTo = null; - String order = null; - Integer page = null; - PurchaseOrders response = api.getPurchaseOrders(ifModifiedSince, status, dateFrom, dateTo, order, page); - - assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("0f7b54b8-bfa4-4c5d-9c22-73dbd5796e54")))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getDescription(), is(equalTo("Foobar"))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(0.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(20.0))); - assertThat(response.getPurchaseOrders().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); - assertThat(response.getPurchaseOrders().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderNumber(), is(equalTo("PO-0001"))); - assertThat(response.getPurchaseOrders().get(0).getAttentionTo(), is(equalTo("Jimmy"))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getPurchaseOrders().get(0).getStatus(), is(equalTo(com.xero.models.accounting.PurchaseOrder.StatusEnum.DELETED))); - assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderID(), is(equalTo(UUID.fromString("f9627f0d-b715-4039-bb6a-96dc3eae5ec5")))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getPurchaseOrders().get(0).getSubTotal(), is(equalTo(20.0))); - assertThat(response.getPurchaseOrders().get(0).getSubTotal().toString(), is(equalTo("20.0"))); - assertThat(response.getPurchaseOrders().get(0).getTotalTax(), is(equalTo(0.0))); - assertThat(response.getPurchaseOrders().get(0).getTotalTax().toString(), is(equalTo("0.0"))); - assertThat(response.getPurchaseOrders().get(0).getTotal(), is(equalTo(20.0))); - assertThat(response.getPurchaseOrders().get(0).getTotal().toString(), is(equalTo("20.0"))); - assertThat(response.getPurchaseOrders().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:18:23.443-07:00")))); - //System.out.println(response.getPurchaseOrders().get(0).toString()); - } - - @Test - public void updatePurchaseOrderTest() throws IOException { - System.out.println("@Test - updatePurchaseOrder"); - UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - PurchaseOrders purchaseOrders = null; - PurchaseOrders response = api.updatePurchaseOrder(purchaseOrderID, purchaseOrders); - - assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("d1d9b2cd-c9f2-4445-8d98-0b8096cf4dae")))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getDescription(), is(equalTo("Foobar"))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxType(), is(equalTo("INPUT2"))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("710"))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(3.0))); - assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(20.0))); - assertThat(response.getPurchaseOrders().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); - assertThat(response.getPurchaseOrders().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderNumber(), is(equalTo("PO-0005"))); - assertThat(response.getPurchaseOrders().get(0).getAttentionTo(), is(equalTo("Jimmy"))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getPurchaseOrders().get(0).getStatus(), is(equalTo(com.xero.models.accounting.PurchaseOrder.StatusEnum.DRAFT))); - assertThat(response.getPurchaseOrders().get(0).getSentToContact(), is(equalTo(false))); - assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderID(), is(equalTo(UUID.fromString("f9fc1120-c937-489e-84bc-e822190cfe9c")))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyRate(), is(equalTo(1.0))); - assertThat(response.getPurchaseOrders().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); - assertThat(response.getPurchaseOrders().get(0).getSubTotal(), is(equalTo(20.0))); - assertThat(response.getPurchaseOrders().get(0).getSubTotal().toString(), is(equalTo("20.0"))); - assertThat(response.getPurchaseOrders().get(0).getTotalTax(), is(equalTo(3.0))); - assertThat(response.getPurchaseOrders().get(0).getTotalTax().toString(), is(equalTo("3.0"))); - assertThat(response.getPurchaseOrders().get(0).getTotal(), is(equalTo(23.0))); - assertThat(response.getPurchaseOrders().get(0).getTotal().toString(), is(equalTo("23.0"))); - assertThat(response.getPurchaseOrders().get(0).getTotalDiscount(), is(equalTo(0.0))); - assertThat(response.getPurchaseOrders().get(0).getTotalDiscount().toString(), is(equalTo("0.0"))); - assertThat(response.getPurchaseOrders().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:39:36.853-07:00")))); - //System.out.println(response.getPurchaseOrders().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java deleted file mode 100644 index ce37bf55..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java +++ /dev/null @@ -1,264 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiReceiptsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createReceiptTest() throws IOException { - System.out.println("@Test - createReceipt"); - Receipts receipts = null; - Receipts response = api.createReceipt(receipts); - - assertThat(response.getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,13)))); - assertThat(response.getReceipts().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getReceipts().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); - assertThat(response.getReceipts().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); - assertThat(response.getReceipts().get(0).getSubTotal(), is(equalTo(40.0))); - assertThat(response.getReceipts().get(0).getSubTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getReceipts().get(0).getTotalTax(), is(equalTo(0.0))); - assertThat(response.getReceipts().get(0).getTotalTax().toString(), is(equalTo("0.0"))); - assertThat(response.getReceipts().get(0).getTotal(), is(equalTo(40.0))); - assertThat(response.getReceipts().get(0).getTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("a44fd147-af4e-4fe8-a09a-55332df74162")))); - assertThat(response.getReceipts().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Receipt.StatusEnum.DRAFT))); - assertThat(response.getReceipts().get(0).getReceiptNumber(), is(equalTo("1"))); - assertThat(response.getReceipts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:49:43.367-07:00")))); - assertThat(response.getReceipts().get(0).getHasAttachments(), is(equalTo(false))); - assertThat(response.getReceipts().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("A valid user should be identified using the UserID."))); - //System.out.println(response.getReceipts().get(0).toString()); - } - - @Test - public void createReceiptAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - createReceiptAttachmentByFileName"); - UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - String fileName = "sample5.jpg"; - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - Attachments response = api.createReceiptAttachmentByFileName(receiptID, fileName, body); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("3451e34c-66a6-42b0-91e2-88618bdc169b")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("foobar.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Receipts/a44fd147-af4e-4fe8-a09a-55332df74162/Attachments/foobar.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - - @Test - public void createReceiptHistoryTest() throws IOException { - System.out.println("@Test - createReceiptHistory - not implemented"); - UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords historyRecords = null; - //HistoryRecords response = api.createReceiptHistory(receiptID, historyRecords); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getReceiptTest() throws IOException { - System.out.println("@Test - getReceipt"); - UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Receipts response = api.getReceipt(receiptID); - - assertThat(response.getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); - assertThat(response.getReceipts().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getReceipts().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); - assertThat(response.getReceipts().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); - assertThat(response.getReceipts().get(0).getSubTotal(), is(equalTo(40.0))); - assertThat(response.getReceipts().get(0).getSubTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getReceipts().get(0).getTotalTax(), is(equalTo(0.0))); - assertThat(response.getReceipts().get(0).getTotalTax().toString(), is(equalTo("0.0"))); - assertThat(response.getReceipts().get(0).getTotal(), is(equalTo(40.0))); - assertThat(response.getReceipts().get(0).getTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("a44fd147-af4e-4fe8-a09a-55332df74162")))); - assertThat(response.getReceipts().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Receipt.StatusEnum.DRAFT))); - assertThat(response.getReceipts().get(0).getReceiptNumber(), is(equalTo("1"))); - assertThat(response.getReceipts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:49:43.983-07:00")))); - assertThat(response.getReceipts().get(0).getHasAttachments(), is(equalTo(true))); - assertThat(response.getReceipts().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("e02a84f6-b83a-4983-b3b9-35cd8880c7bc")))); - assertThat(response.getReceipts().get(0).getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); - assertThat(response.getReceipts().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getReceipts().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/receipts/a44fd147-af4e-4fe8-a09a-55332df74162/Attachments/HelloWorld.jpg"))); - assertThat(response.getReceipts().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getReceipts().get(0).getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getReceipts().get(0).toString()); - } - - @Test - public void getReceiptAttachmentsTest() throws IOException { - System.out.println("@Test - getReceiptAttachments"); - UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Attachments response = api.getReceiptAttachments(receiptID); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("11e5ca6b-d38c-42ab-a29f-c1710d171aa1")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("giphy.gif"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/gif"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Receipts/7923c00d-163d-404c-a608-af3de333db29/Attachments/giphy.gif"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("495727")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - @Test - public void getReceiptHistoryTest() throws IOException { - System.out.println("@Test - getReceiptHistory"); - UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = api.getReceiptHistory(receiptID); - - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Edited"))); - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Received through the Xero API from Java Partner Example"))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:49:43.983-07:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getReceiptsTest() throws IOException { - System.out.println("@Test - getReceipts"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - Integer unitdp = null; - Receipts response = api.getReceipts(ifModifiedSince, where, order,unitdp); - - assertThat(response.getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); - assertThat(response.getReceipts().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getReceipts().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); - assertThat(response.getReceipts().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); - assertThat(response.getReceipts().get(0).getSubTotal(), is(equalTo(40.0))); - assertThat(response.getReceipts().get(0).getSubTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getReceipts().get(0).getTotalTax(), is(equalTo(0.0))); - assertThat(response.getReceipts().get(0).getTotalTax().toString(), is(equalTo("0.0"))); - assertThat(response.getReceipts().get(0).getTotal(), is(equalTo(40.0))); - assertThat(response.getReceipts().get(0).getTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("a44fd147-af4e-4fe8-a09a-55332df74162")))); - assertThat(response.getReceipts().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Receipt.StatusEnum.DRAFT))); - assertThat(response.getReceipts().get(0).getReceiptNumber(), is(equalTo("1"))); - assertThat(response.getReceipts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:49:43.983-07:00")))); - assertThat(response.getReceipts().get(0).getHasAttachments(), is(equalTo(false))); - //System.out.println(response.getReceipts().get(0).toString()); - } - - @Test - public void updateReceiptTest() throws IOException { - System.out.println("@Test - updateReceipt"); - UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Receipts receipts = null; - Receipts response = api.updateReceipt(receiptID, receipts); - - assertThat(response.getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,15)))); - assertThat(response.getReceipts().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getReceipts().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); - assertThat(response.getReceipts().get(0).getReference(), is(equalTo("Foobar"))); - assertThat(response.getReceipts().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); - assertThat(response.getReceipts().get(0).getSubTotal(), is(equalTo(40.0))); - assertThat(response.getReceipts().get(0).getSubTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getReceipts().get(0).getTotalTax(), is(equalTo(0.0))); - assertThat(response.getReceipts().get(0).getTotalTax().toString(), is(equalTo("0.0"))); - assertThat(response.getReceipts().get(0).getTotal(), is(equalTo(40.0))); - assertThat(response.getReceipts().get(0).getTotal().toString(), is(equalTo("40.0"))); - assertThat(response.getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("e3686fdc-c661-4581-b9df-cbb20782ea66")))); - assertThat(response.getReceipts().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Receipt.StatusEnum.DRAFT))); - assertThat(response.getReceipts().get(0).getReceiptNumber(), is(equalTo("2"))); - assertThat(response.getReceipts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-15T11:45:56.927-07:00")))); - assertThat(response.getReceipts().get(0).getHasAttachments(), is(equalTo(false))); - //System.out.println(response.getReceipts().get(0).toString()); - } - - @Test - public void updateReceiptAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - updateReceiptAttachmentByFileName"); - UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - String fileName = "sample5.jpg"; - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - Attachments response = api.updateReceiptAttachmentByFileName(receiptID, fileName, body); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("e02a84f6-b83a-4983-b3b9-35cd8880c7bc")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Receipts/a44fd147-af4e-4fe8-a09a-55332df74162/Attachments/HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java deleted file mode 100644 index e04ba9c1..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java +++ /dev/null @@ -1,240 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiRepeatingInvoicesTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createRepeatingInvoiceAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - createRepeatingInvoiceAttachmentByFileName"); - UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - String fileName = "sample5.jpg"; - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - Attachments response = api.createRepeatingInvoiceAttachmentByFileName(repeatingInvoiceID, fileName, body); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("e078e56c-9a2b-4f6c-a1fa-5d19b0dab611")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("foobar.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/RepeatingInvoices/428c0d75-909f-4b04-8403-a48dc27283b0/Attachments/foobar.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - @Test - public void createRepeatingInvoiceHistoryTest() throws IOException { - System.out.println("@Test - createRepeatingInvoiceHistory - not implmented"); - UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords historyRecords = null; - //HistoryRecords response = api.createRepeatingInvoiceHistory(repeatingInvoiceID, historyRecords); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getRepeatingInvoiceTest() throws IOException { - System.out.println("@Test - getRepeatingInvoice"); - UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - RepeatingInvoices response = api.getRepeatingInvoice(repeatingInvoiceID); - - assertThat(response.getRepeatingInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.RepeatingInvoice.TypeEnum.ACCREC))); - assertThat(response.getRepeatingInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getPeriod(), is(equalTo(1))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getUnit(), is(equalTo(com.xero.models.accounting.Schedule.UnitEnum.MONTHLY))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getDueDate(), is(equalTo(10))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getDueDateType(), is(equalTo(com.xero.models.accounting.Schedule.DueDateTypeEnum.OFFOLLOWINGMONTH))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getStartDate(), is(equalTo(LocalDate.of(2019,04,14)))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getNextScheduledDate(), is(equalTo(LocalDate.of(2019,04,14)))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getEndDate(), is(equalTo(LocalDate.of(2019,9,29)))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("13a8353c-d2af-4d5b-920c-438449f08900")))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getDescription(), is(equalTo("Guitars Fender Strat"))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(5000.0))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getTaxType(), is(equalTo("OUTPUT2"))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(750.0))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(5000.0))); - assertThat(response.getRepeatingInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getRepeatingInvoices().get(0).getReference(), is(equalTo("[Week]"))); - assertThat(response.getRepeatingInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getRepeatingInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.RepeatingInvoice.StatusEnum.AUTHORISED))); - assertThat(response.getRepeatingInvoices().get(0).getSubTotal(), is(equalTo(5000.0))); - assertThat(response.getRepeatingInvoices().get(0).getSubTotal().toString(), is(equalTo("5000.0"))); - assertThat(response.getRepeatingInvoices().get(0).getTotalTax(), is(equalTo(750.0))); - assertThat(response.getRepeatingInvoices().get(0).getTotalTax().toString(), is(equalTo("750.0"))); - assertThat(response.getRepeatingInvoices().get(0).getTotal(), is(equalTo(5750.0))); - assertThat(response.getRepeatingInvoices().get(0).getTotal().toString(), is(equalTo("5750.0"))); - assertThat(response.getRepeatingInvoices().get(0).getRepeatingInvoiceID(), is(equalTo(UUID.fromString("428c0d75-909f-4b04-8403-a48dc27283b0")))); - assertThat(response.getRepeatingInvoices().get(0).getID(), is(equalTo(UUID.fromString("428c0d75-909f-4b04-8403-a48dc27283b0")))); - assertThat(response.getRepeatingInvoices().get(0).getHasAttachments(), is(equalTo(true))); - assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("2a488b0f-3966-4b6e-a7e1-b6d3286351f2")))); - assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); - assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Invoices/428c0d75-909f-4b04-8403-a48dc27283b0/Attachments/HelloWorld.jpg"))); - assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getRepeatingInvoices().get(0).toString()); - } - - @Test - public void getRepeatingInvoiceAttachmentsTest() throws IOException { - System.out.println("@Test - getRepeatingInvoiceAttachments"); - UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Attachments response = api.getRepeatingInvoiceAttachments(repeatingInvoiceID); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("2a488b0f-3966-4b6e-a7e1-b6d3286351f2")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/RepeatingInvoices/428c0d75-909f-4b04-8403-a48dc27283b0/Attachments/HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } - - @Test - public void getRepeatingInvoiceHistoryTest() throws IOException { - System.out.println("@Test - getRepeatingInvoiceHistory"); - UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = api.getRepeatingInvoiceHistory(repeatingInvoiceID); - - assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); - assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Attached a file"))); - assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Attached the file foobar.jpg through the Xero API using Java Partner Example"))); - assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-15T15:07:28.587-07:00")))); - //System.out.println(response.getHistoryRecords().get(0).toString()); - } - - @Test - public void getRepeatingInvoicesTest() throws IOException { - System.out.println("@Test - getRepeatingInvoices"); - String where = null; - String order = null; - RepeatingInvoices response = api.getRepeatingInvoices(where, order); - - assertThat(response.getRepeatingInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.RepeatingInvoice.TypeEnum.ACCREC))); - assertThat(response.getRepeatingInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getPeriod(), is(equalTo(1))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getUnit(), is(equalTo(com.xero.models.accounting.Schedule.UnitEnum.MONTHLY))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getDueDate(), is(equalTo(10))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getDueDateType(), is(equalTo(com.xero.models.accounting.Schedule.DueDateTypeEnum.OFFOLLOWINGMONTH))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getStartDate(), is(equalTo(LocalDate.of(2019,04,14)))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getNextScheduledDate(), is(equalTo(LocalDate.of(2019,04,14)))); - assertThat(response.getRepeatingInvoices().get(0).getSchedule().getEndDate(), is(equalTo(LocalDate.of(2019,9,29)))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("13a8353c-d2af-4d5b-920c-438449f08900")))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getDescription(), is(equalTo("Guitars Fender Strat"))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(5000.0))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getTaxType(), is(equalTo("OUTPUT2"))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(750.0))); - assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(5000.0))); - assertThat(response.getRepeatingInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); - assertThat(response.getRepeatingInvoices().get(0).getReference(), is(equalTo("[Week]"))); - assertThat(response.getRepeatingInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); - assertThat(response.getRepeatingInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.RepeatingInvoice.StatusEnum.AUTHORISED))); - assertThat(response.getRepeatingInvoices().get(0).getSubTotal(), is(equalTo(5000.0))); - assertThat(response.getRepeatingInvoices().get(0).getSubTotal().toString(), is(equalTo("5000.0"))); - assertThat(response.getRepeatingInvoices().get(0).getTotalTax(), is(equalTo(750.0))); - assertThat(response.getRepeatingInvoices().get(0).getTotalTax().toString(), is(equalTo("750.0"))); - assertThat(response.getRepeatingInvoices().get(0).getTotal(), is(equalTo(5750.0))); - assertThat(response.getRepeatingInvoices().get(0).getTotal().toString(), is(equalTo("5750.0"))); - assertThat(response.getRepeatingInvoices().get(0).getRepeatingInvoiceID(), is(equalTo(UUID.fromString("428c0d75-909f-4b04-8403-a48dc27283b0")))); - assertThat(response.getRepeatingInvoices().get(0).getID(), is(equalTo(UUID.fromString("428c0d75-909f-4b04-8403-a48dc27283b0")))); - assertThat(response.getRepeatingInvoices().get(0).getHasAttachments(), is(equalTo(true))); - //System.out.println(response.getRepeatingInvoices().get(0).toString()); - } - - @Test - public void updateRepeatingInvoiceAttachmentByFileNameTest() throws IOException { - System.out.println("@Test - updateRepeatingInvoiceAttachmentByFileName"); - UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - String fileName = "sample5.jpg"; - InputStream inputStream = CustomJsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] body = IOUtils.toByteArray(inputStream); - Attachments response = api.updateRepeatingInvoiceAttachmentByFileName(repeatingInvoiceID, fileName, body); - - assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("d086d5f4-9c3d-4edc-a87e-906248eeb652")))); - assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); - assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/RepeatingInvoices/428c0d75-909f-4b04-8403-a48dc27283b0/Attachments/HelloWorld.jpg"))); - assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); - assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); - //System.out.println(response.getAttachments().get(0).toString()); - } -} diff --git a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java deleted file mode 100644 index d428c9c2..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java +++ /dev/null @@ -1,395 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.api.client.*; -import com.xero.models.accounting.*; -import com.xero.example.CustomJsonConfig; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiReportsTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void getReportAgedPayablesByContactTest() throws IOException { - System.out.println("@Test - getReportAgedPayablesByContact"); - UUID contactId = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - LocalDate date = null; - LocalDate fromDate = null; - LocalDate toDate = null; - ReportWithRows response = api.getReportAgedPayablesByContact(contactId, date, fromDate, toDate); - - assertThat(response.getReports().get(0).getReportID(), is(equalTo("AgedPayablesByContact"))); - assertThat(response.getReports().get(0).getReportName(), is(equalTo("Aged Payables By Contact"))); - assertThat(response.getReports().get(0).getReportType(), is("AgedPayablesByContact")); - assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Invoices"))); - assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("ABC"))); - assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("From 10 October 2017 to 22 April 2019"))); - assertThat(response.getReports().get(0).getReportTitles().get(3), is(equalTo("Showing payments to 22 April 2019"))); - assertThat(response.getReports().get(0).getReportDate(), is(equalTo("22 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-22T15:11:28.085-07:00")))); - assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Date"))); - assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("2017-10-10T00:00:00"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Opening Balance"))); - assertThat(response.getReports().get(0).getRows().get(2).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getValue(), is(equalTo("2018-10-09T00:00:00"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("invoiceID"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("1f3960ae-0537-4438-a4dd-76d785e6d7d8"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SUMMARYROW))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(0).getValue(), is(equalTo("Total"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(4).getValue(), is(equalTo("250.00"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(7).getValue(), is(equalTo("250.00"))); - //System.out.println(response.getReports().toString()); - } - - @Test - public void getReportAgedReceivablesByContactTest() throws IOException { - System.out.println("@Test - getReportAgedReceivablesByContact"); - UUID contactId = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - LocalDate date = null; - LocalDate fromDate = null; - LocalDate toDate = null; - ReportWithRows response = api.getReportAgedReceivablesByContact(contactId, date, fromDate, toDate); - - assertThat(response.getReports().get(0).getReportID(), is(equalTo("AgedReceivablesByContact"))); - assertThat(response.getReports().get(0).getReportName(), is(equalTo("Aged Receivables By Contact"))); - assertThat(response.getReports().get(0).getReportType(), is("AgedReceivablesByContact")); - assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Invoices"))); - assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("ABC"))); - assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("From 10 October 2017 to 23 April 2019"))); - assertThat(response.getReports().get(0).getReportTitles().get(3), is(equalTo("Showing payments to 23 April 2019"))); - assertThat(response.getReports().get(0).getReportDate(), is(equalTo("23 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-23T08:21:02.815-07:00")))); - assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Date"))); - assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("2017-10-10T00:00:00"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Opening Balance"))); - assertThat(response.getReports().get(0).getRows().get(2).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getValue(), is(equalTo("2018-05-13T00:00:00"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("invoiceID"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("40ebad47-24e2-4dc9-a5f5-579df427671b"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(0).getValue(), is(equalTo("2019-04-23T00:00:00"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(4).getValue(), is(equalTo("50.00"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(7).getValue(), is(equalTo("50.00"))); - assertThat(response.getReports().get(0).getRows().get(3).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(3).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SUMMARYROW))); - assertThat(response.getReports().get(0).getRows().get(3).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Closing Balance"))); - assertThat(response.getReports().get(0).getRows().get(3).getRows().get(0).getCells().get(4).getValue(), is(equalTo("150.00"))); - //System.out.println(response.getReports().get(0).toString()); - } - - @Test - public void getReportBalanceSheetTest() throws IOException { - System.out.println("@Test - getReportBalanceSheet"); - String date = null; - Integer periods = null; - String timeframe = null; - String trackingOptionID1 = null; - String trackingOptionID2 = null; - Boolean standardLayout = null; - Boolean paymentsOnly = null; - ReportWithRows response = api.getReportBalanceSheet(date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); - - assertThat(response.getReports().get(0).getReportID(), is(equalTo("BalanceSheet"))); - assertThat(response.getReports().get(0).getReportName(), is(equalTo("Balance Sheet"))); - assertThat(response.getReports().get(0).getReportType(), is(equalTo("BalanceSheet"))); - assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Balance Sheet"))); - assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 3 (NZ-2016-02)"))); - assertThat(response.getReports().get(0).getReportDate(), is(equalTo("12 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-12T13:03:32.778-07:00")))); - assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("30 Apr 2019"))); - assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(1).getTitle(), is(equalTo("Assets"))); - assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(2).getTitle(), is(equalTo("Bank"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Country Savings"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("041207d2-3d61-4e5d-8c1a-b9236955a71c"))); - //System.out.println(response.getReports().toString()); - } - - @Test - public void getReportBankSummaryTest() throws IOException { - System.out.println("@Test - getReportBankSummary"); - LocalDate date = null; - Integer period = null; - Integer timeframe = null; - - ReportWithRows response = api.getReportBankSummary(date, period, timeframe); - assertThat(response.getReports().get(0).getReportID(), is(equalTo("BankSummary"))); - assertThat(response.getReports().get(0).getReportName(), is(equalTo("Bank Summary"))); - assertThat(response.getReports().get(0).getReportType(), is("BankSummary")); - assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Bank Summary"))); - assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("MindBody Test 10 (AU-2016-02)"))); - assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("From 1 April 2019 to 30 April 2019"))); - assertThat(response.getReports().get(0).getReportDate(), is(equalTo("23 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-23T09:05:26.223-07:00")))); - assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Bank Accounts"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Opening Balance"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(2).getValue(), is(equalTo("Cash Received"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(3).getValue(), is(equalTo("Cash Spent"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(4).getValue(), is(equalTo("Closing Balance"))); - assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big City Bank"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("accountID"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("03f9cf1e-2deb-4bf1-b0a8-b57f08672eb8"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SUMMARYROW))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(0).getValue(), is(equalTo("Total"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(4).getValue(), is(equalTo("10.00"))); - //System.out.println(response.getReports().get(0).toString()); - } - - @Test - public void getReportExecutiveSummaryTest() throws IOException { - System.out.println("@Test - getReportExecutiveSummary"); - LocalDate date = null; - ReportWithRows response = api.getReportExecutiveSummary(date); - - assertThat(response.getReports().get(0).getReportID(), is(equalTo("ExecutiveSummary"))); - assertThat(response.getReports().get(0).getReportName(), is(equalTo("Executive Summary"))); - assertThat(response.getReports().get(0).getReportType(), is("ExecutiveSummary")); - assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Executive Summary"))); - assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); - assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("For the month of April 2019"))); - assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T11:04:57.941-07:00")))); - assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Apr 2019"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(2).getValue(), is(equalTo("Mar 2019"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(3).getValue(), is(equalTo("Variance"))); - assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(1).getTitle(), is("Cash")); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Cash received"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getValue(), is(equalTo("0.00"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(2).getValue(), is(equalTo("0.00"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(3).getValue(), is(equalTo("0.0%"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(0).getValue(), is(equalTo("Cash spent"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(1).getValue(), is(equalTo("0.00"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(2).getValue(), is(equalTo("20.00"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(3).getValue(), is(equalTo("-100.0%"))); - //System.out.println(response.getReports().get(0).toString()); - } - - @Test - public void getReportTenNinetyNineTest() throws IOException { - System.out.println("@Test - getReportTenNinetyNine"); - String reportYear = null; - Reports response = api.getReportTenNinetyNine(reportYear); - - assertThat(response.getReports().get(0).getReportName(), is(equalTo("1099 report"))); - assertThat(response.getReports().get(0).getReportDate(), is(equalTo("1 Jan 2016 to 31 Dec 2016"))); - assertThat(response.getReports().get(0).getContacts().get(0).getBox3(), is(equalTo(1000.00))); - assertThat(response.getReports().get(0).getContacts().get(0).getName(), is(equalTo("Bank West"))); - assertThat(response.getReports().get(0).getContacts().get(0).getFederalTaxIDType(), is(equalTo("SSN"))); - assertThat(response.getReports().get(0).getContacts().get(0).getCity(), is(equalTo("Pinehaven"))); - assertThat(response.getReports().get(0).getContacts().get(0).getZip(), is(equalTo("12345"))); - assertThat(response.getReports().get(0).getContacts().get(0).getState(), is(equalTo("CA"))); - assertThat(response.getReports().get(0).getContacts().get(0).getEmail(), is(equalTo("jack@bowest.com"))); - assertThat(response.getReports().get(0).getContacts().get(0).getTaxID(), is(equalTo("234-22-2223"))); - assertThat(response.getReports().get(0).getContacts().get(0).getContactId(), is(equalTo(UUID.fromString("81d5706a-8057-4338-8511-747cd85f4c68")))); - assertThat(response.getReports().get(0).getContacts().get(2).getBox1(), is(equalTo(5543.75))); - //System.out.println(response.getReports().toString()); - } - - @Test - public void getReportTrialBalanceTest() throws IOException { - System.out.println("@Test - getReportTrialBalance"); - LocalDate date = null; - Boolean paymentsOnly = null; - ReportWithRows response = api.getReportTrialBalance(date, paymentsOnly); - - assertThat(response.getReports().get(0).getReportID(), is(equalTo("TrialBalance"))); - assertThat(response.getReports().get(0).getReportName(), is(equalTo("Trial Balance"))); - assertThat(response.getReports().get(0).getReportType(), is("TrialBalance")); - assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Trial Balance"))); - assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); - assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("As at 24 April 2019"))); - assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T11:12:38.724-07:00")))); - assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Account"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Debit"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(2).getValue(), is(equalTo("Credit"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(3).getValue(), is(equalTo("YTD Debit"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(4).getValue(), is(equalTo("YTD Credit"))); - assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(1).getTitle(), is("Revenue")); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big Expense (002)"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); - //System.out.println(response.getReports().get(0).toString()); - } - - @Test - public void getReportBudgetSummaryTest() throws IOException { - System.out.println("@Test - getReportBudgetSummary"); - LocalDate date = null; - Integer period = null; - Integer timeframe = null; - ReportWithRows response = api.getReportBudgetSummary(date, period, timeframe); - - assertThat(response.getReports().get(0).getReportID(), is(equalTo("BudgetSummary"))); - assertThat(response.getReports().get(0).getReportName(), is(equalTo("Budget Summary"))); - assertThat(response.getReports().get(0).getReportType(), is("BudgetSummary")); - assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Overall Budget"))); - assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Budget Summary"))); - assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); - assertThat(response.getReports().get(0).getReportTitles().get(3), is(equalTo("April 2019 to March 2022"))); - assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T11:59:36.350-07:00")))); - assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Account"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Jun-19"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(2).getValue(), is(equalTo("Sep-19"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(3).getValue(), is(equalTo("Dec-19"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(4).getValue(), is(equalTo("Mar-20"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(5).getValue(), is(equalTo("Jun-20"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(6).getValue(), is(equalTo("Sep-20"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(7).getValue(), is(equalTo("Dec-20"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(8).getValue(), is(equalTo("Mar-21"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(9).getValue(), is(equalTo("Jun-21"))); - assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(1).getTitle(), is("Income")); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big Expense"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); - //System.out.println(response.toString()); - } - - @Test - public void getReportProfitAndLossTest() throws IOException { - System.out.println("@Test - getReportProfitAndLoss"); - - LocalDate fromDate = null; - LocalDate toDate = null; - String timeframe = "MONTH"; - Boolean standardLayout = true; - Boolean paymentsOnly = false; - - Integer periods = null; - String trackingCategoryID = null; - String trackingCategoryID2 = null; - String trackingOptionID = null; - String trackingOptionID2 = null; - ReportWithRows response = api.getReportProfitAndLoss(fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); - - assertThat(response.getReports().get(0).getReportID(), is(equalTo("ProfitAndLoss"))); - assertThat(response.getReports().get(0).getReportName(), is(equalTo("Profit and Loss"))); - assertThat(response.getReports().get(0).getReportType(), is("ProfitAndLoss")); - assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Income Statement"))); - assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); - assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("10 October 2018 to 24 April 2019"))); - assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T12:12:53.644-07:00")))); - assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("24 Apr 19"))); - assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); - assertThat(response.getReports().get(0).getRows().get(1).getTitle(), is("Revenue")); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big Expense"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getValue(), is(equalTo("480.00"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getAttributes().get(0).getId(), is(equalTo("account"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); - //System.out.println(response.toString()); - } - - @Test - public void getReportBASorGSTTest() throws IOException { - System.out.println("@Test - getReportBASorGST - not implemented"); - String reportID = null; - //ReportWithRows response = api.getReportBASorGST(reportID); - - // TODO: test validations - //System.out.println(response.getReports().get(0).toString()); - } - - @Test - public void getReportBASorGSTListTest() throws IOException { - System.out.println("@Test - getReportBASorGSTList - not implemented"); - //ReportWithRows response = api.getReportBASorGSTList(); - - // TODO: test validations - //System.out.println(response.getReports().get(0).toString()); - } -} \ No newline at end of file diff --git a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java deleted file mode 100644 index 81624f50..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.api.client.*; -import com.xero.models.accounting.*; -import com.xero.example.CustomJsonConfig; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiTaxRatesTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createTaxRateTest() throws IOException { - System.out.println("@Test - createTaxRate"); - TaxRates taxRates = null; - TaxRates response = api.createTaxRate(taxRates); - - assertThat(response.getTaxRates().get(0).getName(), is(equalTo("SDKTax29067"))); - assertThat(response.getTaxRates().get(0).getTaxType(), is(equalTo("TAX002"))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getName(), is(equalTo("State Tax"))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getRate(), is(equalTo(2.25))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsCompound(), is(equalTo(false))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsNonRecoverable(), is(equalTo(false))); - assertThat(response.getTaxRates().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TaxRate.StatusEnum.ACTIVE))); - assertThat(response.getTaxRates().get(0).getReportTaxType(), is(equalTo(com.xero.models.accounting.TaxRate.ReportTaxTypeEnum.INPUT))); - assertThat(response.getTaxRates().get(0).getCanApplyToAssets(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToEquity(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToExpenses(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToLiabilities(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToRevenue(), is(equalTo(false))); - assertThat(response.getTaxRates().get(0).getDisplayTaxRate(), is(equalTo(2.25))); - assertThat(response.getTaxRates().get(0).getDisplayTaxRate().toString(), is(equalTo("2.25"))); - assertThat(response.getTaxRates().get(0).getEffectiveRate(), is(equalTo(2.25))); - assertThat(response.getTaxRates().get(0).getEffectiveRate().toString(), is(equalTo("2.25"))); - //System.out.println(response.getTaxRates().get(0).toString()); - } - - @Test - public void getTaxRatesTest() throws IOException { - System.out.println("@Test - getTaxRates"); - String where = null; - String order = null; - String taxType = null; - TaxRates response = api.getTaxRates(where, order, taxType); - - assertThat(response.getTaxRates().get(0).getName(), is(equalTo("15% GST on Expenses"))); - assertThat(response.getTaxRates().get(0).getTaxType(), is(equalTo("INPUT2"))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getName(), is(equalTo("GST"))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getRate(), is(equalTo(15.0))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsCompound(), is(equalTo(false))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsNonRecoverable(), is(equalTo(false))); - assertThat(response.getTaxRates().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TaxRate.StatusEnum.ACTIVE))); - assertThat(response.getTaxRates().get(0).getReportTaxType(), is(equalTo(com.xero.models.accounting.TaxRate.ReportTaxTypeEnum.INPUT))); - assertThat(response.getTaxRates().get(0).getCanApplyToAssets(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToEquity(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToExpenses(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToLiabilities(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToRevenue(), is(equalTo(false))); - assertThat(response.getTaxRates().get(0).getDisplayTaxRate(), is(equalTo(15.0))); - assertThat(response.getTaxRates().get(0).getDisplayTaxRate().toString(), is(equalTo("15.0"))); - assertThat(response.getTaxRates().get(0).getEffectiveRate(), is(equalTo(15.0))); - assertThat(response.getTaxRates().get(0).getEffectiveRate().toString(), is(equalTo("15.0"))); - //System.out.println(response.getTaxRates().get(0).toString()); - } - - @Test - public void updateTaxRateTest() throws IOException { - System.out.println("@Test - updateTaxRate"); - TaxRates taxRates = null; - TaxRates response = api.updateTaxRate(taxRates); - - assertThat(response.getTaxRates().get(0).getName(), is(equalTo("SDKTax29067"))); - assertThat(response.getTaxRates().get(0).getTaxType(), is(equalTo("TAX002"))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getName(), is(equalTo("State Tax"))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getRate(), is(equalTo(2.25))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsCompound(), is(equalTo(false))); - assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsNonRecoverable(), is(equalTo(false))); - assertThat(response.getTaxRates().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TaxRate.StatusEnum.DELETED))); - assertThat(response.getTaxRates().get(0).getReportTaxType(), is(equalTo(com.xero.models.accounting.TaxRate.ReportTaxTypeEnum.INPUT))); - assertThat(response.getTaxRates().get(0).getCanApplyToAssets(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToEquity(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToExpenses(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToLiabilities(), is(equalTo(true))); - assertThat(response.getTaxRates().get(0).getCanApplyToRevenue(), is(equalTo(false))); - assertThat(response.getTaxRates().get(0).getDisplayTaxRate(), is(equalTo(2.25))); - assertThat(response.getTaxRates().get(0).getDisplayTaxRate().toString(), is(equalTo("2.25"))); - assertThat(response.getTaxRates().get(0).getEffectiveRate(), is(equalTo(2.25))); - assertThat(response.getTaxRates().get(0).getEffectiveRate().toString(), is(equalTo("2.25"))); - //System.out.println(response.getTaxRates().get(0).toString()); - } -} \ No newline at end of file diff --git a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java deleted file mode 100644 index 95b785fa..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.api.client.*; -import com.xero.models.accounting.*; -import com.xero.example.CustomJsonConfig; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiTrackingCategoriesTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void createTrackingCategoryTest() throws IOException { - System.out.println("@Test - createTrackingCategory"); - TrackingCategory trackingCategory = null; - TrackingCategories response = api.createTrackingCategory(trackingCategory); - - assertThat(response.getTrackingCategories().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("b1df776b-b093-4730-b6ea-590cca40e723")))); - assertThat(response.getTrackingCategories().get(0).getName(), is(equalTo("FooBar"))); - assertThat(response.getTrackingCategories().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingCategory.StatusEnum.ACTIVE))); - //System.out.println(response.getTrackingCategories().get(0).toString()); - } - - @Test - public void createTrackingOptionsTest() throws IOException { - System.out.println("@Test - createTrackingOptions"); - UUID trackingCategoryID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - TrackingOption trackingOption = null; - TrackingOptions response = api.createTrackingOptions(trackingCategoryID, trackingOption); - - assertThat(response.getOptions().get(0).getTrackingOptionID(), is(equalTo(UUID.fromString("34669548-b989-487a-979f-0787d04568a2")))); - assertThat(response.getOptions().get(0).getName(), is(equalTo("Bar40423"))); - assertThat(response.getOptions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingOption.StatusEnum.ACTIVE))); - //System.out.println(response.getOptions().get(0).toString()); - } - - @Test - public void deleteTrackingCategoryTest() throws IOException { - System.out.println("@Test - deleteTrackingCategory"); - UUID trackingCategoryID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - TrackingCategories response = api.deleteTrackingCategory(trackingCategoryID); - - assertThat(response.getTrackingCategories().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("0390bdfd-94f2-49d6-b7a0-4a38c46ebf03")))); - assertThat(response.getTrackingCategories().get(0).getName(), is(equalTo("Foo46189"))); - assertThat(response.getTrackingCategories().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingCategory.StatusEnum.DELETED))); - //System.out.println(response.getTrackingCategories().get(0).toString()); - } - - @Test - public void deleteTrackingOptionsTest() throws IOException { - System.out.println("@Test - deleteTrackingOptions"); - UUID trackingCategoryID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - UUID trackingOptionID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - TrackingOptions response = api.deleteTrackingOptions(trackingCategoryID, trackingOptionID); - - assertThat(response.getOptions().get(0).getTrackingOptionID(), is(equalTo(UUID.fromString("34669548-b989-487a-979f-0787d04568a2")))); - assertThat(response.getOptions().get(0).getName(), is(equalTo("Bar40423"))); - assertThat(response.getOptions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingOption.StatusEnum.DELETED))); - //System.out.println(response.getOptions().toString()); - } - - @Test - public void getTrackingCategoriesTest() throws IOException { - System.out.println("@Test - getTrackingCategories"); - String where = null; - String order = null; - Boolean includeArchived = null; - TrackingCategories response = api.getTrackingCategories(where, order, includeArchived); - - assertThat(response.getTrackingCategories().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("22f10184-0deb-44ae-a312-b1f6ea70e51f")))); - assertThat(response.getTrackingCategories().get(0).getName(), is(equalTo("BarFoo"))); - assertThat(response.getTrackingCategories().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingCategory.StatusEnum.ACTIVE))); - //System.out.println(response.getTrackingCategories().get(0).toString()); - } - - @Test - public void getTrackingCategoryTest() throws IOException { - System.out.println("@Test - getTrackingCategory"); - UUID trackingCategoryID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - TrackingCategories response = api.getTrackingCategory(trackingCategoryID); - - assertThat(response.getTrackingCategories().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("22f10184-0deb-44ae-a312-b1f6ea70e51f")))); - assertThat(response.getTrackingCategories().get(0).getName(), is(equalTo("Foo41157"))); - assertThat(response.getTrackingCategories().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingCategory.StatusEnum.DELETED))); - //System.out.println(response.getTrackingCategories().get(0).toString()); - } - - @Test - public void updateTrackingCategoryTest() throws IOException { - System.out.println("@Test - updateTrackingCategory"); - UUID trackingCategoryID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - TrackingCategory trackingCategory = null; - TrackingCategories response = api.updateTrackingCategory(trackingCategoryID, trackingCategory); - - assertThat(response.getTrackingCategories().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("b1df776b-b093-4730-b6ea-590cca40e723")))); - assertThat(response.getTrackingCategories().get(0).getName(), is(equalTo("BarFoo"))); - assertThat(response.getTrackingCategories().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingCategory.StatusEnum.ACTIVE))); - //System.out.println(response.getTrackingCategories().get(0).toString()); - } -} \ No newline at end of file diff --git a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java deleted file mode 100644 index c09ca1e0..00000000 --- a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.xero.api.client; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - - -import com.xero.api.XeroApiException; -import com.xero.api.ApiClient; -import com.xero.example.CustomJsonConfig; - -import com.xero.api.client.*; -import com.xero.models.accounting.*; - -import com.xero.example.SampleData; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -public class AccountingApiUsersTest { - - CustomJsonConfig config; - ApiClient apiClientForAccounting; - AccountingApi api; - - private static boolean setUpIsDone = false; - - @Before - public void setUp() { - config = new CustomJsonConfig(); - apiClientForAccounting = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null); - api = new AccountingApi(config); - api.setApiClient(apiClientForAccounting); - api.setOAuthToken(config.getConsumerKey(), config.getConsumerSecret()); - - // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs - if (setUpIsDone) { - return; - } - - try { - System.out.println("Sleep for 30 seconds"); - Thread.sleep(60); - } catch(InterruptedException e) { - System.out.println(e); - } - // do the setup - setUpIsDone = true; - } - - public void tearDown() { - api = null; - apiClientForAccounting = null; - } - - @Test - public void getUserTest() throws IOException { - System.out.println("@Test - getUser"); - UUID userID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Users response = api.getUser(userID); - - assertThat(response.getUsers().get(0).getUserID(), is(equalTo(UUID.fromString("3c37ef1d-cd49-4589-9787-3c418ed8b6ac")))); - assertThat(response.getUsers().get(0).getEmailAddress(), is(equalTo("sid.maestre@xero.com"))); - assertThat(response.getUsers().get(0).getFirstName(), is(equalTo("Sidney"))); - assertThat(response.getUsers().get(0).getLastName(), is(equalTo("Maestre"))); - assertThat(response.getUsers().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-10-20T11:14:21.613-07:00")))); - assertThat(response.getUsers().get(0).getIsSubscriber(), is(equalTo(false))); - assertThat(response.getUsers().get(0).getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); - //System.out.println(response.getUsers().get(0).toString()); - } - - @Test - public void getUsersTest() throws IOException { - System.out.println("@Test - getUsers"); - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - Users response = api.getUsers(ifModifiedSince, where, order); - - assertThat(response.getUsers().get(0).getUserID(), is(equalTo(UUID.fromString("3c37ef1d-cd49-4589-9787-3c418ed8b6ac")))); - assertThat(response.getUsers().get(0).getEmailAddress(), is(equalTo("sid.maestre@xero.com"))); - assertThat(response.getUsers().get(0).getFirstName(), is(equalTo("Sidney"))); - assertThat(response.getUsers().get(0).getLastName(), is(equalTo("Maestre"))); - assertThat(response.getUsers().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-10-20T11:14:21.613-07:00")))); - assertThat(response.getUsers().get(0).getIsSubscriber(), is(equalTo(false))); - assertThat(response.getUsers().get(0).getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); - //System.out.println(response.getUsers().toString()); - } -} diff --git a/src/test/java/com/xero/api/exception/XeroExceptionHandlerTest.java b/src/test/java/com/xero/api/exception/XeroExceptionHandlerTest.java deleted file mode 100644 index ef1bc0b3..00000000 --- a/src/test/java/com/xero/api/exception/XeroExceptionHandlerTest.java +++ /dev/null @@ -1,216 +0,0 @@ -package com.xero.api.exception; - -import com.google.api.client.http.HttpResponseException; -import com.xero.api.XeroApiException; -import com.xero.model.ApiException; -import com.xero.model.Elements; -import com.xero.model.Invoice; -import com.xero.model.Payment; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class XeroExceptionHandlerTest { - - @InjectMocks - private XeroExceptionHandler xeroExceptionHandler; - @Mock - private HttpResponseException httpResponseException; - - @Before - public void setUp() throws Exception { - } - - @Test - public void handlePaymentBadRequest() throws Exception { - when(httpResponseException.getContent()).thenReturn(samplePaymentExceptionContent()); - XeroApiException xeroApiException = xeroExceptionHandler.handleBadRequest(httpResponseException); - assertNotNull(xeroApiException); - ApiException apiException = xeroApiException.getApiException(); - assertNotNull(apiException); - assertFalse(apiException.getElements().isEmpty()); - Elements elements = apiException.getElements().get(0); - assertFalse(elements.getDataContractBase().isEmpty()); - Object object = elements.getDataContractBase().get(0); - assertTrue(object instanceof Payment); - } - - @Test - public void handleInvoiceBadRequest() throws Exception { - when(httpResponseException.getContent()).thenReturn(sampleInvoiceExceptionContent()); - XeroApiException xeroApiException = xeroExceptionHandler.handleBadRequest(httpResponseException); - assertNotNull(xeroApiException); - ApiException apiException = xeroApiException.getApiException(); - assertNotNull(apiException); - assertFalse(apiException.getElements().isEmpty()); - Elements elements = apiException.getElements().get(0); - assertFalse(elements.getDataContractBase().isEmpty()); - Object object = elements.getDataContractBase().get(0); - assertTrue(object instanceof Invoice); - } - - @Test - public void handleOAuthErrorRequest() throws Exception { - when(httpResponseException.getContent()).thenReturn(sampleOAuthExceptionContent()); - XeroApiException xeroApiException = xeroExceptionHandler.handleBadRequest(httpResponseException); - assertNotNull(xeroApiException); - assertNotNull(xeroApiException.getMessages()); - assertNotNull(xeroApiException.getMessage()); - } - - @Test - public void handleOtherErrorRequest() throws Exception { - when(httpResponseException.getContent()).thenReturn("dummy"); - when(httpResponseException.getStatusCode()).thenReturn(400); - XeroApiException xeroApiException = xeroExceptionHandler.handleBadRequest(httpResponseException); - assertNotNull(xeroApiException); - assertNotNull(xeroApiException.getMessages()); - assertNotNull(xeroApiException.getMessage()); - assertEquals(xeroApiException.getResponseCode(), 400); - } - - /** - * sample oauth exception - * @return oauth exception - */ - private String sampleOAuthExceptionContent() { - return "oauth_problem=signature_method_rejected&oauth_problem_advice=Public%20applications%20must%20use%20the%20HMAC-SHA1%20signature%20method"; - } - - - /** - * extracted a sample payment exception - * - * @return sample payment exception - */ - private String samplePaymentExceptionContent() { - return " " + - " 10 " + - " ValidationException " + - " A validation exception occurred " + - " " + - " " + - " " + - " " + - " Account could not be found " + - " " + - " " + - " Invoice could not be found " + - " " + - " " + - " 2017-10-26T00:00:00 " + - " 1.00 " + - " " + - " 297c2dc5-cc47-4afd-8ec8-74990b8761e9 " + - " " + - " " + - " 1129952a-d04c-45e6-b829-9788369b4ecf " + - " " + - " " + - " " + - " " + - " " + - " Account could not be found " + - " " + - " " + - " Invoice could not be found " + - " " + - " " + - " 2017-10-26T00:00:00 " + - " 1.00 " + - " " + - " 297c2dc5-cc47-4afd-8ec8-74990b8761ed " + - " " + - " " + - " 1129952a-d04c-45e6-b829-9788369b4ecd " + - " " + - " " + - " " + - ""; - } - - /** - * extracted a sample invoice exception - * - * @return sample invoice exception - */ - private String sampleInvoiceExceptionContent() { - return "\n" + - " 10\n" + - " ValidationException\n" + - " A validation exception occurred\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " The Contact must contain at least 1 of the following elements to identify the contact: Name, ContactID, ContactNumber\n" + - " \n" + - " \n" + - " \n" + - " 00000000-0000-0000-0000-000000000000\n" + - " \n" + - " 2017-10-26T00:00:00\n" + - " 2017-11-02T00:00:00\n" + - " DRAFT\n" + - " Exclusive\n" + - " \n" + - " \n" + - " Monthly rental for property at 56a Wilkins Avenue\n" + - " 395.00\n" + - " OUTPUT\n" + - " 240.00\n" + - " 1714.30\n" + - " 200\n" + - " 4.3400\n" + - " \n" + - " \n" + - " 1714.30\n" + - " 240.00\n" + - " 1954.30\n" + - " ZAR\n" + - " ACCREC\n" + - " 00000000-0000-0000-0000-000000000000\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " The Contact must contain at least 1 of the following elements to identify the contact: Name, ContactID, ContactNumber\n" + - " \n" + - " \n" + - " \n" + - " 00000000-0000-0000-0000-000000000000\n" + - " \n" + - " 2017-10-27T00:00:00\n" + - " 2017-11-02T00:00:00\n" + - " DRAFT\n" + - " Exclusive\n" + - " \n" + - " \n" + - " Monthly rental for property at 56a Wilkins Avenue\n" + - " 395.00\n" + - " OUTPUT\n" + - " 240.00\n" + - " 1714.30\n" + - " 200\n" + - " 4.3400\n" + - " \n" + - " \n" + - " 1714.30\n" + - " 240.00\n" + - " 1954.30\n" + - " ZAR\n" + - " ACCREC\n" + - " 00000000-0000-0000-0000-000000000000\n" + - " \n" + - " \n" + - ""; - } - -} diff --git a/src/test/java/com/xero/api/tests/XeroClientTests.java b/src/test/java/com/xero/api/tests/XeroClientTests.java deleted file mode 100644 index a0399b8c..00000000 --- a/src/test/java/com/xero/api/tests/XeroClientTests.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.xero.api.tests; - -import java.io.IOException; -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import com.xero.api.Config; -import com.xero.api.JsonConfig; -import com.xero.api.XeroClient; -import com.xero.model.Contact; - -public class XeroClientTests { - XeroClient client; - Config config; - - // Squid Proxy Error Code is 407 (Proxy Authentication Required) - protected static final int PROXY_ERROR_CODE = 407; - - @Before - public void setUp() { - client = new XeroClient(); - config = JsonConfig.getInstance(); - } - - @After - public void tearDown() { - client = null; - } - - @Test - public void testGetContacts() { - List contactList; - try { - contactList = client.getContacts(); - assert (contactList.size() > 0); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker deleted file mode 100644 index 1f0955d4..00000000 --- a/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker +++ /dev/null @@ -1 +0,0 @@ -mock-maker-inline From ead5159cc5f1b6834271cb2640cbdcc9fa84db72 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Wed, 5 Jun 2019 11:29:04 -0700 Subject: [PATCH 02/76] beta -2 --- pom.xml | 29 +- src/main/java/com/xero/api/ApiClient.java | 833 +- src/main/java/com/xero/api/ApiException.java | 91 + src/main/java/com/xero/api/ApiResponse.java | 59 + src/main/java/com/xero/api/Configuration.java | 39 + src/main/java/com/xero/api/JSON.java | 44 + src/main/java/com/xero/api/Pair.java | 61 + .../java/com/xero/api/auth/ApiKeyAuth.java | 75 + .../com/xero/api/auth/Authentication.java | 29 + .../java/com/xero/api/auth/HttpBasicAuth.java | 58 + .../com/xero/api/auth/HttpBearerAuth.java | 60 + src/main/java/com/xero/api/auth/OAuth.java | 39 + .../java/com/xero/api/auth/OAuthFlow.java | 18 + .../com/xero/api/client/AccountingApi.java | 33196 ++++++---------- ...stTokenServlet.java => Authorization.java} | 39 +- src/main/java/com/xero/example/Callback.java | 110 + .../java/com/xero/example/TokenStorage.java | 15 +- 17 files changed, 14279 insertions(+), 20516 deletions(-) create mode 100644 src/main/java/com/xero/api/ApiException.java create mode 100644 src/main/java/com/xero/api/ApiResponse.java create mode 100644 src/main/java/com/xero/api/Configuration.java create mode 100644 src/main/java/com/xero/api/JSON.java create mode 100644 src/main/java/com/xero/api/Pair.java create mode 100644 src/main/java/com/xero/api/auth/ApiKeyAuth.java create mode 100644 src/main/java/com/xero/api/auth/Authentication.java create mode 100644 src/main/java/com/xero/api/auth/HttpBasicAuth.java create mode 100644 src/main/java/com/xero/api/auth/HttpBearerAuth.java create mode 100644 src/main/java/com/xero/api/auth/OAuth.java create mode 100644 src/main/java/com/xero/api/auth/OAuthFlow.java rename src/main/java/com/xero/example/{RequestTokenServlet.java => Authorization.java} (59%) mode change 100755 => 100644 create mode 100644 src/main/java/com/xero/example/Callback.java mode change 100755 => 100644 src/main/java/com/xero/example/TokenStorage.java diff --git a/pom.xml b/pom.xml index 9ee63251..85fb37a8 100644 --- a/pom.xml +++ b/pom.xml @@ -129,10 +129,29 @@ swagger-annotations ${swagger-annotations-version} - + + + + org.glassfish.jersey.core - jersey-common - ${jersey-common-version} + jersey-client + ${jersey-version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey-version} + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey-version} + + + + com.brsanthu + migbase64 + 2.2 @@ -302,5 +321,9 @@ 2.6.4 4.12 4.5.3 + 2.27 + 2.9.9 + 2.6.4 + 1.0.0 diff --git a/src/main/java/com/xero/api/ApiClient.java b/src/main/java/com/xero/api/ApiClient.java index 96cbed0d..4f8d8a86 100644 --- a/src/main/java/com/xero/api/ApiClient.java +++ b/src/main/java/com/xero/api/ApiClient.java @@ -1,94 +1,795 @@ package com.xero.api; -import com.xero.api.client.*; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -import org.threeten.bp.*; -import com.google.api.client.googleapis.util.Utils; -import com.google.api.client.http.AbstractHttpContent; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpRequestInitializer; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.json.Json; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Form; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.HttpUrlConnectorProvider; +import org.glassfish.jersey.jackson.JacksonFeature; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.MultiPart; +import org.glassfish.jersey.media.multipart.MultiPartFeature; + import java.io.IOException; -import java.io.OutputStream; +import java.io.InputStream; + +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import org.glassfish.jersey.logging.LoggingFeature; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Map.Entry; +import java.util.HashMap; +import java.util.List; +import java.util.ArrayList; +import java.util.Date; +import java.util.TimeZone; + +import java.net.URLEncoder; + +import java.io.File; +import java.io.UnsupportedEncodingException; + +import java.text.DateFormat; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.xero.api.auth.Authentication; +import com.xero.api.auth.HttpBasicAuth; +import com.xero.api.auth.HttpBearerAuth; +import com.xero.api.auth.ApiKeyAuth; +import com.xero.api.auth.OAuth; public class ApiClient { - private final String basePath; - private final HttpRequestFactory httpRequestFactory; - private final ObjectMapper objectMapper; + protected Map defaultHeaderMap = new HashMap(); + protected String basePath = "https://api.xero.com/api.xro/2.0"; + protected boolean debugging = false; + protected int connectionTimeout = 0; + private int readTimeout = 0; + + protected Client httpClient; + protected JSON json; + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + + public ApiClient() { + json = new JSON(); + httpClient = buildHttpClient(debugging); + + this.dateFormat = new RFC3339DateFormat(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/2.0.0/java"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + authentications.put("OAuth2", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Gets the JSON instance to do JSON serialization and deserialization. + * @return JSON + */ + public JSON getJSON() { + return json; + } + + public Client getHttpClient() { + return httpClient; + } + + public ApiClient setHttpClient(Client httpClient) { + this.httpClient = httpClient; + return this; + } + + public String getBasePath() { + return basePath; + } + + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * @return Map of authentication object + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set bearer token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * @param userAgent Http user agent + * @return API client + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return API client + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * @return True if debugging is switched on + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return API client + */ + public ApiClient setDebugging(boolean debugging) { + this.debugging = debugging; + // Rebuild HTTP Client according to the new "debugging" value. + this.httpClient = buildHttpClient(debugging); + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default tempopary folder. + * + * @return Temp folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set temp folder path + * @param tempFolderPath Temp folder path + * @return API client + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Connect timeout (in milliseconds). + * @return Connection timeout + */ + public int getConnectTimeout() { + return connectionTimeout; + } + + /** + * Set the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * @param connectionTimeout Connection timeout in milliseconds + * @return API client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + this.connectionTimeout = connectionTimeout; + httpClient.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); + return this; + } + + /** + * read timeout (in milliseconds). + * @return Read timeout + */ + public int getReadTimeout() { + return readTimeout; + } + + /** + * Set the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * @param readTimeout Read timeout in milliseconds + * @return API client + */ + public ApiClient setReadTimeout(int readTimeout) { + this.readTimeout = readTimeout; + httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout); + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * @return Date format + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + * @param dateFormat Date format + * @return API client + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + // also set the date format for model (de)serialization with Date properties + this.json.setDateFormat((DateFormat) dateFormat.clone()); + return this; + } + + /** + * Parse the given string into Date object. + * @param str String + * @return Date + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (java.text.ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + * @param date Date + * @return Date in string format + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * @param param Object + * @return Object in string format + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate((Date) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection)param) { + if(b.length() > 0) { + b.append(','); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /* + * Format to {@code Pair} objects. + * @param collectionFormat Collection format + * @param name Name + * @param value Value + * @return List of pairs + */ + public List parameterToPairs(String collectionFormat, String name, Object value){ + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(new Pair(name, parameterToString(value))); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + // get the collection format (default: csv) + String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); + + // create the params based on the collection format + if ("multi".equals(format)) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + + return params; + } + + String delimiter = ","; + + if ("csv".equals(format)) { + delimiter = ","; + } else if ("ssv".equals(format)) { + delimiter = " "; + } else if ("tsv".equals(format)) { + delimiter = "\t"; + } else if ("pipes".equals(format)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME + * @return True if the MIME type is JSON + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * @param str String + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } - private static final String defaultBasePath = "https://api.xero.com/api.xro/2.0"; + /** + * Serialize the given Java object into string entity according the given + * Content-Type (only JSON is supported for now). + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return Entity + * @throws ApiException API exception + */ + public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { + Entity entity; + if (contentType.startsWith("multipart/form-data")) { + MultiPart multiPart = new MultiPart(); + for (Entry param: formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) + .fileName(file.getName()).size(file.length()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + } else { + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); + } + } + entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + Form form = new Form(); + for (Entry param: formParams.entrySet()) { + form.param(param.getKey(), parameterToString(param.getValue())); + } + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); + } else { + // We let jersey handle the serialization + entity = Entity.entity(obj, contentType); + } + return entity; + } - // A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults. - private static ObjectMapper createDefaultObjectMapper() { - ObjectMapper objectMapper = new ObjectMapper() - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) - .setDateFormat(new RFC3339DateFormat()) - .setSerializationInclusion(Include.NON_NULL); - objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); - - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - objectMapper.registerModule(module); - return objectMapper; + /** + * Deserialize response body to Java object according to the Content-Type. + * @param Type + * @param response Response + * @param returnType Return type + * @return Deserialize object + * @throws ApiException API exception + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, GenericType returnType) throws ApiException { + if (response == null || returnType == null) { + return null; } - public ApiClient() { - this(null, null, null, null); + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + return (T) response.readEntity(byte[].class); + } else if (returnType.getRawType() == File.class) { + // Handle file downloading. + T file = (T) downloadFileFromResponse(response); + return file; } - public ApiClient( - String basePath, - HttpTransport httpTransport, - HttpRequestInitializer initializer, - ObjectMapper objectMapper - ) { - this.basePath = basePath == null ? defaultBasePath : ( - basePath.endsWith("/") ? basePath.substring(0, basePath.length() - 1) : basePath - ); - this.httpRequestFactory = (httpTransport == null ? Utils.getDefaultTransport() : httpTransport).createRequestFactory(initializer); - this.objectMapper = (objectMapper == null ? createDefaultObjectMapper() : objectMapper); + String contentType = null; + List contentTypes = response.getHeaders().get("Content-Type"); + if (contentTypes != null && !contentTypes.isEmpty()) + contentType = String.valueOf(contentTypes.get(0)); + + return response.readEntity(returnType); + } + + /** + * Download file from the given response. + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); } + } - public HttpRequestFactory getHttpRequestFactory() { - return httpRequestFactory; + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) + filename = matcher.group(1); } - public String getBasePath() { - return basePath; + String prefix; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf('.'); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // File.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; } - public ObjectMapper getObjectMapper() { - return objectMapper; + if (tempFolderPath == null) + return File.createTempFile(prefix, suffix); + else + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param Type + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @return The response body in type of string + * @throws ApiException API exception + */ + public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams); + + // Not using `.target(this.basePath).path(path)` below, + // to support (constant) query string in `path`, e.g. "/posts?draft=1" + WebTarget target = httpClient.target(this.basePath + path); + + if (queryParams != null) { + for (Pair queryParam : queryParams) { + if (queryParam.getValue() != null) { + target = target.queryParam(queryParam.getName(), queryParam.getValue()); + } + } } - public class JacksonJsonHttpContent extends AbstractHttpContent { - /* A POJO that can be serialized with a com.fasterxml Jackson ObjectMapper */ - private final Object data; + Invocation.Builder invocationBuilder = target.request().accept(accept); - public JacksonJsonHttpContent(Object data) { - super(Json.MEDIA_TYPE); - this.data = data; + for (Entry entry : headerParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(entry.getKey(), value); + } + } + + for (Entry entry : defaultHeaderMap.entrySet()) { + String key = entry.getKey(); + if (!headerParams.containsKey(key)) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(key, value); } + } + } + + Entity entity = serialize(body, formParams, contentType); + + Response response = null; + + try { + if ("GET".equals(method)) { + response = invocationBuilder.get(); + } else if ("POST".equals(method)) { + response = invocationBuilder.post(entity); + } else if ("PUT".equals(method)) { + response = invocationBuilder.put(entity); + } else if ("DELETE".equals(method)) { + response = invocationBuilder.delete(); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.method("PATCH", entity); + } else if ("HEAD".equals(method)) { + response = invocationBuilder.head(); + } else { + throw new ApiException(500, "unknown method type " + method); + } - @Override - public void writeTo(OutputStream out) throws IOException { - objectMapper.writeValue(out, data); + int statusCode = response.getStatusInfo().getStatusCode(); + Map> responseHeaders = buildResponseHeaders(response); + + if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { + return new ApiResponse<>(statusCode, responseHeaders); + } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { + if (returnType == null) + return new ApiResponse<>(statusCode, responseHeaders); + else + return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType)); + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } } + throw new ApiException( + response.getStatus(), + message, + buildResponseHeaders(response), + respBody); + } + } finally { + try { + response.close(); + } catch (Exception e) { + // it's not critical, since the response object is local in method invokeAPI; that's fine, just continue + } + } + } + + /** + * Build the Client used to make HTTP requests. + * @param debugging Debug setting + * @return Client + */ + protected Client buildHttpClient(boolean debugging) { + final ClientConfig clientConfig = new ClientConfig(); + clientConfig.register(MultiPartFeature.class); + clientConfig.register(json); + clientConfig.register(JacksonFeature.class); + clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); + if (debugging) { + clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); + clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); + // Set logger to ALL + java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL); + } + performAdditionalClientConfiguration(clientConfig); + return ClientBuilder.newClient(clientConfig); + } + + protected void performAdditionalClientConfiguration(ClientConfig clientConfig) { + // No-op extension point + } + + protected Map> buildResponseHeaders(Response response) { + Map> responseHeaders = new HashMap>(); + for (Entry> entry: response.getHeaders().entrySet()) { + List values = entry.getValue(); + List headers = new ArrayList(); + for (Object o : values) { + headers.add(String.valueOf(o)); + } + responseHeaders.put(entry.getKey(), headers); } + return responseHeaders; + } - // Builder pattern to get API instances for this client. - - public AccountingApi accountingApi() { - return new AccountingApi(this); + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + */ + protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams); } - + } } diff --git a/src/main/java/com/xero/api/ApiException.java b/src/main/java/com/xero/api/ApiException.java new file mode 100644 index 00000000..d60740ce --- /dev/null +++ b/src/main/java/com/xero/api/ApiException.java @@ -0,0 +1,91 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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; + +import java.util.Map; +import java.util.List; + + +public class ApiException extends Exception { + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/src/main/java/com/xero/api/ApiResponse.java b/src/main/java/com/xero/api/ApiResponse.java new file mode 100644 index 00000000..534c5210 --- /dev/null +++ b/src/main/java/com/xero/api/ApiResponse.java @@ -0,0 +1,59 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +public class ApiResponse { + private final int statusCode; + private final Map> headers; + private final T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/src/main/java/com/xero/api/Configuration.java b/src/main/java/com/xero/api/Configuration.java new file mode 100644 index 00000000..6b12e032 --- /dev/null +++ b/src/main/java/com/xero/api/Configuration.java @@ -0,0 +1,39 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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; + + +public class Configuration { + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/src/main/java/com/xero/api/JSON.java b/src/main/java/com/xero/api/JSON.java new file mode 100644 index 00000000..4947fc09 --- /dev/null +++ b/src/main/java/com/xero/api/JSON.java @@ -0,0 +1,44 @@ +package com.xero.api; + +import org.threeten.bp.*; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; + +import java.text.DateFormat; + +import javax.ws.rs.ext.ContextResolver; + + +public class JSON implements ContextResolver { + private ObjectMapper mapper; + + public JSON() { + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.setDateFormat(new RFC3339DateFormat()); + ThreeTenModule module = new ThreeTenModule(); + module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); + module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); + module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); + mapper.registerModule(module); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class type) { + return mapper; + } +} diff --git a/src/main/java/com/xero/api/Pair.java b/src/main/java/com/xero/api/Pair.java new file mode 100644 index 00000000..e2949056 --- /dev/null +++ b/src/main/java/com/xero/api/Pair.java @@ -0,0 +1,61 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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; + + +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } + + return true; + } +} diff --git a/src/main/java/com/xero/api/auth/ApiKeyAuth.java b/src/main/java/com/xero/api/auth/ApiKeyAuth.java new file mode 100644 index 00000000..17ed77ec --- /dev/null +++ b/src/main/java/com/xero/api/auth/ApiKeyAuth.java @@ -0,0 +1,75 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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.auth; + +import com.xero.api.Pair; + +import java.util.Map; +import java.util.List; + + +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } + } +} diff --git a/src/main/java/com/xero/api/auth/Authentication.java b/src/main/java/com/xero/api/auth/Authentication.java new file mode 100644 index 00000000..72e83f97 --- /dev/null +++ b/src/main/java/com/xero/api/auth/Authentication.java @@ -0,0 +1,29 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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.auth; + +import com.xero.api.Pair; + +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + */ + void applyToParams(List queryParams, Map headerParams); +} diff --git a/src/main/java/com/xero/api/auth/HttpBasicAuth.java b/src/main/java/com/xero/api/auth/HttpBasicAuth.java new file mode 100644 index 00000000..6fc66e5f --- /dev/null +++ b/src/main/java/com/xero/api/auth/HttpBasicAuth.java @@ -0,0 +1,58 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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.auth; + +import com.xero.api.Pair; + +import com.migcomponents.migbase64.Base64; + +import java.util.Map; +import java.util.List; + +import java.io.UnsupportedEncodingException; + + +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams) { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + try { + headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/com/xero/api/auth/HttpBearerAuth.java b/src/main/java/com/xero/api/auth/HttpBearerAuth.java new file mode 100644 index 00000000..2b7ab542 --- /dev/null +++ b/src/main/java/com/xero/api/auth/HttpBearerAuth.java @@ -0,0 +1,60 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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.auth; + +import com.xero.api.Pair; + +import java.util.Map; +import java.util.List; + + +public class HttpBearerAuth implements Authentication { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams) { + if(bearerToken == null) { + return; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/src/main/java/com/xero/api/auth/OAuth.java b/src/main/java/com/xero/api/auth/OAuth.java new file mode 100644 index 00000000..f89c7a54 --- /dev/null +++ b/src/main/java/com/xero/api/auth/OAuth.java @@ -0,0 +1,39 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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.auth; + +import com.xero.api.Pair; + +import java.util.Map; +import java.util.List; + + +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams) { + if (accessToken != null) { + headerParams.put("Authorization", "Bearer " + accessToken); + } + } +} diff --git a/src/main/java/com/xero/api/auth/OAuthFlow.java b/src/main/java/com/xero/api/auth/OAuthFlow.java new file mode 100644 index 00000000..3a52c98d --- /dev/null +++ b/src/main/java/com/xero/api/auth/OAuthFlow.java @@ -0,0 +1,18 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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.auth; + +public enum OAuthFlow { + accessCode, implicit, password, application +} diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index d9c4d91b..d8cbfbf1 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -1,6 +1,12 @@ package com.xero.api.client; +import com.xero.api.ApiException; import com.xero.api.ApiClient; +import com.xero.api.ApiResponse; +import com.xero.api.Configuration; +import com.xero.api.Pair; + +import javax.ws.rs.core.GenericType; import com.xero.models.accounting.Account; import com.xero.models.accounting.Accounts; @@ -51,20449 +57,12777 @@ import java.util.UUID; import com.xero.models.accounting.Users; -import com.fasterxml.jackson.core.type.TypeReference; -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.HttpContent; -import com.google.api.client.http.InputStreamContent; -import com.google.api.client.http.HttpMethods; -import com.google.api.client.http.HttpResponse; -import com.google.api.client.json.Json; - -import javax.ws.rs.core.UriBuilder; -import java.io.IOException; -import java.util.Collection; +import java.util.ArrayList; import java.util.HashMap; -import java.util.Map; import java.util.List; -import java.util.ArrayList; +import java.util.Map; -//import com.xero.api.exception.XeroExceptionHandler; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; +public class AccountingApi { + private ApiClient apiClient; + + public AccountingApi() { + this(Configuration.getDefaultApiClient()); + } + + public AccountingApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Allows you to create a new chart of accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param account Request of type Account (required) + * @return Accounts + * @throws ApiException if fails to make API call + */ + public Accounts createAccount(String xeroTenantId, Account account) throws ApiException { + return createAccountWithHttpInfo(xeroTenantId, account).getData(); + } -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; + /** + * Allows you to create a new chart of accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param account Request of type Account (required) + * @return ApiResponse<Accounts> + * @throws ApiException if fails to make API call + */ + public ApiResponse createAccountWithHttpInfo(String xeroTenantId, Account account) throws ApiException { + Object localVarPostBody = account; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createAccount"); + } + + // verify the required parameter 'account' is set + if (account == null) { + throw new ApiException(400, "Missing the required parameter 'account' when calling createAccount"); + } + + // create path and map variables + String localVarPath = "/Accounts"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create Attachment on Account + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for Account object (required) + * @param fileName Name of the attachment (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws ApiException { + return createAccountAttachmentByFileNameWithHttpInfo(xeroTenantId, accountID, fileName, body).getData(); + } -import java.io.ByteArrayInputStream; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.regex.Pattern; + /** + * Allows you to create Attachment on Account + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for Account object (required) + * @param fileName Name of the attachment (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse createAccountAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); + } + + // verify the required parameter 'accountID' is set + if (accountID == null) { + throw new ApiException(400, "Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Accounts/{AccountID}/Attachments/{FileName}" + .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create a spend or receive money transaction + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactions (required) + * @param summarizeErrors response format that shows validation errors for each bank transaction (optional) + * @return BankTransactions + * @throws ApiException if fails to make API call + */ + public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws ApiException { + return createBankTransactionWithHttpInfo(xeroTenantId, bankTransactions, summarizeErrors).getData(); + } -import javax.ws.rs.core.UriBuilder; + /** + * Allows you to create a spend or receive money transaction + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactions (required) + * @param summarizeErrors response format that shows validation errors for each bank transaction (optional) + * @return ApiResponse<BankTransactions> + * @throws ApiException if fails to make API call + */ + public ApiResponse createBankTransactionWithHttpInfo(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws ApiException { + Object localVarPostBody = bankTransactions; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); + } + + // verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransactions' when calling createBankTransaction"); + } + + // create path and map variables + String localVarPath = "/BankTransactions"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "SummarizeErrors", summarizeErrors)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to createa an Attachment on BankTransaction by Filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param fileName The name of the file being attached (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws ApiException { + return createBankTransactionAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransactionID, fileName, body).getData(); + } + /** + * Allows you to createa an Attachment on BankTransaction by Filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param fileName The name of the file being attached (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse createBankTransactionAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); + } + + // verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}" + .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create history record for a bank transactions + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws ApiException { + return createBankTransactionHistoryRecordWithHttpInfo(xeroTenantId, bankTransactionID, historyRecords).getData(); + } -public class AccountingApi { - private ApiClient apiClient; + /** + * Allows you to create history record for a bank transactions + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createBankTransactionHistoryRecordWithHttpInfo(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); + } + + // verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); + } + + // create path and map variables + String localVarPath = "/BankTransactions/{BankTransactionID}/History" + .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create a bank transfers + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransfers (required) + * @return BankTransfers + * @throws ApiException if fails to make API call + */ + public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers) throws ApiException { + return createBankTransferWithHttpInfo(xeroTenantId, bankTransfers).getData(); + } - public AccountingApi() { - this(new ApiClient()); - } - - public AccountingApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } + /** + * Allows you to create a bank transfers + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransfers (required) + * @return ApiResponse<BankTransfers> + * @throws ApiException if fails to make API call + */ + public ApiResponse createBankTransferWithHttpInfo(String xeroTenantId, BankTransfers bankTransfers) throws ApiException { + Object localVarPostBody = bankTransfers; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); + } + + // verify the required parameter 'bankTransfers' is set + if (bankTransfers == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransfers' when calling createBankTransfer"); + } + + // create path and map variables + String localVarPath = "/BankTransfers"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @param fileName The name of the file being attached to a Bank Transfer (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws ApiException { + return createBankTransferAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransferID, fileName, body).getData(); + } /** - * Allows you to create a new chart of accounts - *

200 - Success - created new Account and return response of type Accounts array with new Account - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param account Request of type Account - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts createAccount(String xeroTenantId, Account account) throws IOException { - HttpResponse response = createAccountForHttpResponse(xeroTenantId, account); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a new chart of accounts - *

200 - Success - created new Account and return response of type Accounts array with new Account - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param account Request of type Account - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts createAccount(String xeroTenantId, Account account, Map params) throws IOException { - HttpResponse response = createAccountForHttpResponse(xeroTenantId, account, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account account) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); - }// verify the required parameter 'account' is set - if (account == null) { - throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(account); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createAccountForHttpResponse(String xeroTenantId, java.io.InputStream account, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); - }// verify the required parameter 'account' is set - if (account == null) { - throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = account == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, account); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account account, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); - }// verify the required parameter 'account' is set - if (account == null) { - throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(account); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create Attachment on Account - *

200 - Success - return response of type Attachments array of Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { - HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create Attachment on Account - *

200 - Success - return response of type Attachments array of Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create a spend or receive money transaction - *

200 - Success - return response of type BankTransactions array with new BankTransaction - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactions The bankTransactions parameter - * @param summarizeErrors response format that shows validation errors for each bank transaction - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { - HttpResponse response = createBankTransactionForHttpResponse(xeroTenantId, bankTransactions, summarizeErrors); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a spend or receive money transaction - *

200 - Success - return response of type BankTransactions array with new BankTransaction - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactions The bankTransactions parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Map params) throws IOException { - HttpResponse response = createBankTransactionForHttpResponse(xeroTenantId, bankTransactions, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, java.io.InputStream bankTransactions, Boolean summarizeErrors, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = bankTransactions == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, BankTransactions bankTransactions, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to createa an Attachment on BankTransaction by Filename - *

200 - Success - return response of Attachments array of Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName The name of the file being attached - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { - HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to createa an Attachment on BankTransaction by Filename - *

200 - Success - return response of Attachments array of Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName The name of the file being attached - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create history record for a bank transactions - *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(xeroTenantId, bankTransactionID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create history record for a bank transactions - *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(xeroTenantId, bankTransactionID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create a bank transfers - *

200 - Success - return response of BankTransfers array of one BankTransfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransfers The bankTransfers parameter - * @return BankTransfers - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers) throws IOException { - HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a bank transfers - *

200 - Success - return response of BankTransfers array of one BankTransfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransfers The bankTransfers parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransfers - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers, Map params) throws IOException { - HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankTransfers bankTransfers) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); - }// verify the required parameter 'bankTransfers' is set - if (bankTransfers == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, java.io.InputStream bankTransfers, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); - }// verify the required parameter 'bankTransfers' is set - if (bankTransfers == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = bankTransfers == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransfers); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankTransfers bankTransfers, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); - }// verify the required parameter 'bankTransfers' is set - if (bankTransfers == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName The name of the file being attached to a Bank Transfer - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { - HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName The name of the file being attached to a Bank Transfer - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - *

200 - Success - return response HistoryRecords array with the newly created HistoryRecord for a Bank Transfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createBankTransferHistoryRecordForHttpResponse(xeroTenantId, bankTransferID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - *

200 - Success - return response HistoryRecords array with the newly created HistoryRecord for a Bank Transfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createBankTransferHistoryRecordForHttpResponse(xeroTenantId, bankTransferID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Create one or many BatchPayments for invoices - *

200 - Success - return response of type BatchPayments array of BatchPayment objects - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects - * @return BatchPayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments) throws IOException { - HttpResponse response = createBatchPaymentForHttpResponse(xeroTenantId, batchPayments); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Create one or many BatchPayments for invoices - *

200 - Success - return response of type BatchPayments array of BatchPayment objects - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BatchPayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments, Map params) throws IOException { - HttpResponse response = createBatchPaymentForHttpResponse(xeroTenantId, batchPayments, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, BatchPayments batchPayments) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); - }// verify the required parameter 'batchPayments' is set - if (batchPayments == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, java.io.InputStream batchPayments, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); - }// verify the required parameter 'batchPayments' is set - if (batchPayments == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = batchPayments == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, batchPayments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, BatchPayments batchPayments, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); - }// verify the required parameter 'batchPayments' is set - if (batchPayments == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create a history record for a Batch Payment - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param batchPaymentID Unique identifier for BatchPayment - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(xeroTenantId, batchPaymentID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a history record for a Batch Payment - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param batchPaymentID Unique identifier for BatchPayment - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(xeroTenantId, batchPaymentID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); - }// verify the required parameter 'batchPaymentID' is set - if (batchPaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); - }// verify the required parameter 'batchPaymentID' is set - if (batchPaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); - }// verify the required parameter 'batchPaymentID' is set - if (batchPaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allow for the creation of new custom payment service for specified Branding Theme - *

200 - Success - return response of type PaymentServices array with newly created PaymentService - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param brandingThemeID Unique identifier for a Branding Theme - * @param paymentService The paymentService parameter - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { - HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, paymentService); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allow for the creation of new custom payment service for specified Branding Theme - *

200 - Success - return response of type PaymentServices array with newly created PaymentService - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param brandingThemeID Unique identifier for a Branding Theme - * @param paymentService The paymentService parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService, Map params) throws IOException { - HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, paymentService, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); - }// verify the required parameter 'paymentService' is set - if (paymentService == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, java.io.InputStream paymentService, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); - }// verify the required parameter 'paymentService' is set - if (paymentService == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = paymentService == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentService); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); - }// verify the required parameter 'paymentService' is set - if (paymentService == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - *

200 - Success - return response of type Contacts array with newly created Contact - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param contact The contact parameter - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts createContact(String xeroTenantId, Contact contact) throws IOException { - HttpResponse response = createContactForHttpResponse(xeroTenantId, contact); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - *

200 - Success - return response of type Contacts array with newly created Contact - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param contact The contact parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts createContact(String xeroTenantId, Contact contact, Map params) throws IOException { - HttpResponse response = createContactForHttpResponse(xeroTenantId, contact, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact contact) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); - }// verify the required parameter 'contact' is set - if (contact == null) { - throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contact); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createContactForHttpResponse(String xeroTenantId, java.io.InputStream contact, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); - }// verify the required parameter 'contact' is set - if (contact == null) { - throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = contact == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contact); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact contact, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); - }// verify the required parameter 'contact' is set - if (contact == null) { - throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contact); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - *

200 - Success - return response of type Attachments array with an newly created Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name for the file you are attaching - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { - HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - *

200 - Success - return response of type Attachments array with an newly created Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name for the file you are attaching - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create a contact group - *

200 - Success - return response of type Contact Groups array of newly created Contact Group - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroups an array of contact groups with names specified - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups) throws IOException { - HttpResponse response = createContactGroupForHttpResponse(xeroTenantId, contactGroups); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a contact group - *

200 - Success - return response of type Contact Groups array of newly created Contact Group - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroups an array of contact groups with names specified - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups, Map params) throws IOException { - HttpResponse response = createContactGroupForHttpResponse(xeroTenantId, contactGroups, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, ContactGroups contactGroups) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); - }// verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, java.io.InputStream contactGroups, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); - }// verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = contactGroups == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, ContactGroups contactGroups, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); - }// verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to add Contacts to a Contract Group - *

200 - Success - return response of type Contacts array of added Contacts - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contacts an array of contacts with ContactID to be added to ContactGroup - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { - HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to add Contacts to a Contract Group - *

200 - Success - return response of type Contacts array of added Contacts - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contacts an array of contacts with ContactID to be added to ContactGroup - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts, Map params) throws IOException { - HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); - }// verify the required parameter 'contacts' is set - if (contacts == null) { - throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, java.io.InputStream contacts, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); - }// verify the required parameter 'contacts' is set - if (contacts == null) { - throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = contacts == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Contacts contacts, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); - }// verify the required parameter 'contacts' is set - if (contacts == null) { - throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a history records of an Contact - *

200 - Success - return response of type History Records array of newly created History Record for a specific Contact - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createContactHistoryForHttpResponse(xeroTenantId, contactID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an Contact - *

200 - Success - return response of type History Records array of newly created History Record for a specific Contact - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createContactHistoryForHttpResponse(xeroTenantId, contactID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create a credit note - *

200 - Success - return response of type Credit Notes array of newly created CreditNote - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNotes an array of Credit Notes with a single CreditNote object. - * @param summarizeErrors shows validation errors for each credit note - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { - HttpResponse response = createCreditNoteForHttpResponse(xeroTenantId, creditNotes, summarizeErrors); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a credit note - *

200 - Success - return response of type Credit Notes array of newly created CreditNote - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNotes an array of Credit Notes with a single CreditNote object. - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Map params) throws IOException { - HttpResponse response = createCreditNoteForHttpResponse(xeroTenantId, creditNotes, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); - }// verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, java.io.InputStream creditNotes, Boolean summarizeErrors, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); - }// verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = creditNotes == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditNotes creditNotes, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); - }// verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create Allocation on CreditNote - *

200 - Success - return response of type Allocations array with newly created Allocation for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param allocations an array of Allocations with single Allocation object defined. - * @return Allocations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { - HttpResponse response = createCreditNoteAllocationForHttpResponse(xeroTenantId, creditNoteID, allocations); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create Allocation on CreditNote - *

200 - Success - return response of type Allocations array with newly created Allocation for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param allocations an array of Allocations with single Allocation object defined. - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Allocations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations, Map params) throws IOException { - HttpResponse response = createCreditNoteAllocationForHttpResponse(xeroTenantId, creditNoteID, allocations, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream allocations, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = allocations == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, Allocations allocations, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create Attachments on CreditNote by file name - *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the file you are attaching to Credit Note - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { - HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create Attachments on CreditNote by file name - *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the file you are attaching to Credit Note - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a history records of an CreditNote - *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an CreditNote - *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency - * @param xeroTenantId Xero identifier for Tenant - * @param currencies The currencies parameter - * @return Currencies - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Currencies createCurrency(String xeroTenantId, Currencies currencies) throws IOException { - HttpResponse response = createCurrencyForHttpResponse(xeroTenantId, currencies); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency - * @param xeroTenantId Xero identifier for Tenant - * @param currencies The currencies parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Currencies - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Currencies createCurrency(String xeroTenantId, Currencies currencies, Map params) throws IOException { - HttpResponse response = createCurrencyForHttpResponse(xeroTenantId, currencies, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencies currencies) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); - }// verify the required parameter 'currencies' is set - if (currencies == null) { - throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, java.io.InputStream currencies, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); - }// verify the required parameter 'currencies' is set - if (currencies == null) { - throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = currencies == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, currencies); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencies currencies, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); - }// verify the required parameter 'currencies' is set - if (currencies == null) { - throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create new employees used in Xero payrun - *

200 - Success - return response of type Employees array with new Employee - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param employees The employees parameter - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees createEmployee(String xeroTenantId, Employees employees) throws IOException { - HttpResponse response = createEmployeeForHttpResponse(xeroTenantId, employees); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create new employees used in Xero payrun - *

200 - Success - return response of type Employees array with new Employee - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param employees The employees parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees createEmployee(String xeroTenantId, Employees employees, Map params) throws IOException { - HttpResponse response = createEmployeeForHttpResponse(xeroTenantId, employees, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees employees) 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 'employees' is set - if (employees == null) { - throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, java.io.InputStream employees, String mediaType) 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 'employees' is set - if (employees == null) { - throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = employees == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees employees, Map params) 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 'employees' is set - if (employees == null) { - throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve expense claims - *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaims The expenseClaims parameter - * @param summarizeErrors shows validation errors for each expense claim - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { - HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, summarizeErrors); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve expense claims - *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaims The expenseClaims parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Map params) throws IOException { - HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, java.io.InputStream expenseClaims, Boolean summarizeErrors, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = expenseClaims == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, ExpenseClaims expenseClaims, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create a history records of an ExpenseClaim - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a history records of an ExpenseClaim - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create any sales invoices or purchase bills - *

200 - Success - return response of type Invoices array with newly created Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoices The invoices parameter - * @param summarizeErrors shows validation errors for each invoice - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices createInvoice(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { - HttpResponse response = createInvoiceForHttpResponse(xeroTenantId, invoices, summarizeErrors); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create any sales invoices or purchase bills - *

200 - Success - return response of type Invoices array with newly created Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoices The invoices parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices createInvoice(String xeroTenantId, Invoices invoices, Map params) throws IOException { - HttpResponse response = createInvoiceForHttpResponse(xeroTenantId, invoices, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); - }// verify the required parameter 'invoices' is set - if (invoices == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, java.io.InputStream invoices, Boolean summarizeErrors, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); - }// verify the required parameter 'invoices' is set - if (invoices == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = invoices == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices invoices, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); - }// verify the required parameter 'invoices' is set - if (invoices == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create an Attachment on invoices or purchase bills by it's filename - *

200 - Success - return response of type Attachments array with newly created Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the file you are attaching - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { - HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create an Attachment on invoices or purchase bills by it's filename - *

200 - Success - return response of type Attachments array with newly created Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the file you are attaching - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a history records of an invoice - *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an invoice - *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create an item - *

200 - Success - return response of type Items array with newly created Item - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param items The items parameter - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items createItem(String xeroTenantId, Items items) throws IOException { - HttpResponse response = createItemForHttpResponse(xeroTenantId, items); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create an item - *

200 - Success - return response of type Items array with newly created Item - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param items The items parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items createItem(String xeroTenantId, Items items, Map params) throws IOException { - HttpResponse response = createItemForHttpResponse(xeroTenantId, items, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); - }// verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(items); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createItemForHttpResponse(String xeroTenantId, java.io.InputStream items, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); - }// verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = items == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); - }// verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(items); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create a history record for items - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createItemHistoryForHttpResponse(xeroTenantId, itemID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a history record for items - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createItemHistoryForHttpResponse(xeroTenantId, itemID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactions The linkedTransactions parameter - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { - HttpResponse response = createLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactions); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactions The linkedTransactions parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions, Map params) throws IOException { - HttpResponse response = createLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactions, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); - }// verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, java.io.InputStream linkedTransactions, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); - }// verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = linkedTransactions == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, LinkedTransactions linkedTransactions, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); - }// verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create a manual journal - *

200 - Success - return response of type ManualJournals array with newly created ManualJournal - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournals The manualJournals parameter - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals) throws IOException { - HttpResponse response = createManualJournalForHttpResponse(xeroTenantId, manualJournals); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a manual journal - *

200 - Success - return response of type ManualJournals array with newly created ManualJournal - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournals The manualJournals parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals, Map params) throws IOException { - HttpResponse response = createManualJournalForHttpResponse(xeroTenantId, manualJournals, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, ManualJournals manualJournals) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); - }// verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, java.io.InputStream manualJournals, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); - }// verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = manualJournals == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, ManualJournals manualJournals, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); - }// verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create a specified Attachment on ManualJournal by file name - *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName The name of the file being attached to a ManualJournal - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { - HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a specified Attachment on ManualJournal by file name - *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName The name of the file being attached to a ManualJournal - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Allocations for overpayments - *

200 - Success - return response of type Allocations array with all Allocation for Overpayments - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @param allocations The allocations parameter - * @return Allocations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { - HttpResponse response = createOverpaymentAllocationForHttpResponse(xeroTenantId, overpaymentID, allocations); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Allocations for overpayments - *

200 - Success - return response of type Allocations array with all Allocation for Overpayments - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @param allocations The allocations parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Allocations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations, Map params) throws IOException { - HttpResponse response = createOverpaymentAllocationForHttpResponse(xeroTenantId, overpaymentID, allocations, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, java.io.InputStream allocations, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = allocations == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, Allocations allocations, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create history records of an Overpayment - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Overpayments - *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create history records of an Overpayment - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Overpayments - *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create payments for invoices and credit notes - *

200 - Success - return response of type Payments array for newly created Payment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param payments The payments parameter - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments createPayment(String xeroTenantId, Payments payments) throws IOException { - HttpResponse response = createPaymentForHttpResponse(xeroTenantId, payments); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create payments for invoices and credit notes - *

200 - Success - return response of type Payments array for newly created Payment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param payments The payments parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments createPayment(String xeroTenantId, Payments payments, Map params) throws IOException { - HttpResponse response = createPaymentForHttpResponse(xeroTenantId, payments, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments payments) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(payments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPaymentForHttpResponse(String xeroTenantId, java.io.InputStream payments, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = payments == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments payments, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(payments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create a history record for a payment - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments - *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Payments - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createPaymentHistoryForHttpResponse(xeroTenantId, paymentID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a history record for a payment - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments - *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Payments - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createPaymentHistoryForHttpResponse(xeroTenantId, paymentID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create payment services - *

200 - Success - return response of type PaymentServices array for newly created PaymentService - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param paymentServices The paymentServices parameter - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices) throws IOException { - HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create payment services - *

200 - Success - return response of type PaymentServices array for newly created PaymentService - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param paymentServices The paymentServices parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices, Map params) throws IOException { - HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, PaymentServices paymentServices) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); - }// verify the required parameter 'paymentServices' is set - if (paymentServices == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, java.io.InputStream paymentServices, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); - }// verify the required parameter 'paymentServices' is set - if (paymentServices == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = paymentServices == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentServices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, PaymentServices paymentServices, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); - }// verify the required parameter 'paymentServices' is set - if (paymentServices == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create an Allocation for prepayments - *

200 - Success - return response of type Allocations array of Allocation for all Prepayment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID The prepaymentID parameter - * @param allocations The allocations parameter - * @return Allocations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { - HttpResponse response = createPrepaymentAllocationForHttpResponse(xeroTenantId, prepaymentID, allocations); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create an Allocation for prepayments - *

200 - Success - return response of type Allocations array of Allocation for all Prepayment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID The prepaymentID parameter - * @param allocations The allocations parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Allocations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations, Map params) throws IOException { - HttpResponse response = createPrepaymentAllocationForHttpResponse(xeroTenantId, prepaymentID, allocations, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, java.io.InputStream allocations, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = allocations == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, Allocations allocations, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create a history record for an Prepayment - *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PrePayment - *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID Unique identifier for a PrePayment - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a history record for an Prepayment - *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PrePayment - *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID Unique identifier for a PrePayment - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create purchase orders - *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrders The purchaseOrders parameter - * @param summarizeErrors shows validation errors for each purchase order. - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { - HttpResponse response = createPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrders, summarizeErrors); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create purchase orders - *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrders The purchaseOrders parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Map params) throws IOException { - HttpResponse response = createPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrders, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, java.io.InputStream purchaseOrders, Boolean summarizeErrors, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = purchaseOrders == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, PurchaseOrders purchaseOrders, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create HistoryRecord for purchase orders - *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PurchaseOrder - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create HistoryRecord for purchase orders - *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PurchaseOrder - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create draft expense claim receipts for any user - *

200 - Success - return response of type Receipts array for newly created Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receipts The receipts parameter - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts createReceipt(String xeroTenantId, Receipts receipts) throws IOException { - HttpResponse response = createReceiptForHttpResponse(xeroTenantId, receipts); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create draft expense claim receipts for any user - *

200 - Success - return response of type Receipts array for newly created Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receipts The receipts parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts createReceipt(String xeroTenantId, Receipts receipts, Map params) throws IOException { - HttpResponse response = createReceiptForHttpResponse(xeroTenantId, receipts, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts receipts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); - }// verify the required parameter 'receipts' is set - if (receipts == null) { - throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createReceiptForHttpResponse(String xeroTenantId, java.io.InputStream receipts, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); - }// verify the required parameter 'receipts' is set - if (receipts == null) { - throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = receipts == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts receipts, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); - }// verify the required parameter 'receipts' is set - if (receipts == null) { - throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create Attachment on expense claim receipts by file name - *

200 - Success - return response of type Attachments array with newly created Attachment for a specified Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param fileName The name of the file being attached to the Receipt - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { - HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create Attachment on expense claim receipts by file name - *

200 - Success - return response of type Attachments array with newly created Attachment for a specified Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param fileName The name of the file being attached to the Receipt - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a history records of an Receipt - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts - *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createReceiptHistoryForHttpResponse(xeroTenantId, receiptID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an Receipt - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts - *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createReceiptHistoryForHttpResponse(xeroTenantId, receiptID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create attachment on repeating invoices by file name - *

200 - Success - return response of type Attachments array with updated Attachment for a specified Repeating Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName The name of the file being attached to a Repeating Invoice - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { - HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create attachment on repeating invoices by file name - *

200 - Success - return response of type Attachments array with updated Attachment for a specified Repeating Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName The name of the file being attached to a Repeating Invoice - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create history for a repeating invoice - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create history for a repeating invoice - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create Tax Rates - *

200 - Success - return response of type TaxRates array newly created TaxRate - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param taxRates The taxRates parameter - * @return TaxRates - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { - HttpResponse response = createTaxRateForHttpResponse(xeroTenantId, taxRates); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create Tax Rates - *

200 - Success - return response of type TaxRates array newly created TaxRate - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param taxRates The taxRates parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TaxRates - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { - HttpResponse response = createTaxRateForHttpResponse(xeroTenantId, taxRates, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); - }// verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, java.io.InputStream taxRates, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); - }// verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = taxRates == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); - }// verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create tracking categories - *

200 - Success - return response of type TrackingCategories array of newly created TrackingCategory - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategory The trackingCategory parameter - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory) throws IOException { - HttpResponse response = createTrackingCategoryForHttpResponse(xeroTenantId, trackingCategory); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create tracking categories - *

200 - Success - return response of type TrackingCategories array of newly created TrackingCategory - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategory The trackingCategory parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory, Map params) throws IOException { - HttpResponse response = createTrackingCategoryForHttpResponse(xeroTenantId, trackingCategory, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, TrackingCategory trackingCategory) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); - }// verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, java.io.InputStream trackingCategory, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); - }// verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = trackingCategory == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, TrackingCategory trackingCategory, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); - }// verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to create options for a specified tracking category - *

200 - Success - return response of type TrackingOptions array of options for a specified category - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingOption The trackingOption parameter - * @return TrackingOptions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { - HttpResponse response = createTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOption); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create options for a specified tracking category - *

200 - Success - return response of type TrackingOptions array of options for a specified category - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingOption The trackingOption parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingOptions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption, Map params) throws IOException { - HttpResponse response = createTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOption, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); - }// verify the required parameter 'trackingOption' is set - if (trackingOption == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, java.io.InputStream trackingOption, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); - }// verify the required parameter 'trackingOption' is set - if (trackingOption == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = trackingOption == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingOption); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); - }// verify the required parameter 'trackingOption' is set - if (trackingOption == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); - } - - - /** - * Allows you to delete a chart of accounts - *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws IOException { - HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to delete a chart of accounts - *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts deleteAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { - HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - - /** - * Allows you to delete a specific Contact from a Contract Group - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contactID Unique identifier for a Contact - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { - deleteContactGroupContactForHttpResponse(xeroTenantId, contactGroupID, contactID); - } - - /** - * Allows you to delete a specific Contact from a Contract Group - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contactID Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID, Map params) throws IOException { - deleteContactGroupContactForHttpResponse(xeroTenantId, contactGroupID, contactID, params); - } - - public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId, UUID contactGroupID, UUID contactID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - - /** - * Allows you to delete all Contacts from a Contract Group - *

200 - Success - return response 204 no content - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID) throws IOException { - deleteContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID); - } - - /** - * Allows you to delete all Contacts from a Contract Group - *

200 - Success - return response 204 no content - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { - deleteContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, params); - } - - public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - - /** - * Allows you to delete a specified item - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteItem(String xeroTenantId, UUID itemID) throws IOException { - deleteItemForHttpResponse(xeroTenantId, itemID); - } - - /** - * Allows you to delete a specified item - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteItem(String xeroTenantId, UUID itemID, Map params) throws IOException { - deleteItemForHttpResponse(xeroTenantId, itemID, params); - } - - public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - - /** - * Allows you to delete a specified linked transactions (billable expenses) - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { - deleteLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); - } - - /** - * Allows you to delete a specified linked transactions (billable expenses) - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { - deleteLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, params); - } - - public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - - /** - * Allows you to update a specified payment for invoices and credit notes - *

200 - Success - return response of type Payments array for updated Payment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param payments The payments parameter - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { - HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update a specified payment for invoices and credit notes - *

200 - Success - return response of type Payments array for updated Payment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param payments The payments parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments, Map params) throws IOException { - HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(payments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, java.io.InputStream payments, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = payments == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, Payments payments, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(payments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to delete tracking categories - *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { - HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to delete tracking categories - *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { - HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - - /** - * Allows you to delete a specified option for a specified tracking category - *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingOptionID Unique identifier for a Tracking Option - * @return TrackingOptions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { - HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to delete a specified option for a specified tracking category - *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingOptionID Unique identifier for a Tracking Option - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingOptions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, Map params) throws IOException { - HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); - }// verify the required parameter 'trackingOptionID' is set - if (trackingOptionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - uriVariables.put("TrackingOptionID", trackingOptionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); - }// verify the required parameter 'trackingOptionID' is set - if (trackingOptionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - uriVariables.put("TrackingOptionID", trackingOptionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); - } - - - /** - * Allows you to email a copy of invoice to related Contact - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param requestEmpty The requestEmpty parameter - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { - emailInvoiceForHttpResponse(xeroTenantId, invoiceID, requestEmpty); - } - - /** - * Allows you to email a copy of invoice to related Contact - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param requestEmpty The requestEmpty parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty, Map params) throws IOException { - emailInvoiceForHttpResponse(xeroTenantId, invoiceID, requestEmpty, params); - } - - public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); - }// verify the required parameter 'requestEmpty' is set - if (requestEmpty == null) { - throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream requestEmpty, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); - }// verify the required parameter 'requestEmpty' is set - if (requestEmpty == null) { - throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = requestEmpty == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, requestEmpty); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); - }// verify the required parameter 'requestEmpty' is set - if (requestEmpty == null) { - throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a single chart of accounts - *

200 - Success - return response of type Accounts array with one Account - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts getAccount(String xeroTenantId, UUID accountID) throws IOException { - HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a single chart of accounts - *

200 - Success - return response of type Accounts array with one Account - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts getAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { - HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachment on Account by Filename - *

200 - Success - return response of attachment for Account as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { - HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachment on Account by Filename - *

200 - Success - return response of attachment for Account as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve specific Attachment on Account - *

200 - Success - return response of attachment for Account as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param attachmentID Unique identifier for Attachment object - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve specific Attachment on Account - *

200 - Success - return response of attachment for Account as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param attachmentID Unique identifier for Attachment object - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getAccountAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{AttachmentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getAccountAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{AttachmentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments for accounts - *

200 - Success - return response of type Attachments array of Attachment - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) throws IOException { - HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments for accounts - *

200 - Success - return response of type Attachments array of Attachment - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getAccountAttachments(String xeroTenantId, UUID accountID, Map params) throws IOException { - HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve the full chart of accounts - *

200 - Success - return response of type Accounts array with 0 to n Account - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getAccountsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve the full chart of accounts - *

200 - Success - return response of type Accounts array with 0 to n Account - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts getAccounts(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getAccountsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getAccountsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getAccountsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a single spend or receive money transaction - *

200 - Success - return response of type BankTransactions array with a specific BankTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a single spend or receive money transaction - *

200 - Success - return response of type BankTransactions array with a specific BankTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { - HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on BankTransaction by Filename - *

200 - Success - return response of attachment for BankTransaction as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName The name of the file being attached - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { - HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on BankTransaction by Filename - *

200 - Success - return response of attachment for BankTransaction as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName The name of the file being attached - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on a specific BankTransaction - *

200 - Success - return response of attachment for BankTransaction as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param attachmentID Xero generated unique identifier for an attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on a specific BankTransaction - *

200 - Success - return response of attachment for BankTransaction as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param attachmentID Xero generated unique identifier for an attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve any attachments to bank transactions - *

200 - Success - return response of type Attachments array with 0 to n Attachment - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any attachments to bank transactions - *

200 - Success - return response of type Attachments array with 0 to n Attachment - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { - HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve any spend or receive money transactions - *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 bank transactions will be returned in a single API call with line items shown for each bank transaction - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any spend or receive money transactions - *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions getBankTransactions(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve history from a bank transactions - *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve history from a bank transactions - *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { - HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve any bank transfers - *

200 - Success - return response of BankTransfers array with one BankTransfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @return BankTransfers - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any bank transfers - *

200 - Success - return response of BankTransfers array with one BankTransfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransfers - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { - HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on BankTransfer by file name - *

200 - Success - return response of binary data from the Attachment to a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName The name of the file being attached to a Bank Transfer - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { - HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on BankTransfer by file name - *

200 - Success - return response of binary data from the Attachment to a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName The name of the file being attached to a Bank Transfer - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on BankTransfer - *

200 - Success - return response of binary data from the Attachment to a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on BankTransfer - *

200 - Success - return response of binary data from the Attachment to a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments from bank transfers - *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments from bank transfers - *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { - HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve history from a bank transfers - *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve history from a bank transfers - *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { - HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve all bank transfers - *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @return BankTransfers - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve all bank transfers - *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransfers - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransfers getBankTransfers(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve history from a Batch Payment - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * @param xeroTenantId Xero identifier for Tenant - * @param batchPaymentID Unique identifier for BatchPayment - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID) throws IOException { - HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve history from a Batch Payment - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * @param xeroTenantId Xero identifier for Tenant - * @param batchPaymentID Unique identifier for BatchPayment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID, Map params) throws IOException { - HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, UUID batchPaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); - }// verify the required parameter 'batchPaymentID' is set - if (batchPaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, UUID batchPaymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); - }// verify the required parameter 'batchPaymentID' is set - if (batchPaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Retrieve either one or many BatchPayments for invoices - *

200 - Success - return response of type BatchPayments array of BatchPayment objects - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @return BatchPayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Retrieve either one or many BatchPayments for invoices - *

200 - Success - return response of type BatchPayments array of BatchPayment objects - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BatchPayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BatchPayments getBatchPayments(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specific BrandingThemes - *

200 - Success - return response of type BrandingThemes with one BrandingTheme - * @param xeroTenantId Xero identifier for Tenant - * @param brandingThemeID Unique identifier for a Branding Theme - * @return BrandingThemes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID) throws IOException { - HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specific BrandingThemes - *

200 - Success - return response of type BrandingThemes with one BrandingTheme - * @param xeroTenantId Xero identifier for Tenant - * @param brandingThemeID Unique identifier for a Branding Theme - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BrandingThemes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { - HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID brandingThemeID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve the Payment services for a Branding Theme - *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService - * @param xeroTenantId Xero identifier for Tenant - * @param brandingThemeID Unique identifier for a Branding Theme - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID) throws IOException { - HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve the Payment services for a Branding Theme - *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService - * @param xeroTenantId Xero identifier for Tenant - * @param brandingThemeID Unique identifier for a Branding Theme - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { - HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve all the BrandingThemes - *

200 - Success - return response of type BrandingThemes - * @param xeroTenantId Xero identifier for Tenant - * @return BrandingThemes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BrandingThemes getBrandingThemes(String xeroTenantId) throws IOException { - HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve all the BrandingThemes - *

200 - Success - return response of type BrandingThemes - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BrandingThemes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BrandingThemes getBrandingThemes(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Contacts array with a unique Contact - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts getContact(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Contacts array with a unique Contact - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts getContact(String xeroTenantId, UUID contactID, Map params) throws IOException { - HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on Contacts by file name - *

200 - Success - return response of attachment for Contact as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name for the file you are attaching - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { - HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on Contacts by file name - *

200 - Success - return response of attachment for Contact as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name for the file you are attaching - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on Contacts - *

200 - Success - return response of attachment for Contact as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on Contacts - *

200 - Success - return response of attachment for Contact as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getContactAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{AttachmentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getContactAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{AttachmentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Attachments array with 0 to N Attachment - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getContactAttachments(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Attachments array with 0 to N Attachment - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getContactAttachments(String xeroTenantId, UUID contactID, Map params) throws IOException { - HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve CISSettings for a contact in a Xero organisation - *

200 - Success - return response of type CISSettings for a specific Contact - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @return CISSettings - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve CISSettings for a contact in a Xero organisation - *

200 - Success - return response of type CISSettings for a specific Contact - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CISSettings - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID, Map params) throws IOException { - HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/CISSettings"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/CISSettings"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a unique Contract Group by ID - *

200 - Success - return response of type Contact Groups array with a specific Contact Group - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) throws IOException { - HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a unique Contract Group by ID - *

200 - Success - return response of type Contact Groups array with a specific Contact Group - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { - HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroup"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroup"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve the ContactID and Name of all the contacts in a contact group - *

200 - Success - return response of type Contact Groups array of Contact Group - * @param xeroTenantId Xero identifier for Tenant - * @param where Filter by an any element - * @param order Order by an any element - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups getContactGroups(String xeroTenantId, String where, String order) throws IOException { - HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve the ContactID and Name of all the contacts in a contact group - *

200 - Success - return response of type Contact Groups array of Contact Group - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups getContactGroups(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a history records of an Contact - *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an Contact - *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID, Map params) throws IOException { - HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactHistory"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactHistory"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Contacts array with 0 to N Contact - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. - * @param page e.g. page=1 - Up to 100 contacts will be returned in a single API call. - * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { - HttpResponse response = getContactsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, page, includeArchived); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Contacts array with 0 to N Contact - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts getContacts(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getContactsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getContactsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (ids != null) { - String key = "IDs"; - Object value = ids; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (includeArchived != null) { - String key = "includeArchived"; - Object value = includeArchived; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getContactsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specific credit note - *

200 - Success - return response of type Credit Notes array with a unique CreditNote - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specific credit note - *

200 - Success - return response of type Credit Notes array with a unique CreditNote - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { - HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNote"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNote"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Credit Note as PDF files - *

200 - Success - return response of binary data from the Attachment to a Credit Note - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { - HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Credit Note as PDF files - *

200 - Success - return response of binary data from the Attachment to a Credit Note - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType, Map params) throws IOException { - HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/pdf"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID creditNoteID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/pdf"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on CreditNote by file name - *

200 - Success - return response of attachment for Credit Note as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the file you are attaching to Credit Note - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { - HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on CreditNote by file name - *

200 - Success - return response of attachment for Credit Note as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the file you are attaching to Credit Note - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on CreditNote - *

200 - Success - return response of attachment for Credit Note as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on CreditNote - *

200 - Success - return response of attachment for Credit Note as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments for credit notes - *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments for credit notes - *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { - HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a history records of an CreditNote - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an CreditNote - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { - HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve any credit notes - *

200 - Success - return response of type Credit Notes array of CreditNote - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any credit notes - *

200 - Success - return response of type Credit Notes array of CreditNote - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CreditNotes getCreditNotes(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve currencies for your organisation - *

200 - Success - return response of type Currencies array with all Currencies - * @param xeroTenantId Xero identifier for Tenant - * @param where Filter by an any element - * @param order Order by an any element - * @return Currencies - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Currencies getCurrencies(String xeroTenantId, String where, String order) throws IOException { - HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve currencies for your organisation - *

200 - Success - return response of type Currencies array with all Currencies - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Currencies - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Currencies getCurrencies(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specific employee used in Xero payrun - *

200 - Success - return response of type Employees array with specified Employee - * @param xeroTenantId Xero identifier for Tenant - * @param employeeID Unique identifier for a Employee - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees getEmployee(String xeroTenantId, UUID employeeID) throws IOException { - HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specific employee used in Xero payrun - *

200 - Success - return response of type Employees array with specified Employee - * @param xeroTenantId Xero identifier for Tenant - * @param employeeID Unique identifier for a Employee - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees getEmployee(String xeroTenantId, UUID employeeID, Map params) throws IOException { - HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getEmployeeForHttpResponse(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"); - } - // 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Map params) 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"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("EmployeeID", employeeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve employees used in Xero payrun - *

200 - Success - return response of type Employees array with all Employee - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve employees used in Xero payrun - *

200 - Success - return response of type Employees array with all Employee - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees getEmployees(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified expense claim - *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID) throws IOException { - HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified expense claim - *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { - HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a history records of an ExpenseClaim - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID) throws IOException { - HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an ExpenseClaim - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { - HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve expense claims - *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve expense claims - *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims getExpenseClaims(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified sales invoice or purchase bill - *

200 - Success - return response of type Invoices array with specified Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices getInvoice(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified sales invoice or purchase bill - *

200 - Success - return response of type Invoices array with specified Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices getInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve invoices or purchase bills as PDF files - *

200 - Success - return response of byte array pdf version of specified Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { - HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve invoices or purchase bills as PDF files - *

200 - Success - return response of byte array pdf version of specified Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType, Map params) throws IOException { - HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/pdf"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID invoiceID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/pdf"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachment on invoices or purchase bills by it's filename - *

200 - Success - return response of attachment for Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the file you are attaching - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { - HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachment on invoices or purchase bills by it's filename - *

200 - Success - return response of attachment for Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the file you are attaching - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID - *

200 - Success - return response of attachment for Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param attachmentID Unique identifier for an Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID - *

200 - Success - return response of attachment for Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param attachmentID Unique identifier for an Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on invoices or purchase bills - *

200 - Success - return response of type Attachments array of Attachments for specified Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on invoices or purchase bills - *

200 - Success - return response of type Attachments array of Attachments for specified Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a history records of an invoice - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an invoice - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve invoice reminder settings - *

200 - Success - return response of Invoice Reminders - * @param xeroTenantId Xero identifier for Tenant - * @return InvoiceReminders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws IOException { - HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve invoice reminder settings - *

200 - Success - return response of Invoice Reminders - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return InvoiceReminders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public InvoiceReminders getInvoiceReminders(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/InvoiceReminders/Settings"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/InvoiceReminders/Settings"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve any sales invoices or purchase bills - *

200 - Success - return response of type Invoices array with all Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param ids Filter by a comma-separated list of InvoicesIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. - * @param invoiceNumbers Filter by a comma-separated list of InvoiceNumbers. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. - * @param contactIDs Filter by a comma-separated list of ContactIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. - * @param statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. - * @param page e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice - * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response - * @param createdByMyApp When set to true you'll only retrieve Invoices created by your app - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { - HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any sales invoices or purchase bills - *

200 - Success - return response of type Invoices array with all Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices getInvoices(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (ids != null) { - String key = "IDs"; - Object value = ids; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (invoiceNumbers != null) { - String key = "InvoiceNumbers"; - Object value = invoiceNumbers; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (contactIDs != null) { - String key = "ContactIDs"; - Object value = contactIDs; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (statuses != null) { - String key = "Statuses"; - Object value = statuses; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (includeArchived != null) { - String key = "includeArchived"; - Object value = includeArchived; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (createdByMyApp != null) { - String key = "createdByMyApp"; - Object value = createdByMyApp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified item - *

200 - Success - return response of type Items array with specified Item - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items getItem(String xeroTenantId, UUID itemID) throws IOException { - HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified item - *

200 - Success - return response of type Items array with specified Item - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items getItem(String xeroTenantId, UUID itemID, Map params) throws IOException { - HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve history for items - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws IOException { - HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve history for items - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID, Map params) throws IOException { - HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItemHistory"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItemHistory"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve any items - *

200 - Success - return response of type Items array with all Item - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - HttpResponse response = getItemsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any items - *

200 - Success - return response of type Items array with all Item - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items getItems(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getItemsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getItemsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getItemsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified journals. - *

200 - Success - return response of type Journals array with specified Journal - * @param xeroTenantId Xero identifier for Tenant - * @param journalID Unique identifier for a Journal - * @return Journals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Journals getJournal(String xeroTenantId, UUID journalID) throws IOException { - HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified journals. - *

200 - Success - return response of type Journals array with specified Journal - * @param xeroTenantId Xero identifier for Tenant - * @param journalID Unique identifier for a Journal - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Journals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Journals getJournal(String xeroTenantId, UUID journalID, Map params) throws IOException { - HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournal"); - }// verify the required parameter 'journalID' is set - if (journalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("JournalID", journalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals/{JournalID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournal"); - }// verify the required parameter 'journalID' is set - if (journalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("JournalID", journalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals/{JournalID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve any journals. - *

200 - Success - return response of type Journals array with all Journals - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned - * @param paymentsOnly Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. - * @return Journals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { - HttpResponse response = getJournalsForHttpResponse(xeroTenantId, ifModifiedSince, offset, paymentsOnly); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any journals. - *

200 - Success - return response of type Journals array with all Journals - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Journals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Journals getJournals(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getJournalsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getJournalsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals"); - if (offset != null) { - String key = "offset"; - Object value = offset; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (paymentsOnly != null) { - String key = "paymentsOnly"; - Object value = paymentsOnly; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getJournalsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { - HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { - HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Retrieve linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. - * @param linkedTransactionID The Xero identifier for an Linked Transaction - * @param sourceTransactionID Filter by the SourceTransactionID. Get all the linked transactions created from a particular ACCPAY invoice - * @param contactID Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. - * @param status Filter by the combination of ContactID and Status. Get all the linked transactions that have been assigned to a particular customer and have a particular status e.g. GET /LinkedTransactions?ContactID=4bb34b03-3378-4bb2-a0ed-6345abf3224e&Status=APPROVED. - * @param targetTransactionID Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { - HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Retrieve linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions getLinkedTransactions(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); - if (page != null) { - String key = "page"; - Object value = page; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (linkedTransactionID != null) { - String key = "LinkedTransactionID"; - Object value = linkedTransactionID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (sourceTransactionID != null) { - String key = "SourceTransactionID"; - Object value = sourceTransactionID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (contactID != null) { - String key = "ContactID"; - Object value = contactID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (targetTransactionID != null) { - String key = "TargetTransactionID"; - Object value = targetTransactionID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified manual journals - *

200 - Success - return response of type ManualJournals array with a specified ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID) throws IOException { - HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified manual journals - *

200 - Success - return response of type ManualJournals array with a specified ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { - HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournal"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournal"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve specified Attachment on ManualJournal by file name - *

200 - Success - return response of attachment for Manual Journal as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName The name of the file being attached to a ManualJournal - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { - HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve specified Attachment on ManualJournal by file name - *

200 - Success - return response of attachment for Manual Journal as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName The name of the file being attached to a ManualJournal - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve specified Attachment on ManualJournals - *

200 - Success - return response of attachment for Manual Journal as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve specified Attachment on ManualJournals - *

200 - Success - return response of attachment for Manual Journal as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachment for manual journals - *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID) throws IOException { - HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachment for manual journals - *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { - HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenantId, UUID manualJournalID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve any manual journals - *

200 - Success - return response of type ManualJournals array with a all ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any manual journals - *

200 - Success - return response of type ManualJournals array with a all ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals getManualJournals(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a URL to an online invoice - *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @return OnlineInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a URL to an online invoice - *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return OnlineInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/OnlineInvoice"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/OnlineInvoice"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. - *

200 - Success - return response of type Organisation array with specified Organisation - * @param xeroTenantId Xero identifier for Tenant - * @param organisationID The organisationID parameter - * @return CISOrgSetting - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID) throws IOException { - HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. - *

200 - Success - return response of type Organisation array with specified Organisation - * @param xeroTenantId Xero identifier for Tenant - * @param organisationID The organisationID parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CISOrgSetting - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID, Map params) throws IOException { - HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantId, UUID organisationID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); - }// verify the required parameter 'organisationID' is set - if (organisationID == null) { - throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OrganisationID", organisationID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation/{OrganisationID}/CISSettings"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantId, UUID organisationID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); - }// verify the required parameter 'organisationID' is set - if (organisationID == null) { - throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OrganisationID", organisationID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation/{OrganisationID}/CISSettings"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Organisation details - *

200 - Success - return response of type Organisation array with all Organisation - * @param xeroTenantId Xero identifier for Tenant - * @return Organisations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Organisations getOrganisations(String xeroTenantId) throws IOException { - HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Organisation details - *

200 - Success - return response of type Organisation array with all Organisation - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Organisations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Organisations getOrganisations(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified overpayments - *

200 - Success - return response of type Overpayments array with specified Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @return Overpayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID) throws IOException { - HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified overpayments - *

200 - Success - return response of type Overpayments array with specified Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Overpayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { - HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID overpaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayment"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayment"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a history records of an Overpayment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID) throws IOException { - HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an Overpayment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { - HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve overpayments - *

200 - Success - return response of type Overpayments array with all Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return Overpayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve overpayments - *

200 - Success - return response of type Overpayments array with all Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Overpayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Overpayments getOverpayments(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified payment for invoices and credit notes - *

200 - Success - return response of type Payments array for specified Payment - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments getPayment(String xeroTenantId, UUID paymentID) throws IOException { - HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified payment for invoices and credit notes - *

200 - Success - return response of type Payments array for specified Payment - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments getPayment(String xeroTenantId, UUID paymentID, Map params) throws IOException { - HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayment"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayment"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve history records of a payment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) throws IOException { - HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve history records of a payment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID, Map params) throws IOException { - HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve payment services - *

200 - Success - return response of type PaymentServices array for all PaymentService - * @param xeroTenantId Xero identifier for Tenant - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices getPaymentServices(String xeroTenantId) throws IOException { - HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve payment services - *

200 - Success - return response of type PaymentServices array for all PaymentService - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices getPaymentServices(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve payments for invoices and credit notes - *

200 - Success - return response of type Payments array for all Payments - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments getPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve payments for invoices and credit notes - *

200 - Success - return response of type Payments array for all Payments - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments getPayments(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified prepayments - *

200 - Success - return response of type Prepayments array for a specified Prepayment - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID Unique identifier for a PrePayment - * @return Prepayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID) throws IOException { - HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified prepayments - *

200 - Success - return response of type Prepayments array for a specified Prepayment - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID Unique identifier for a PrePayment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Prepayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { - HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayment"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayment"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a history records of an Prepayment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID Unique identifier for a PrePayment - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID) throws IOException { - HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an Prepayment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID Unique identifier for a PrePayment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { - HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve prepayments - *

200 - Success - return response of type Prepayments array for all Prepayment - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return Prepayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve prepayments - *

200 - Success - return response of type Prepayments array for all Prepayment - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Prepayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Prepayments getPrepayments(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified purchase orders - *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID) throws IOException { - HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified purchase orders - *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { - HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve history for PurchaseOrder - *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID) throws IOException { - HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve history for PurchaseOrder - *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { - HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve purchase orders - *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param status Filter by purchase order status - * @param dateFrom Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 - * @param dateTo Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 - * @param order Order by an any element - * @param page To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned. - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { - HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve purchase orders - *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders getPurchaseOrders(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); - if (status != null) { - String key = "Status"; - Object value = status; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (dateFrom != null) { - String key = "DateFrom"; - Object value = dateFrom; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (dateTo != null) { - String key = "DateTo"; - Object value = dateTo; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified draft expense claim receipts - *

200 - Success - return response of type Receipts array for a specified Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts getReceipt(String xeroTenantId, UUID receiptID) throws IOException { - HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified draft expense claim receipts - *

200 - Success - return response of type Receipts array for a specified Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts getReceipt(String xeroTenantId, UUID receiptID, Map params) throws IOException { - HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipt"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipt"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on expense claim receipts by file name - *

200 - Success - return response of attachment for Receipt as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param fileName The name of the file being attached to the Receipt - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { - HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on expense claim receipts by file name - *

200 - Success - return response of attachment for Receipt as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param fileName The name of the file being attached to the Receipt - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on expense claim receipts by ID - *

200 - Success - return response of attachment for Receipt as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on expense claim receipts by ID - *

200 - Success - return response of attachment for Receipt as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getReceiptAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getReceiptAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments for expense claim receipts - *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) throws IOException { - HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments for expense claim receipts - *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID, Map params) throws IOException { - HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a history records of an Receipt - *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) throws IOException { - HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an Receipt - *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID, Map params) throws IOException { - HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve draft expense claim receipts for any user - *

200 - Success - return response of type Receipts array for all Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve draft expense claim receipts for any user - *

200 - Success - return response of type Receipts array for all Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts getReceipts(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified repeating invoice - *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @return RepeatingInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified repeating invoice - *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return RepeatingInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve specified attachment on repeating invoices by file name - *

200 - Success - return response of attachment for Repeating Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName The name of the file being attached to a Repeating Invoice - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve specified attachment on repeating invoices by file name - *

200 - Success - return response of attachment for Repeating Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName The name of the file being attached to a Repeating Invoice - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified Attachments on repeating invoices - *

200 - Success - return response of attachment for Repeating Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified Attachments on repeating invoices - *

200 - Success - return response of attachment for Repeating Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public File getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Attachments on repeating invoice - *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on repeating invoice - *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve history for a repeating invoice - *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve history for a repeating invoice - *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve any repeating invoices - *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param where Filter by an any element - * @param order Order by an any element - * @return RepeatingInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, String order) throws IOException { - HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any repeating invoices - *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return RepeatingInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve report for AgedPayablesByContact - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param contactId Unique identifier for a Contact - * @param date The date of the Aged Payables By Contact report - * @param fromDate The from date of the Aged Payables By Contact report - * @param toDate The to date of the Aged Payables By Contact report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for AgedPayablesByContact - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param contactId Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { - HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); - }// verify the required parameter 'contactId' is set - if (contactId == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedPayablesByContact"); - if (contactId != null) { - String key = "contactId"; - Object value = contactId; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (fromDate != null) { - String key = "fromDate"; - Object value = fromDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (toDate != null) { - String key = "toDate"; - Object value = toDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTenantId, UUID contactId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); - }// verify the required parameter 'contactId' is set - if (contactId == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedPayablesByContact"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - // Add the required query param 'contactId' to the map of query params - allParams.put("contactId", contactId); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve report for AgedReceivablesByContact - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param contactId Unique identifier for a Contact - * @param date The date of the Aged Receivables By Contact report - * @param fromDate The from date of the Aged Receivables By Contact report - * @param toDate The to date of the Aged Receivables By Contact report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for AgedReceivablesByContact - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param contactId Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { - HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); - }// verify the required parameter 'contactId' is set - if (contactId == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedReceivablesByContact"); - if (contactId != null) { - String key = "contactId"; - Object value = contactId; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (fromDate != null) { - String key = "fromDate"; - Object value = fromDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (toDate != null) { - String key = "toDate"; - Object value = toDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xeroTenantId, UUID contactId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); - }// verify the required parameter 'contactId' is set - if (contactId == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedReceivablesByContact"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - // Add the required query param 'contactId' to the map of query params - allParams.put("contactId", contactId); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve report for BAS only valid for AU orgs - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param reportID Unique identifier for a Report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) throws IOException { - HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for BAS only valid for AU orgs - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param reportID Unique identifier for a Report - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID, Map params) throws IOException { - HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String reportID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); - }// verify the required parameter 'reportID' is set - if (reportID == null) { - throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReportID", reportID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/{ReportID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String reportID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); - }// verify the required parameter 'reportID' is set - if (reportID == null) { - throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReportID", reportID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/{ReportID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve report for BAS only valid for AU orgs - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws IOException { - HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for BAS only valid for AU orgs - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBASorGSTList(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve report for BalanceSheet - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param date The date of the Balance Sheet report - * @param periods The number of periods for the Balance Sheet report - * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) - * @param trackingOptionID1 The tracking option 1 for the Balance Sheet report - * @param trackingOptionID2 The tracking option 2 for the Balance Sheet report - * @param standardLayout The standard layout boolean for the Balance Sheet report - * @param paymentsOnly return a cash basis for the Balance Sheet report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for BalanceSheet - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBalanceSheet(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BalanceSheet"); - if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (periods != null) { - String key = "periods"; - Object value = periods; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (timeframe != null) { - String key = "timeframe"; - Object value = timeframe; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingOptionID1 != null) { - String key = "trackingOptionID1"; - Object value = trackingOptionID1; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingOptionID2 != null) { - String key = "trackingOptionID2"; - Object value = trackingOptionID2; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (standardLayout != null) { - String key = "standardLayout"; - Object value = standardLayout; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (paymentsOnly != null) { - String key = "paymentsOnly"; - Object value = paymentsOnly; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BalanceSheet"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve report for BankSummary - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param date The date for the Bank Summary report e.g. 2018-03-31 - * @param period The number of periods to compare (integer between 1 and 12) - * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, date, period, timeframe); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for BankSummary - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBankSummary(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BankSummary"); - if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (period != null) { - String key = "period"; - Object value = period; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (timeframe != null) { - String key = "timeframe"; - Object value = timeframe; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BankSummary"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve report for Budget Summary - *

200 - success- return a Report with Rows object - * @param xeroTenantId Xero identifier for Tenant - * @param date The date for the Bank Summary report e.g. 2018-03-31 - * @param period The number of periods to compare (integer between 1 and 12) - * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, date, period, timeframe); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for Budget Summary - *

200 - success- return a Report with Rows object - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBudgetSummary(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BudgetSummary"); - if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (period != null) { - String key = "period"; - Object value = period; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (timeframe != null) { - String key = "timeframe"; - Object value = timeframe; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BudgetSummary"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve report for ExecutiveSummary - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param date The date for the Bank Summary report e.g. 2018-03-31 - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate date) throws IOException { - HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, date); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for ExecutiveSummary - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportExecutiveSummary(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId, LocalDate date) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ExecutiveSummary"); - if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ExecutiveSummary"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve report for ProfitAndLoss - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param fromDate The from date for the ProfitAndLoss report e.g. 2018-03-31 - * @param toDate The to date for the ProfitAndLoss report e.g. 2018-03-31 - * @param periods The number of periods to compare (integer between 1 and 12) - * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) - * @param trackingCategoryID The trackingCategory 1 for the ProfitAndLoss report - * @param trackingCategoryID2 The trackingCategory 2 for the ProfitAndLoss report - * @param trackingOptionID The tracking option 1 for the ProfitAndLoss report - * @param trackingOptionID2 The tracking option 2 for the ProfitAndLoss report - * @param standardLayout Return the standard layout for the ProfitAndLoss report - * @param paymentsOnly Return cash only basis for the ProfitAndLoss report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for ProfitAndLoss - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportProfitAndLoss(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ProfitAndLoss"); - if (fromDate != null) { - String key = "fromDate"; - Object value = fromDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (toDate != null) { - String key = "toDate"; - Object value = toDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (periods != null) { - String key = "periods"; - Object value = periods; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (timeframe != null) { - String key = "timeframe"; - Object value = timeframe; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingCategoryID != null) { - String key = "trackingCategoryID"; - Object value = trackingCategoryID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingCategoryID2 != null) { - String key = "trackingCategoryID2"; - Object value = trackingCategoryID2; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingOptionID != null) { - String key = "trackingOptionID"; - Object value = trackingOptionID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingOptionID2 != null) { - String key = "trackingOptionID2"; - Object value = trackingOptionID2; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (standardLayout != null) { - String key = "standardLayout"; - Object value = standardLayout; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (paymentsOnly != null) { - String key = "paymentsOnly"; - Object value = paymentsOnly; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ProfitAndLoss"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve report for TenNinetyNine - *

200 - Success - return response of type Reports - * @param xeroTenantId Xero identifier for Tenant - * @param reportYear The year of the 1099 report - * @return Reports - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) throws IOException { - HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, reportYear); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for TenNinetyNine - *

200 - Success - return response of type Reports - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Reports - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Reports getReportTenNinetyNine(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, String reportYear) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TenNinetyNine"); - if (reportYear != null) { - String key = "reportYear"; - Object value = reportYear; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TenNinetyNine"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve report for TrialBalance - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param date The date for the Trial Balance report e.g. 2018-03-31 - * @param paymentsOnly Return cash only basis for the Trial Balance report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, date, paymentsOnly); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for TrialBalance - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportTrialBalance(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TrialBalance"); - if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (paymentsOnly != null) { - String key = "paymentsOnly"; - Object value = paymentsOnly; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TrialBalance"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve Tax Rates - *

200 - Success - return response of type TaxRates array with TaxRates - * @param xeroTenantId Xero identifier for Tenant - * @param where Filter by an any element - * @param order Order by an any element - * @param taxType Filter by tax type - * @return TaxRates - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TaxRates getTaxRates(String xeroTenantId, String where, String order, String taxType) throws IOException { - HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, where, order, taxType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Tax Rates - *

200 - Success - return response of type TaxRates array with TaxRates - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TaxRates - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TaxRates getTaxRates(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, String where, String order, String taxType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (taxType != null) { - String key = "TaxType"; - Object value = taxType; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve tracking categories and options - *

200 - Success - return response of type TrackingCategories array of TrackingCategory - * @param xeroTenantId Xero identifier for Tenant - * @param where Filter by an any element - * @param order Order by an any element - * @param includeArchived e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories getTrackingCategories(String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { - HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, where, order, includeArchived); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve tracking categories and options - *

200 - Success - return response of type TrackingCategories array of TrackingCategory - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories getTrackingCategories(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (includeArchived != null) { - String key = "includeArchived"; - Object value = includeArchived; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve tracking categories and options for specified category - *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { - HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve tracking categories and options for specified category - *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { - HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified user - *

200 - Success - return response of type Users array of specified User - * @param xeroTenantId Xero identifier for Tenant - * @param userID Unique identifier for a User - * @return Users - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Users getUser(String xeroTenantId, UUID userID) throws IOException { - HttpResponse response = getUserForHttpResponse(xeroTenantId, userID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified user - *

200 - Success - return response of type Users array of specified User - * @param xeroTenantId Xero identifier for Tenant - * @param userID Unique identifier for a User - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Users - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Users getUser(String xeroTenantId, UUID userID, Map params) throws IOException { - HttpResponse response = getUserForHttpResponse(xeroTenantId, userID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUser"); - }// verify the required parameter 'userID' is set - if (userID == null) { - throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("UserID", userID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users/{UserID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUser"); - }// verify the required parameter 'userID' is set - if (userID == null) { - throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("UserID", userID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users/{UserID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve users - *

200 - Success - return response of type Users array of all User - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @return Users - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getUsersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve users - *

200 - Success - return response of type Users array of all User - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Users - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Users getUsers(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getUsersForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getUsersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users"); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - public HttpResponse getUsersForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } - - - /** - * Allows you to update a chart of accounts - *

200 - Success - update existing Account and return response of type Accounts array with updated Account - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @param accounts Request of type Accounts array with one Account - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { - HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update a chart of accounts - *

200 - Success - update existing Account and return response of type Accounts array with updated Account - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @param accounts Request of type Accounts array with one Account - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts, Map params) throws IOException { - HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); - }// verify the required parameter 'accounts' is set - if (accounts == null) { - throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, java.io.InputStream accounts, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); - }// verify the required parameter 'accounts' is set - if (accounts == null) { - throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = accounts == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, accounts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, Accounts accounts, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); - }// verify the required parameter 'accounts' is set - if (accounts == null) { - throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update Attachment on Account by Filename - *

200 - Success - return response of type Attachments array of Attachment - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update Attachment on Account by Filename - *

200 - Success - return response of type Attachments array of Attachment - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update a single spend or receive money transaction - *

200 - Success - return response of type BankTransactions array with updated BankTransaction - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param bankTransactions The bankTransactions parameter - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { - HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update a single spend or receive money transaction - *

200 - Success - return response of type BankTransactions array with updated BankTransaction - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param bankTransactions The bankTransactions parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions, Map params) throws IOException { - HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, java.io.InputStream bankTransactions, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = bankTransactions == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update an Attachment on BankTransaction by Filename - *

200 - Success - return response of Attachments array of Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName The name of the file being attached - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update an Attachment on BankTransaction by Filename - *

200 - Success - return response of Attachments array of Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName The name of the file being attached - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName The name of the file being attached to a Bank Transfer - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName The name of the file being attached to a Bank Transfer - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - *

200 - Success - return response of type Contacts array with an updated Contact - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param contacts an array of Contacts containing single Contact object with properties to update - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { - HttpResponse response = updateContactForHttpResponse(xeroTenantId, contactID, contacts); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - *

200 - Success - return response of type Contacts array with an updated Contact - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param contacts an array of Contacts containing single Contact object with properties to update - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts, Map params) throws IOException { - HttpResponse response = updateContactForHttpResponse(xeroTenantId, contactID, contacts, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); - }// verify the required parameter 'contacts' is set - if (contacts == null) { - throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, java.io.InputStream contacts, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); - }// verify the required parameter 'contacts' is set - if (contacts == null) { - throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = contacts == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, Contacts contacts, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); - }// verify the required parameter 'contacts' is set - if (contacts == null) { - throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - *

200 - Success - return response of type Attachments array with an updated Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name for the file you are attaching - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - *

200 - Success - return response of type Attachments array with an updated Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name for the file you are attaching - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update a Contract Group - *

200 - Success - return response of type Contact Groups array of updated Contact Group - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contactGroups an array of Contact groups with Name of specific group to update - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { - HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update a Contract Group - *

200 - Success - return response of type Contact Groups array of updated Contact Group - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contactGroups an array of Contact groups with Name of specific group to update - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups, Map params) throws IOException { - HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); - }// verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, java.io.InputStream contactGroups, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); - }// verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = contactGroups == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); - }// verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update a specific credit note - *

200 - Success - return response of type Credit Notes array with updated CreditNote - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param creditNotes an array of Credit Notes containing credit note details to update - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { - HttpResponse response = updateCreditNoteForHttpResponse(xeroTenantId, creditNoteID, creditNotes); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update a specific credit note - *

200 - Success - return response of type Credit Notes array with updated CreditNote - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param creditNotes an array of Credit Notes containing credit note details to update - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes, Map params) throws IOException { - HttpResponse response = updateCreditNoteForHttpResponse(xeroTenantId, creditNoteID, creditNotes, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); - }// verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream creditNotes, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); - }// verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = creditNotes == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); - }// verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update Attachments on CreditNote by file name - *

200 - Success - return response of type Attachments array with updated Attachment for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the file you are attaching to Credit Note - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update Attachments on CreditNote by file name - *

200 - Success - return response of type Attachments array with updated Attachment for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the file you are attaching to Credit Note - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update a specific employee used in Xero payrun - *

200 - Success - return response of type Employees array with updated Employee - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param employeeID Unique identifier for a Employee - * @param employees The employees parameter - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees) throws IOException { - HttpResponse response = updateEmployeeForHttpResponse(xeroTenantId, employeeID, employees); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update a specific employee used in Xero payrun - *

200 - Success - return response of type Employees array with updated Employee - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param employeeID Unique identifier for a Employee - * @param employees The employees parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees, Map params) throws IOException { - HttpResponse response = updateEmployeeForHttpResponse(xeroTenantId, employeeID, employees, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Employees employees) 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 'employees' is set - if (employees == null) { - throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); - } - // 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, java.io.InputStream employees, String mediaType) 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 'employees' is set - if (employees == null) { - throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); - } - // 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); - - HttpContent content = employees == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Employees employees, Map params) 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 'employees' is set - if (employees == null) { - throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("EmployeeID", employeeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update specified expense claims - *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param expenseClaims The expenseClaims parameter - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { - HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update specified expense claims - *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param expenseClaims The expenseClaims parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims, Map params) throws IOException { - HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, java.io.InputStream expenseClaims, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = expenseClaims == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update a specified sales invoices or purchase bills - *

200 - Success - return response of type Invoices array with updated Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param invoices The invoices parameter - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { - HttpResponse response = updateInvoiceForHttpResponse(xeroTenantId, invoiceID, invoices); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update a specified sales invoices or purchase bills - *

200 - Success - return response of type Invoices array with updated Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param invoices The invoices parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices, Map params) throws IOException { - HttpResponse response = updateInvoiceForHttpResponse(xeroTenantId, invoiceID, invoices, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); - }// verify the required parameter 'invoices' is set - if (invoices == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream invoices, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); - }// verify the required parameter 'invoices' is set - if (invoices == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = invoices == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Invoices invoices, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); - }// verify the required parameter 'invoices' is set - if (invoices == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update Attachment on invoices or purchase bills by it's filename - *

200 - Success - return response of type Attachments array with updated Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the file you are attaching - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update Attachment on invoices or purchase bills by it's filename - *

200 - Success - return response of type Attachments array with updated Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the file you are attaching - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to udpate a specified item - *

200 - Success - return response of type Items array with updated Item - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param items The items parameter - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items updateItem(String xeroTenantId, UUID itemID, Items items) throws IOException { - HttpResponse response = updateItemForHttpResponse(xeroTenantId, itemID, items); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to udpate a specified item - *

200 - Success - return response of type Items array with updated Item - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param items The items parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items updateItem(String xeroTenantId, UUID itemID, Items items, Map params) throws IOException { - HttpResponse response = updateItemForHttpResponse(xeroTenantId, itemID, items, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, Items items) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); - }// verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(items); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, java.io.InputStream items, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); - }// verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = items == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, Items items, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); - }// verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(items); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update a specified linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with updated LinkedTransaction - *

400 - Success - return response of type LinkedTransactions array with updated LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @param linkedTransactions The linkedTransactions parameter - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { - HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update a specified linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with updated LinkedTransaction - *

400 - Success - return response of type LinkedTransactions array with updated LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @param linkedTransactions The linkedTransactions parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions, Map params) throws IOException { - HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); - }// verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, java.io.InputStream linkedTransactions, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); - }// verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = linkedTransactions == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); - }// verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update a specified manual journal - *

200 - Success - return response of type ManualJournals array with an updated ManualJournal - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param manualJournals The manualJournals parameter - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { - HttpResponse response = updateManualJournalForHttpResponse(xeroTenantId, manualJournalID, manualJournals); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update a specified manual journal - *

200 - Success - return response of type ManualJournals array with an updated ManualJournal - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param manualJournals The manualJournals parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals, Map params) throws IOException { - HttpResponse response = updateManualJournalForHttpResponse(xeroTenantId, manualJournalID, manualJournals, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); - }// verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, java.io.InputStream manualJournals, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); - }// verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = manualJournals == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); - }// verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update a specified Attachment on ManualJournal by file name - *

200 - Success - return response of type Attachments array with an update Attachment for a ManualJournals - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName The name of the file being attached to a ManualJournal - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update a specified Attachment on ManualJournal by file name - *

200 - Success - return response of type Attachments array with an update Attachment for a ManualJournals - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName The name of the file being attached to a ManualJournal - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update a specified purchase order - *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @param purchaseOrders The purchaseOrders parameter - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { - HttpResponse response = updatePurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, purchaseOrders); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update a specified purchase order - *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @param purchaseOrders The purchaseOrders parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders, Map params) throws IOException { - HttpResponse response = updatePurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, purchaseOrders, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, java.io.InputStream purchaseOrders, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = purchaseOrders == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to retrieve a specified draft expense claim receipts - *

200 - Success - return response of type Receipts array for updated Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param receipts The receipts parameter - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { - HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified draft expense claim receipts - *

200 - Success - return response of type Receipts array for updated Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param receipts The receipts parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts, Map params) throws IOException { - HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); - }// verify the required parameter 'receipts' is set - if (receipts == null) { - throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, java.io.InputStream receipts, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); - }// verify the required parameter 'receipts' is set - if (receipts == null) { - throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = receipts == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Receipts receipts, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); - }// verify the required parameter 'receipts' is set - if (receipts == null) { - throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update Attachment on expense claim receipts by file name - *

200 - Success - return response of type Attachments array with updated Attachment for a specified Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param fileName The name of the file being attached to the Receipt - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update Attachment on expense claim receipts by file name - *

200 - Success - return response of type Attachments array with updated Attachment for a specified Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param fileName The name of the file being attached to the Receipt - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update specified attachment on repeating invoices by file name - *

200 - Success - return response of type Attachments array with specified Attachment for a specified Repeating Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName The name of the file being attached to a Repeating Invoice - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update specified attachment on repeating invoices by file name - *

200 - Success - return response of type Attachments array with specified Attachment for a specified Repeating Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName The name of the file being attached to a Repeating Invoice - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update Tax Rates - *

200 - Success - return response of type TaxRates array updated TaxRate - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param taxRates The taxRates parameter - * @return TaxRates - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { - HttpResponse response = updateTaxRateForHttpResponse(xeroTenantId, taxRates); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update Tax Rates - *

200 - Success - return response of type TaxRates array updated TaxRate - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param taxRates The taxRates parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TaxRates - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { - HttpResponse response = updateTaxRateForHttpResponse(xeroTenantId, taxRates, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); - }// verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, java.io.InputStream taxRates, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); - }// verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = taxRates == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); - }// verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); - } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - - /** - * Allows you to update tracking categories - *

200 - Success - return response of type TrackingCategories array of updated TrackingCategory - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingCategory The trackingCategory parameter - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { - HttpResponse response = updateTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, trackingCategory); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update tracking categories - *

200 - Success - return response of type TrackingCategories array of updated TrackingCategory - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingCategory The trackingCategory parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory, Map params) throws IOException { - HttpResponse response = updateTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, trackingCategory, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); - }// verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, java.io.InputStream trackingCategory, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); - }// verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = trackingCategory == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } - - public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); - }// verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); - } + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @param fileName The name of the file being attached to a Bank Transfer (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse createBankTransferAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); + } + + // verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}" + .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws ApiException { + return createBankTransferHistoryRecordWithHttpInfo(xeroTenantId, bankTransferID, historyRecords).getData(); + } + + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createBankTransferHistoryRecordWithHttpInfo(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); + } + + // verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); + } + + // create path and map variables + String localVarPath = "/BankTransfers/{BankTransferID}/History" + .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Create one or many BatchPayments for invoices + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects (required) + * @return BatchPayments + * @throws ApiException if fails to make API call + */ + public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments) throws ApiException { + return createBatchPaymentWithHttpInfo(xeroTenantId, batchPayments).getData(); + } + + /** + * Create one or many BatchPayments for invoices + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects (required) + * @return ApiResponse<BatchPayments> + * @throws ApiException if fails to make API call + */ + public ApiResponse createBatchPaymentWithHttpInfo(String xeroTenantId, BatchPayments batchPayments) throws ApiException { + Object localVarPostBody = batchPayments; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); + } + + // verify the required parameter 'batchPayments' is set + if (batchPayments == null) { + throw new ApiException(400, "Missing the required parameter 'batchPayments' when calling createBatchPayment"); + } + + // create path and map variables + String localVarPath = "/BatchPayments"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create a history record for a Batch Payment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param batchPaymentID Unique identifier for BatchPayment (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws ApiException { + return createBatchPaymentHistoryRecordWithHttpInfo(xeroTenantId, batchPaymentID, historyRecords).getData(); + } + + /** + * Allows you to create a history record for a Batch Payment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param batchPaymentID Unique identifier for BatchPayment (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createBatchPaymentHistoryRecordWithHttpInfo(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); + } + + // verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new ApiException(400, "Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); + } + + // create path and map variables + String localVarPath = "/BatchPayments/{BatchPaymentID}/History" + .replaceAll("\\{" + "BatchPaymentID" + "\\}", apiClient.escapeString(batchPaymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allow for the creation of new custom payment service for specified Branding Theme + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param brandingThemeID Unique identifier for a Branding Theme (required) + * @param paymentService (required) + * @return PaymentServices + * @throws ApiException if fails to make API call + */ + public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws ApiException { + return createBrandingThemePaymentServicesWithHttpInfo(xeroTenantId, brandingThemeID, paymentService).getData(); + } + + /** + * Allow for the creation of new custom payment service for specified Branding Theme + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param brandingThemeID Unique identifier for a Branding Theme (required) + * @param paymentService (required) + * @return ApiResponse<PaymentServices> + * @throws ApiException if fails to make API call + */ + public ApiResponse createBrandingThemePaymentServicesWithHttpInfo(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws ApiException { + Object localVarPostBody = paymentService; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); + } + + // verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new ApiException(400, "Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); + } + + // verify the required parameter 'paymentService' is set + if (paymentService == null) { + throw new ApiException(400, "Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); + } + + // create path and map variables + String localVarPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices" + .replaceAll("\\{" + "BrandingThemeID" + "\\}", apiClient.escapeString(brandingThemeID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contact (required) + * @return Contacts + * @throws ApiException if fails to make API call + */ + public Contacts createContact(String xeroTenantId, Contact contact) throws ApiException { + return createContactWithHttpInfo(xeroTenantId, contact).getData(); + } + + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contact (required) + * @return ApiResponse<Contacts> + * @throws ApiException if fails to make API call + */ + public ApiResponse createContactWithHttpInfo(String xeroTenantId, Contact contact) throws ApiException { + Object localVarPostBody = contact; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createContact"); + } + + // verify the required parameter 'contact' is set + if (contact == null) { + throw new ApiException(400, "Missing the required parameter 'contact' when calling createContact"); + } + + // create path and map variables + String localVarPath = "/Contacts"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param fileName Name for the file you are attaching (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws ApiException { + return createContactAttachmentByFileNameWithHttpInfo(xeroTenantId, contactID, fileName, body).getData(); + } + + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param fileName Name for the file you are attaching (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse createContactAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); + } + + // verify the required parameter 'contactID' is set + if (contactID == null) { + throw new ApiException(400, "Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createContactAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Contacts/{ContactID}/Attachments/{FileName}" + .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create a contact group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroups an array of contact groups with names specified (required) + * @return ContactGroups + * @throws ApiException if fails to make API call + */ + public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups) throws ApiException { + return createContactGroupWithHttpInfo(xeroTenantId, contactGroups).getData(); + } + + /** + * Allows you to create a contact group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroups an array of contact groups with names specified (required) + * @return ApiResponse<ContactGroups> + * @throws ApiException if fails to make API call + */ + public ApiResponse createContactGroupWithHttpInfo(String xeroTenantId, ContactGroups contactGroups) throws ApiException { + Object localVarPostBody = contactGroups; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createContactGroup"); + } + + // verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new ApiException(400, "Missing the required parameter 'contactGroups' when calling createContactGroup"); + } + + // create path and map variables + String localVarPath = "/ContactGroups"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to add Contacts to a Contract Group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroupID Unique identifier for a Contact Group (required) + * @param contacts an array of contacts with ContactID to be added to ContactGroup (required) + * @return Contacts + * @throws ApiException if fails to make API call + */ + public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws ApiException { + return createContactGroupContactsWithHttpInfo(xeroTenantId, contactGroupID, contacts).getData(); + } + + /** + * Allows you to add Contacts to a Contract Group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroupID Unique identifier for a Contact Group (required) + * @param contacts an array of contacts with ContactID to be added to ContactGroup (required) + * @return ApiResponse<Contacts> + * @throws ApiException if fails to make API call + */ + public ApiResponse createContactGroupContactsWithHttpInfo(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws ApiException { + Object localVarPostBody = contacts; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); + } + + // verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new ApiException(400, "Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); + } + + // verify the required parameter 'contacts' is set + if (contacts == null) { + throw new ApiException(400, "Missing the required parameter 'contacts' when calling createContactGroupContacts"); + } + + // create path and map variables + String localVarPath = "/ContactGroups/{ContactGroupID}/Contacts" + .replaceAll("\\{" + "ContactGroupID" + "\\}", apiClient.escapeString(contactGroupID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a history records of an Contact + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws ApiException { + return createContactHistoryWithHttpInfo(xeroTenantId, contactID, historyRecords).getData(); + } + + /** + * Allows you to retrieve a history records of an Contact + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createContactHistoryWithHttpInfo(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createContactHistory"); + } + + // verify the required parameter 'contactID' is set + if (contactID == null) { + throw new ApiException(400, "Missing the required parameter 'contactID' when calling createContactHistory"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createContactHistory"); + } + + // create path and map variables + String localVarPath = "/Contacts/{ContactID}/History" + .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create a credit note + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNotes an array of Credit Notes with a single CreditNote object. (required) + * @param summarizeErrors shows validation errors for each credit note (optional) + * @return CreditNotes + * @throws ApiException if fails to make API call + */ + public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws ApiException { + return createCreditNoteWithHttpInfo(xeroTenantId, creditNotes, summarizeErrors).getData(); + } + + /** + * Allows you to create a credit note + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNotes an array of Credit Notes with a single CreditNote object. (required) + * @param summarizeErrors shows validation errors for each credit note (optional) + * @return ApiResponse<CreditNotes> + * @throws ApiException if fails to make API call + */ + public ApiResponse createCreditNoteWithHttpInfo(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws ApiException { + Object localVarPostBody = creditNotes; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createCreditNote"); + } + + // verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new ApiException(400, "Missing the required parameter 'creditNotes' when calling createCreditNote"); + } + + // create path and map variables + String localVarPath = "/CreditNotes"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "SummarizeErrors", summarizeErrors)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create Allocation on CreditNote + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param allocations an array of Allocations with single Allocation object defined. (required) + * @return Allocations + * @throws ApiException if fails to make API call + */ + public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws ApiException { + return createCreditNoteAllocationWithHttpInfo(xeroTenantId, creditNoteID, allocations).getData(); + } + + /** + * Allows you to create Allocation on CreditNote + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param allocations an array of Allocations with single Allocation object defined. (required) + * @return ApiResponse<Allocations> + * @throws ApiException if fails to make API call + */ + public ApiResponse createCreditNoteAllocationWithHttpInfo(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws ApiException { + Object localVarPostBody = allocations; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); + } + + // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); + } + + // verify the required parameter 'allocations' is set + if (allocations == null) { + throw new ApiException(400, "Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); + } + + // create path and map variables + String localVarPath = "/CreditNotes/{CreditNoteID}/Allocations" + .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create Attachments on CreditNote by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param fileName Name of the file you are attaching to Credit Note (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws ApiException { + return createCreditNoteAttachmentByFileNameWithHttpInfo(xeroTenantId, creditNoteID, fileName, body).getData(); + } + + /** + * Allows you to create Attachments on CreditNote by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param fileName Name of the file you are attaching to Credit Note (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse createCreditNoteAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); + } + + // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}" + .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a history records of an CreditNote + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws ApiException { + return createCreditNoteHistoryWithHttpInfo(xeroTenantId, creditNoteID, historyRecords).getData(); + } + + /** + * Allows you to retrieve a history records of an CreditNote + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createCreditNoteHistoryWithHttpInfo(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); + } + + // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); + } + + // create path and map variables + String localVarPath = "/CreditNotes/{CreditNoteID}/History" + .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param currencies (required) + * @return Currencies + * @throws ApiException if fails to make API call + */ + public Currencies createCurrency(String xeroTenantId, Currencies currencies) throws ApiException { + return createCurrencyWithHttpInfo(xeroTenantId, currencies).getData(); + } + + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param currencies (required) + * @return ApiResponse<Currencies> + * @throws ApiException if fails to make API call + */ + public ApiResponse createCurrencyWithHttpInfo(String xeroTenantId, Currencies currencies) throws ApiException { + Object localVarPostBody = currencies; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createCurrency"); + } + + // verify the required parameter 'currencies' is set + if (currencies == null) { + throw new ApiException(400, "Missing the required parameter 'currencies' when calling createCurrency"); + } + + // create path and map variables + String localVarPath = "/Currencies"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create new employees used in Xero payrun + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param employees (required) + * @return Employees + * @throws ApiException if fails to make API call + */ + public Employees createEmployee(String xeroTenantId, Employees employees) throws ApiException { + return createEmployeeWithHttpInfo(xeroTenantId, employees).getData(); + } + + /** + * Allows you to create new employees used in Xero payrun + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param employees (required) + * @return ApiResponse<Employees> + * @throws ApiException if fails to make API call + */ + public ApiResponse createEmployeeWithHttpInfo(String xeroTenantId, Employees employees) throws ApiException { + Object localVarPostBody = employees; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createEmployee"); + } + + // verify the required parameter 'employees' is set + if (employees == null) { + throw new ApiException(400, "Missing the required parameter 'employees' when calling createEmployee"); + } + + // create path and map variables + String localVarPath = "/Employees"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve expense claims + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param expenseClaims (required) + * @param summarizeErrors shows validation errors for each expense claim (optional) + * @return ExpenseClaims + * @throws ApiException if fails to make API call + */ + public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws ApiException { + return createExpenseClaimWithHttpInfo(xeroTenantId, expenseClaims, summarizeErrors).getData(); + } + + /** + * Allows you to retrieve expense claims + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param expenseClaims (required) + * @param summarizeErrors shows validation errors for each expense claim (optional) + * @return ApiResponse<ExpenseClaims> + * @throws ApiException if fails to make API call + */ + public ApiResponse createExpenseClaimWithHttpInfo(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws ApiException { + Object localVarPostBody = expenseClaims; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); + } + + // verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new ApiException(400, "Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); + } + + // create path and map variables + String localVarPath = "/ExpenseClaims"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "SummarizeErrors", summarizeErrors)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create a history records of an ExpenseClaim + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param expenseClaimID Unique identifier for a ExpenseClaim (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws ApiException { + return createExpenseClaimHistoryWithHttpInfo(xeroTenantId, expenseClaimID, historyRecords).getData(); + } + + /** + * Allows you to create a history records of an ExpenseClaim + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param expenseClaimID Unique identifier for a ExpenseClaim (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createExpenseClaimHistoryWithHttpInfo(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); + } + + // verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new ApiException(400, "Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); + } + + // create path and map variables + String localVarPath = "/ExpenseClaims/{ExpenseClaimID}/History" + .replaceAll("\\{" + "ExpenseClaimID" + "\\}", apiClient.escapeString(expenseClaimID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create any sales invoices or purchase bills + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoices (required) + * @param summarizeErrors shows validation errors for each invoice (optional) + * @return Invoices + * @throws ApiException if fails to make API call + */ + public Invoices createInvoice(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws ApiException { + return createInvoiceWithHttpInfo(xeroTenantId, invoices, summarizeErrors).getData(); + } + + /** + * Allows you to create any sales invoices or purchase bills + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoices (required) + * @param summarizeErrors shows validation errors for each invoice (optional) + * @return ApiResponse<Invoices> + * @throws ApiException if fails to make API call + */ + public ApiResponse createInvoiceWithHttpInfo(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws ApiException { + Object localVarPostBody = invoices; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createInvoice"); + } + + // verify the required parameter 'invoices' is set + if (invoices == null) { + throw new ApiException(400, "Missing the required parameter 'invoices' when calling createInvoice"); + } + + // create path and map variables + String localVarPath = "/Invoices"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "SummarizeErrors", summarizeErrors)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create an Attachment on invoices or purchase bills by it's filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param fileName Name of the file you are attaching (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws ApiException { + return createInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, invoiceID, fileName, body).getData(); + } + + /** + * Allows you to create an Attachment on invoices or purchase bills by it's filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param fileName Name of the file you are attaching (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse createInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}/Attachments/{FileName}" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a history records of an invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws ApiException { + return createInvoiceHistoryWithHttpInfo(xeroTenantId, invoiceID, historyRecords).getData(); + } + + /** + * Allows you to retrieve a history records of an invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createInvoiceHistoryWithHttpInfo(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}/History" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create an item + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param items (required) + * @return Items + * @throws ApiException if fails to make API call + */ + public Items createItem(String xeroTenantId, Items items) throws ApiException { + return createItemWithHttpInfo(xeroTenantId, items).getData(); + } + + /** + * Allows you to create an item + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param items (required) + * @return ApiResponse<Items> + * @throws ApiException if fails to make API call + */ + public ApiResponse createItemWithHttpInfo(String xeroTenantId, Items items) throws ApiException { + Object localVarPostBody = items; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createItem"); + } + + // verify the required parameter 'items' is set + if (items == null) { + throw new ApiException(400, "Missing the required parameter 'items' when calling createItem"); + } + + // create path and map variables + String localVarPath = "/Items"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create a history record for items + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param itemID Unique identifier for an Item (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws ApiException { + return createItemHistoryWithHttpInfo(xeroTenantId, itemID, historyRecords).getData(); + } + + /** + * Allows you to create a history record for items + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param itemID Unique identifier for an Item (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createItemHistoryWithHttpInfo(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createItemHistory"); + } + + // verify the required parameter 'itemID' is set + if (itemID == null) { + throw new ApiException(400, "Missing the required parameter 'itemID' when calling createItemHistory"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createItemHistory"); + } + + // create path and map variables + String localVarPath = "/Items/{ItemID}/History" + .replaceAll("\\{" + "ItemID" + "\\}", apiClient.escapeString(itemID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create linked transactions (billable expenses) + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param linkedTransactions (required) + * @return LinkedTransactions + * @throws ApiException if fails to make API call + */ + public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions) throws ApiException { + return createLinkedTransactionWithHttpInfo(xeroTenantId, linkedTransactions).getData(); + } + + /** + * Allows you to create linked transactions (billable expenses) + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param linkedTransactions (required) + * @return ApiResponse<LinkedTransactions> + * @throws ApiException if fails to make API call + */ + public ApiResponse createLinkedTransactionWithHttpInfo(String xeroTenantId, LinkedTransactions linkedTransactions) throws ApiException { + Object localVarPostBody = linkedTransactions; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); + } + + // verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new ApiException(400, "Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); + } + + // create path and map variables + String localVarPath = "/LinkedTransactions"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create a manual journal + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournals (required) + * @return ManualJournals + * @throws ApiException if fails to make API call + */ + public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals) throws ApiException { + return createManualJournalWithHttpInfo(xeroTenantId, manualJournals).getData(); + } + + /** + * Allows you to create a manual journal + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournals (required) + * @return ApiResponse<ManualJournals> + * @throws ApiException if fails to make API call + */ + public ApiResponse createManualJournalWithHttpInfo(String xeroTenantId, ManualJournals manualJournals) throws ApiException { + Object localVarPostBody = manualJournals; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createManualJournal"); + } + + // verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new ApiException(400, "Missing the required parameter 'manualJournals' when calling createManualJournal"); + } + + // create path and map variables + String localVarPath = "/ManualJournals"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create a specified Attachment on ManualJournal by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @param fileName The name of the file being attached to a ManualJournal (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws ApiException { + return createManualJournalAttachmentByFileNameWithHttpInfo(xeroTenantId, manualJournalID, fileName, body).getData(); + } + + /** + * Allows you to create a specified Attachment on ManualJournal by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @param fileName The name of the file being attached to a ManualJournal (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse createManualJournalAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); + } + + // verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}" + .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Allocations for overpayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param overpaymentID Unique identifier for a Overpayment (required) + * @param allocations (required) + * @return Allocations + * @throws ApiException if fails to make API call + */ + public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws ApiException { + return createOverpaymentAllocationWithHttpInfo(xeroTenantId, overpaymentID, allocations).getData(); + } + + /** + * Allows you to retrieve Allocations for overpayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param overpaymentID Unique identifier for a Overpayment (required) + * @param allocations (required) + * @return ApiResponse<Allocations> + * @throws ApiException if fails to make API call + */ + public ApiResponse createOverpaymentAllocationWithHttpInfo(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws ApiException { + Object localVarPostBody = allocations; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); + } + + // verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new ApiException(400, "Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); + } + + // verify the required parameter 'allocations' is set + if (allocations == null) { + throw new ApiException(400, "Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); + } + + // create path and map variables + String localVarPath = "/Overpayments/{OverpaymentID}/Allocations" + .replaceAll("\\{" + "OverpaymentID" + "\\}", apiClient.escapeString(overpaymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create history records of an Overpayment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param overpaymentID Unique identifier for a Overpayment (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws ApiException { + return createOverpaymentHistoryWithHttpInfo(xeroTenantId, overpaymentID, historyRecords).getData(); + } + + /** + * Allows you to create history records of an Overpayment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param overpaymentID Unique identifier for a Overpayment (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createOverpaymentHistoryWithHttpInfo(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); + } + + // verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new ApiException(400, "Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); + } + + // create path and map variables + String localVarPath = "/Overpayments/{OverpaymentID}/History" + .replaceAll("\\{" + "OverpaymentID" + "\\}", apiClient.escapeString(overpaymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create payments for invoices and credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param payments (required) + * @return Payments + * @throws ApiException if fails to make API call + */ + public Payments createPayment(String xeroTenantId, Payments payments) throws ApiException { + return createPaymentWithHttpInfo(xeroTenantId, payments).getData(); + } + + /** + * Allows you to create payments for invoices and credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param payments (required) + * @return ApiResponse<Payments> + * @throws ApiException if fails to make API call + */ + public ApiResponse createPaymentWithHttpInfo(String xeroTenantId, Payments payments) throws ApiException { + Object localVarPostBody = payments; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPayment"); + } + + // verify the required parameter 'payments' is set + if (payments == null) { + throw new ApiException(400, "Missing the required parameter 'payments' when calling createPayment"); + } + + // create path and map variables + String localVarPath = "/Payments"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create a history record for a payment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param paymentID Unique identifier for a Payment (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws ApiException { + return createPaymentHistoryWithHttpInfo(xeroTenantId, paymentID, historyRecords).getData(); + } + + /** + * Allows you to create a history record for a payment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param paymentID Unique identifier for a Payment (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createPaymentHistoryWithHttpInfo(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); + } + + // verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new ApiException(400, "Missing the required parameter 'paymentID' when calling createPaymentHistory"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createPaymentHistory"); + } + + // create path and map variables + String localVarPath = "/Payments/{PaymentID}/History" + .replaceAll("\\{" + "PaymentID" + "\\}", apiClient.escapeString(paymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create payment services + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param paymentServices (required) + * @return PaymentServices + * @throws ApiException if fails to make API call + */ + public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices) throws ApiException { + return createPaymentServiceWithHttpInfo(xeroTenantId, paymentServices).getData(); + } + + /** + * Allows you to create payment services + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param paymentServices (required) + * @return ApiResponse<PaymentServices> + * @throws ApiException if fails to make API call + */ + public ApiResponse createPaymentServiceWithHttpInfo(String xeroTenantId, PaymentServices paymentServices) throws ApiException { + Object localVarPostBody = paymentServices; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPaymentService"); + } + + // verify the required parameter 'paymentServices' is set + if (paymentServices == null) { + throw new ApiException(400, "Missing the required parameter 'paymentServices' when calling createPaymentService"); + } + + // create path and map variables + String localVarPath = "/PaymentServices"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create an Allocation for prepayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param prepaymentID (required) + * @param allocations (required) + * @return Allocations + * @throws ApiException if fails to make API call + */ + public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws ApiException { + return createPrepaymentAllocationWithHttpInfo(xeroTenantId, prepaymentID, allocations).getData(); + } + + /** + * Allows you to create an Allocation for prepayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param prepaymentID (required) + * @param allocations (required) + * @return ApiResponse<Allocations> + * @throws ApiException if fails to make API call + */ + public ApiResponse createPrepaymentAllocationWithHttpInfo(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws ApiException { + Object localVarPostBody = allocations; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); + } + + // verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new ApiException(400, "Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); + } + + // verify the required parameter 'allocations' is set + if (allocations == null) { + throw new ApiException(400, "Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); + } + + // create path and map variables + String localVarPath = "/Prepayments/{PrepaymentID}/Allocations" + .replaceAll("\\{" + "PrepaymentID" + "\\}", apiClient.escapeString(prepaymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create a history record for an Prepayment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param prepaymentID Unique identifier for a PrePayment (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws ApiException { + return createPrepaymentHistoryWithHttpInfo(xeroTenantId, prepaymentID, historyRecords).getData(); + } + + /** + * Allows you to create a history record for an Prepayment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param prepaymentID Unique identifier for a PrePayment (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createPrepaymentHistoryWithHttpInfo(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); + } + + // verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new ApiException(400, "Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); + } + + // create path and map variables + String localVarPath = "/Prepayments/{PrepaymentID}/History" + .replaceAll("\\{" + "PrepaymentID" + "\\}", apiClient.escapeString(prepaymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create purchase orders + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param purchaseOrders (required) + * @param summarizeErrors shows validation errors for each purchase order. (optional) + * @return PurchaseOrders + * @throws ApiException if fails to make API call + */ + public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws ApiException { + return createPurchaseOrderWithHttpInfo(xeroTenantId, purchaseOrders, summarizeErrors).getData(); + } + + /** + * Allows you to create purchase orders + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param purchaseOrders (required) + * @param summarizeErrors shows validation errors for each purchase order. (optional) + * @return ApiResponse<PurchaseOrders> + * @throws ApiException if fails to make API call + */ + public ApiResponse createPurchaseOrderWithHttpInfo(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws ApiException { + Object localVarPostBody = purchaseOrders; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); + } + + // verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new ApiException(400, "Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); + } + + // create path and map variables + String localVarPath = "/PurchaseOrders"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "SummarizeErrors", summarizeErrors)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create HistoryRecord for purchase orders + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws ApiException { + return createPurchaseOrderHistoryWithHttpInfo(xeroTenantId, purchaseOrderID, historyRecords).getData(); + } + + /** + * Allows you to create HistoryRecord for purchase orders + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createPurchaseOrderHistoryWithHttpInfo(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); + } + + // verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new ApiException(400, "Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); + } + + // create path and map variables + String localVarPath = "/PurchaseOrders/{PurchaseOrderID}/History" + .replaceAll("\\{" + "PurchaseOrderID" + "\\}", apiClient.escapeString(purchaseOrderID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create draft expense claim receipts for any user + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receipts (required) + * @return Receipts + * @throws ApiException if fails to make API call + */ + public Receipts createReceipt(String xeroTenantId, Receipts receipts) throws ApiException { + return createReceiptWithHttpInfo(xeroTenantId, receipts).getData(); + } + + /** + * Allows you to create draft expense claim receipts for any user + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receipts (required) + * @return ApiResponse<Receipts> + * @throws ApiException if fails to make API call + */ + public ApiResponse createReceiptWithHttpInfo(String xeroTenantId, Receipts receipts) throws ApiException { + Object localVarPostBody = receipts; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createReceipt"); + } + + // verify the required parameter 'receipts' is set + if (receipts == null) { + throw new ApiException(400, "Missing the required parameter 'receipts' when calling createReceipt"); + } + + // create path and map variables + String localVarPath = "/Receipts"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create Attachment on expense claim receipts by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param fileName The name of the file being attached to the Receipt (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws ApiException { + return createReceiptAttachmentByFileNameWithHttpInfo(xeroTenantId, receiptID, fileName, body).getData(); + } + + /** + * Allows you to create Attachment on expense claim receipts by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param fileName The name of the file being attached to the Receipt (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse createReceiptAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); + } + + // verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new ApiException(400, "Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Receipts/{ReceiptID}/Attachments/{FileName}" + .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a history records of an Receipt + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws ApiException { + return createReceiptHistoryWithHttpInfo(xeroTenantId, receiptID, historyRecords).getData(); + } + + /** + * Allows you to retrieve a history records of an Receipt + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createReceiptHistoryWithHttpInfo(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); + } + + // verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new ApiException(400, "Missing the required parameter 'receiptID' when calling createReceiptHistory"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createReceiptHistory"); + } + + // create path and map variables + String localVarPath = "/Receipts/{ReceiptID}/History" + .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create attachment on repeating invoices by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @param fileName The name of the file being attached to a Repeating Invoice (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws ApiException { + return createRepeatingInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, repeatingInvoiceID, fileName, body).getData(); + } + /** + * Allows you to create attachment on repeating invoices by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @param fileName The name of the file being attached to a Repeating Invoice (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse createRepeatingInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}" + .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create history for a repeating invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @param historyRecords (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws ApiException { + return createRepeatingInvoiceHistoryWithHttpInfo(xeroTenantId, repeatingInvoiceID, historyRecords).getData(); + } + + /** + * Allows you to create history for a repeating invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @param historyRecords (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse createRepeatingInvoiceHistoryWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws ApiException { + Object localVarPostBody = historyRecords; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); + } + + // verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); + } + + // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); + } + + // create path and map variables + String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History" + .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create Tax Rates + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param taxRates (required) + * @return TaxRates + * @throws ApiException if fails to make API call + */ + public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates) throws ApiException { + return createTaxRateWithHttpInfo(xeroTenantId, taxRates).getData(); + } + + /** + * Allows you to create Tax Rates + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param taxRates (required) + * @return ApiResponse<TaxRates> + * @throws ApiException if fails to make API call + */ + public ApiResponse createTaxRateWithHttpInfo(String xeroTenantId, TaxRates taxRates) throws ApiException { + Object localVarPostBody = taxRates; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createTaxRate"); + } + + // verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new ApiException(400, "Missing the required parameter 'taxRates' when calling createTaxRate"); + } + + // create path and map variables + String localVarPath = "/TaxRates"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create tracking categories + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategory (required) + * @return TrackingCategories + * @throws ApiException if fails to make API call + */ + public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory) throws ApiException { + return createTrackingCategoryWithHttpInfo(xeroTenantId, trackingCategory).getData(); + } + + /** + * Allows you to create tracking categories + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategory (required) + * @return ApiResponse<TrackingCategories> + * @throws ApiException if fails to make API call + */ + public ApiResponse createTrackingCategoryWithHttpInfo(String xeroTenantId, TrackingCategory trackingCategory) throws ApiException { + Object localVarPostBody = trackingCategory; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); + } + + // verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new ApiException(400, "Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); + } + + // create path and map variables + String localVarPath = "/TrackingCategories"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to create options for a specified tracking category + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategoryID Unique identifier for a TrackingCategory (required) + * @param trackingOption (required) + * @return TrackingOptions + * @throws ApiException if fails to make API call + */ + public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws ApiException { + return createTrackingOptionsWithHttpInfo(xeroTenantId, trackingCategoryID, trackingOption).getData(); + } + + /** + * Allows you to create options for a specified tracking category + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategoryID Unique identifier for a TrackingCategory (required) + * @param trackingOption (required) + * @return ApiResponse<TrackingOptions> + * @throws ApiException if fails to make API call + */ + public ApiResponse createTrackingOptionsWithHttpInfo(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws ApiException { + Object localVarPostBody = trackingOption; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); + } + + // verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new ApiException(400, "Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); + } + + // verify the required parameter 'trackingOption' is set + if (trackingOption == null) { + throw new ApiException(400, "Missing the required parameter 'trackingOption' when calling createTrackingOptions"); + } + + // create path and map variables + String localVarPath = "/TrackingCategories/{TrackingCategoryID}/Options" + .replaceAll("\\{" + "TrackingCategoryID" + "\\}", apiClient.escapeString(trackingCategoryID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to delete a chart of accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for retrieving single object (required) + * @return Accounts + * @throws ApiException if fails to make API call + */ + public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws ApiException { + return deleteAccountWithHttpInfo(xeroTenantId, accountID).getData(); + } + /** + * Allows you to delete a chart of accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for retrieving single object (required) + * @return ApiResponse<Accounts> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteAccountWithHttpInfo(String xeroTenantId, UUID accountID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteAccount"); + } + + // verify the required parameter 'accountID' is set + if (accountID == null) { + throw new ApiException(400, "Missing the required parameter 'accountID' when calling deleteAccount"); + } + + // create path and map variables + String localVarPath = "/Accounts/{AccountID}" + .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to delete a specific Contact from a Contract Group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroupID Unique identifier for a Contact Group (required) + * @param contactID Unique identifier for a Contact (required) + * @throws ApiException if fails to make API call + */ + public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID) throws ApiException { + + deleteContactGroupContactWithHttpInfo(xeroTenantId, contactGroupID, contactID); + } + + /** + * Allows you to delete a specific Contact from a Contract Group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroupID Unique identifier for a Contact Group (required) + * @param contactID Unique identifier for a Contact (required) + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteContactGroupContactWithHttpInfo(String xeroTenantId, UUID contactGroupID, UUID contactID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); + } + + // verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new ApiException(400, "Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); + } + + // verify the required parameter 'contactID' is set + if (contactID == null) { + throw new ApiException(400, "Missing the required parameter 'contactID' when calling deleteContactGroupContact"); + } + + // create path and map variables + String localVarPath = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}" + .replaceAll("\\{" + "ContactGroupID" + "\\}", apiClient.escapeString(contactGroupID.toString())) + .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Allows you to delete all Contacts from a Contract Group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroupID Unique identifier for a Contact Group (required) + * @throws ApiException if fails to make API call + */ + public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID) throws ApiException { + + deleteContactGroupContactsWithHttpInfo(xeroTenantId, contactGroupID); + } + + /** + * Allows you to delete all Contacts from a Contract Group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroupID Unique identifier for a Contact Group (required) + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteContactGroupContactsWithHttpInfo(String xeroTenantId, UUID contactGroupID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); + } + + // verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new ApiException(400, "Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); + } + + // create path and map variables + String localVarPath = "/ContactGroups/{ContactGroupID}/Contacts" + .replaceAll("\\{" + "ContactGroupID" + "\\}", apiClient.escapeString(contactGroupID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Allows you to delete a specified item + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param itemID Unique identifier for an Item (required) + * @throws ApiException if fails to make API call + */ + public void deleteItem(String xeroTenantId, UUID itemID) throws ApiException { + + deleteItemWithHttpInfo(xeroTenantId, itemID); + } + + /** + * Allows you to delete a specified item + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param itemID Unique identifier for an Item (required) + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteItemWithHttpInfo(String xeroTenantId, UUID itemID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteItem"); + } + + // verify the required parameter 'itemID' is set + if (itemID == null) { + throw new ApiException(400, "Missing the required parameter 'itemID' when calling deleteItem"); + } + + // create path and map variables + String localVarPath = "/Items/{ItemID}" + .replaceAll("\\{" + "ItemID" + "\\}", apiClient.escapeString(itemID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Allows you to delete a specified linked transactions (billable expenses) + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) + * @throws ApiException if fails to make API call + */ + public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws ApiException { + + deleteLinkedTransactionWithHttpInfo(xeroTenantId, linkedTransactionID); + } + + /** + * Allows you to delete a specified linked transactions (billable expenses) + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteLinkedTransactionWithHttpInfo(String xeroTenantId, UUID linkedTransactionID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); + } + + // verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); + } + + // create path and map variables + String localVarPath = "/LinkedTransactions/{LinkedTransactionID}" + .replaceAll("\\{" + "LinkedTransactionID" + "\\}", apiClient.escapeString(linkedTransactionID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Allows you to update a specified payment for invoices and credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param paymentID Unique identifier for a Payment (required) + * @param payments (required) + * @return Payments + * @throws ApiException if fails to make API call + */ + public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments) throws ApiException { + return deletePaymentWithHttpInfo(xeroTenantId, paymentID, payments).getData(); + } + + /** + * Allows you to update a specified payment for invoices and credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param paymentID Unique identifier for a Payment (required) + * @param payments (required) + * @return ApiResponse<Payments> + * @throws ApiException if fails to make API call + */ + public ApiResponse deletePaymentWithHttpInfo(String xeroTenantId, UUID paymentID, Payments payments) throws ApiException { + Object localVarPostBody = payments; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deletePayment"); + } + + // verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new ApiException(400, "Missing the required parameter 'paymentID' when calling deletePayment"); + } + + // verify the required parameter 'payments' is set + if (payments == null) { + throw new ApiException(400, "Missing the required parameter 'payments' when calling deletePayment"); + } + + // create path and map variables + String localVarPath = "/Payments/{PaymentID}" + .replaceAll("\\{" + "PaymentID" + "\\}", apiClient.escapeString(paymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to delete tracking categories + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategoryID Unique identifier for a TrackingCategory (required) + * @return TrackingCategories + * @throws ApiException if fails to make API call + */ + public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws ApiException { + return deleteTrackingCategoryWithHttpInfo(xeroTenantId, trackingCategoryID).getData(); + } + + /** + * Allows you to delete tracking categories + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategoryID Unique identifier for a TrackingCategory (required) + * @return ApiResponse<TrackingCategories> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteTrackingCategoryWithHttpInfo(String xeroTenantId, UUID trackingCategoryID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); + } + + // verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new ApiException(400, "Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); + } + + // create path and map variables + String localVarPath = "/TrackingCategories/{TrackingCategoryID}" + .replaceAll("\\{" + "TrackingCategoryID" + "\\}", apiClient.escapeString(trackingCategoryID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to delete a specified option for a specified tracking category + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategoryID Unique identifier for a TrackingCategory (required) + * @param trackingOptionID Unique identifier for a Tracking Option (required) + * @return TrackingOptions + * @throws ApiException if fails to make API call + */ + public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws ApiException { + return deleteTrackingOptionsWithHttpInfo(xeroTenantId, trackingCategoryID, trackingOptionID).getData(); + } + + /** + * Allows you to delete a specified option for a specified tracking category + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategoryID Unique identifier for a TrackingCategory (required) + * @param trackingOptionID Unique identifier for a Tracking Option (required) + * @return ApiResponse<TrackingOptions> + * @throws ApiException if fails to make API call + */ + public ApiResponse deleteTrackingOptionsWithHttpInfo(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); + } + + // verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new ApiException(400, "Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); + } + + // verify the required parameter 'trackingOptionID' is set + if (trackingOptionID == null) { + throw new ApiException(400, "Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); + } + + // create path and map variables + String localVarPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}" + .replaceAll("\\{" + "TrackingCategoryID" + "\\}", apiClient.escapeString(trackingCategoryID.toString())) + .replaceAll("\\{" + "TrackingOptionID" + "\\}", apiClient.escapeString(trackingOptionID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to email a copy of invoice to related Contact + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param requestEmpty (required) + * @throws ApiException if fails to make API call + */ + public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws ApiException { + + emailInvoiceWithHttpInfo(xeroTenantId, invoiceID, requestEmpty); + } + + /** + * Allows you to email a copy of invoice to related Contact + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param requestEmpty (required) + * @throws ApiException if fails to make API call + */ + public ApiResponse emailInvoiceWithHttpInfo(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws ApiException { + Object localVarPostBody = requestEmpty; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling emailInvoice"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling emailInvoice"); + } + + // verify the required parameter 'requestEmpty' is set + if (requestEmpty == null) { + throw new ApiException(400, "Missing the required parameter 'requestEmpty' when calling emailInvoice"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}/Email" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** + * Allows you to retrieve a single chart of accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for retrieving single object (required) + * @return Accounts + * @throws ApiException if fails to make API call + */ + public Accounts getAccount(String xeroTenantId, UUID accountID) throws ApiException { + return getAccountWithHttpInfo(xeroTenantId, accountID).getData(); + } + + /** + * Allows you to retrieve a single chart of accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for retrieving single object (required) + * @return ApiResponse<Accounts> + * @throws ApiException if fails to make API call + */ + public ApiResponse getAccountWithHttpInfo(String xeroTenantId, UUID accountID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getAccount"); + } + + // verify the required parameter 'accountID' is set + if (accountID == null) { + throw new ApiException(400, "Missing the required parameter 'accountID' when calling getAccount"); + } + + // create path and map variables + String localVarPath = "/Accounts/{AccountID}" + .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachment on Account by Filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for Account object (required) + * @param fileName Name of the attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType) throws ApiException { + return getAccountAttachmentByFileNameWithHttpInfo(xeroTenantId, accountID, fileName, contentType).getData(); + } + + /** + * Allows you to retrieve Attachment on Account by Filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for Account object (required) + * @param fileName Name of the attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getAccountAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID accountID, String fileName, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); + } + + // verify the required parameter 'accountID' is set + if (accountID == null) { + throw new ApiException(400, "Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling getAccountAttachmentByFileName"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Accounts/{AccountID}/Attachments/{FileName}" + .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve specific Attachment on Account + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for Account object (required) + * @param attachmentID Unique identifier for Attachment object (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws ApiException { + return getAccountAttachmentByIdWithHttpInfo(xeroTenantId, accountID, attachmentID, contentType).getData(); + } + + /** + * Allows you to retrieve specific Attachment on Account + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for Account object (required) + * @param attachmentID Unique identifier for Attachment object (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getAccountAttachmentByIdWithHttpInfo(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); + } + + // verify the required parameter 'accountID' is set + if (accountID == null) { + throw new ApiException(400, "Missing the required parameter 'accountID' when calling getAccountAttachmentById"); + } + + // verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getAccountAttachmentById"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getAccountAttachmentById"); + } + + // create path and map variables + String localVarPath = "/Accounts/{AccountID}/Attachments/{AttachmentID}" + .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())) + .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments for accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for Account object (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) throws ApiException { + return getAccountAttachmentsWithHttpInfo(xeroTenantId, accountID).getData(); + } + + /** + * Allows you to retrieve Attachments for accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for Account object (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getAccountAttachmentsWithHttpInfo(String xeroTenantId, UUID accountID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); + } + + // verify the required parameter 'accountID' is set + if (accountID == null) { + throw new ApiException(400, "Missing the required parameter 'accountID' when calling getAccountAttachments"); + } + + // create path and map variables + String localVarPath = "/Accounts/{AccountID}/Attachments" + .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve the full chart of accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return Accounts + * @throws ApiException if fails to make API call + */ + public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + return getAccountsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); + } + + /** + * Allows you to retrieve the full chart of accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ApiResponse<Accounts> + * @throws ApiException if fails to make API call + */ + public ApiResponse getAccountsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getAccounts"); + } + + // create path and map variables + String localVarPath = "/Accounts"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "OAuth2" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a single spend or receive money transaction + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @return BankTransactions + * @throws ApiException if fails to make API call + */ + public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID) throws ApiException { + return getBankTransactionWithHttpInfo(xeroTenantId, bankTransactionID).getData(); + } + + /** + * Allows you to retrieve a single spend or receive money transaction + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @return ApiResponse<BankTransactions> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransactionWithHttpInfo(String xeroTenantId, UUID bankTransactionID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); + } + + // verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); + } + + // create path and map variables + String localVarPath = "/BankTransactions/{BankTransactionID}" + .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on BankTransaction by Filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param fileName The name of the file being attached (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws ApiException { + return getBankTransactionAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransactionID, fileName, contentType).getData(); + } + + /** + * Allows you to retrieve Attachments on BankTransaction by Filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param fileName The name of the file being attached (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransactionAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); + } + + // verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling getBankTransactionAttachmentByFileName"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}" + .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on a specific BankTransaction + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param attachmentID Xero generated unique identifier for an attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws ApiException { + return getBankTransactionAttachmentByIdWithHttpInfo(xeroTenantId, bankTransactionID, attachmentID, contentType).getData(); + } + + /** + * Allows you to retrieve Attachments on a specific BankTransaction + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param attachmentID Xero generated unique identifier for an attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransactionAttachmentByIdWithHttpInfo(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); + } + + // verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); + } + + // verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getBankTransactionAttachmentById"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); + } + + // create path and map variables + String localVarPath = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}" + .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())) + .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve any attachments to bank transactions + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID) throws ApiException { + return getBankTransactionAttachmentsWithHttpInfo(xeroTenantId, bankTransactionID).getData(); + } + + /** + * Allows you to retrieve any attachments to bank transactions + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransactionAttachmentsWithHttpInfo(String xeroTenantId, UUID bankTransactionID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); + } + + // verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); + } + + // create path and map variables + String localVarPath = "/BankTransactions/{BankTransactionID}/Attachments" + .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve any spend or receive money transactions + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param page e.g. page=1 – Up to 100 bank transactions will be returned in a single API call with line items shown for each bank transaction (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return BankTransactions + * @throws ApiException if fails to make API call + */ + public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { + return getBankTransactionsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, page, unitdp).getData(); + } + + /** + * Allows you to retrieve any spend or receive money transactions + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param page e.g. page=1 – Up to 100 bank transactions will be returned in a single API call with line items shown for each bank transaction (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return ApiResponse<BankTransactions> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransactionsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); + } + + // create path and map variables + String localVarPath = "/BankTransactions"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve history from a bank transactions + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID) throws ApiException { + return getBankTransactionsHistoryWithHttpInfo(xeroTenantId, bankTransactionID).getData(); + } + + /** + * Allows you to retrieve history from a bank transactions + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransactionsHistoryWithHttpInfo(String xeroTenantId, UUID bankTransactionID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); + } + + // verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); + } + + // create path and map variables + String localVarPath = "/BankTransactions/{BankTransactionID}/History" + .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve any bank transfers + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @return BankTransfers + * @throws ApiException if fails to make API call + */ + public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) throws ApiException { + return getBankTransferWithHttpInfo(xeroTenantId, bankTransferID).getData(); + } + + /** + * Allows you to retrieve any bank transfers + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @return ApiResponse<BankTransfers> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransferWithHttpInfo(String xeroTenantId, UUID bankTransferID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); + } + + // verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling getBankTransfer"); + } + + // create path and map variables + String localVarPath = "/BankTransfers/{BankTransferID}" + .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on BankTransfer by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @param fileName The name of the file being attached to a Bank Transfer (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws ApiException { + return getBankTransferAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransferID, fileName, contentType).getData(); + } + + /** + * Allows you to retrieve Attachments on BankTransfer by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @param fileName The name of the file being attached to a Bank Transfer (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransferAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); + } + + // verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling getBankTransferAttachmentByFileName"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}" + .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on BankTransfer + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws ApiException { + return getBankTransferAttachmentByIdWithHttpInfo(xeroTenantId, bankTransferID, attachmentID, contentType).getData(); + } + + /** + * Allows you to retrieve Attachments on BankTransfer + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransferAttachmentByIdWithHttpInfo(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); + } + + // verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); + } + + // verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getBankTransferAttachmentById"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); + } + + // create path and map variables + String localVarPath = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}" + .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())) + .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments from bank transfers + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID) throws ApiException { + return getBankTransferAttachmentsWithHttpInfo(xeroTenantId, bankTransferID).getData(); + } + + /** + * Allows you to retrieve Attachments from bank transfers + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransferAttachmentsWithHttpInfo(String xeroTenantId, UUID bankTransferID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); + } + + // verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); + } + + // create path and map variables + String localVarPath = "/BankTransfers/{BankTransferID}/Attachments" + .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve history from a bank transfers + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID) throws ApiException { + return getBankTransferHistoryWithHttpInfo(xeroTenantId, bankTransferID).getData(); + } + + /** + * Allows you to retrieve history from a bank transfers + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransferHistoryWithHttpInfo(String xeroTenantId, UUID bankTransferID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); + } + + // verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); + } + + // create path and map variables + String localVarPath = "/BankTransfers/{BankTransferID}/History" + .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve all bank transfers + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return BankTransfers + * @throws ApiException if fails to make API call + */ + public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + return getBankTransfersWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); + } + + /** + * Allows you to retrieve all bank transfers + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ApiResponse<BankTransfers> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBankTransfersWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); + } + + // create path and map variables + String localVarPath = "/BankTransfers"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve history from a Batch Payment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param batchPaymentID Unique identifier for BatchPayment (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID) throws ApiException { + return getBatchPaymentHistoryWithHttpInfo(xeroTenantId, batchPaymentID).getData(); + } + + /** + * Allows you to retrieve history from a Batch Payment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param batchPaymentID Unique identifier for BatchPayment (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBatchPaymentHistoryWithHttpInfo(String xeroTenantId, UUID batchPaymentID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); + } + + // verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new ApiException(400, "Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); + } + + // create path and map variables + String localVarPath = "/BatchPayments/{BatchPaymentID}/History" + .replaceAll("\\{" + "BatchPaymentID" + "\\}", apiClient.escapeString(batchPaymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Retrieve either one or many BatchPayments for invoices + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return BatchPayments + * @throws ApiException if fails to make API call + */ + public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + return getBatchPaymentsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); + } + + /** + * Retrieve either one or many BatchPayments for invoices + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ApiResponse<BatchPayments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBatchPaymentsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); + } + + // create path and map variables + String localVarPath = "/BatchPayments"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specific BrandingThemes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param brandingThemeID Unique identifier for a Branding Theme (required) + * @return BrandingThemes + * @throws ApiException if fails to make API call + */ + public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID) throws ApiException { + return getBrandingThemeWithHttpInfo(xeroTenantId, brandingThemeID).getData(); + } + + /** + * Allows you to retrieve a specific BrandingThemes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param brandingThemeID Unique identifier for a Branding Theme (required) + * @return ApiResponse<BrandingThemes> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBrandingThemeWithHttpInfo(String xeroTenantId, UUID brandingThemeID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); + } + + // verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new ApiException(400, "Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); + } + + // create path and map variables + String localVarPath = "/BrandingThemes/{BrandingThemeID}" + .replaceAll("\\{" + "BrandingThemeID" + "\\}", apiClient.escapeString(brandingThemeID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve the Payment services for a Branding Theme + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param brandingThemeID Unique identifier for a Branding Theme (required) + * @return PaymentServices + * @throws ApiException if fails to make API call + */ + public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID) throws ApiException { + return getBrandingThemePaymentServicesWithHttpInfo(xeroTenantId, brandingThemeID).getData(); + } + + /** + * Allows you to retrieve the Payment services for a Branding Theme + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param brandingThemeID Unique identifier for a Branding Theme (required) + * @return ApiResponse<PaymentServices> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBrandingThemePaymentServicesWithHttpInfo(String xeroTenantId, UUID brandingThemeID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); + } + + // verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new ApiException(400, "Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); + } + + // create path and map variables + String localVarPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices" + .replaceAll("\\{" + "BrandingThemeID" + "\\}", apiClient.escapeString(brandingThemeID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve all the BrandingThemes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @return BrandingThemes + * @throws ApiException if fails to make API call + */ + public BrandingThemes getBrandingThemes(String xeroTenantId) throws ApiException { + return getBrandingThemesWithHttpInfo(xeroTenantId).getData(); + } + + /** + * Allows you to retrieve all the BrandingThemes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @return ApiResponse<BrandingThemes> + * @throws ApiException if fails to make API call + */ + public ApiResponse getBrandingThemesWithHttpInfo(String xeroTenantId) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); + } + + // create path and map variables + String localVarPath = "/BrandingThemes"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @return Contacts + * @throws ApiException if fails to make API call + */ + public Contacts getContact(String xeroTenantId, UUID contactID) throws ApiException { + return getContactWithHttpInfo(xeroTenantId, contactID).getData(); + } + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @return ApiResponse<Contacts> + * @throws ApiException if fails to make API call + */ + public ApiResponse getContactWithHttpInfo(String xeroTenantId, UUID contactID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContact"); + } + + // verify the required parameter 'contactID' is set + if (contactID == null) { + throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContact"); + } + + // create path and map variables + String localVarPath = "/Contacts/{ContactID}" + .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on Contacts by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param fileName Name for the file you are attaching (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType) throws ApiException { + return getContactAttachmentByFileNameWithHttpInfo(xeroTenantId, contactID, fileName, contentType).getData(); + } + + /** + * Allows you to retrieve Attachments on Contacts by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param fileName Name for the file you are attaching (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getContactAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID contactID, String fileName, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); + } + + // verify the required parameter 'contactID' is set + if (contactID == null) { + throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling getContactAttachmentByFileName"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Contacts/{ContactID}/Attachments/{FileName}" + .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on Contacts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param attachmentID Unique identifier for a Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws ApiException { + return getContactAttachmentByIdWithHttpInfo(xeroTenantId, contactID, attachmentID, contentType).getData(); + } + + /** + * Allows you to retrieve Attachments on Contacts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param attachmentID Unique identifier for a Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getContactAttachmentByIdWithHttpInfo(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); + } + + // verify the required parameter 'contactID' is set + if (contactID == null) { + throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContactAttachmentById"); + } + + // verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getContactAttachmentById"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getContactAttachmentById"); + } + + // create path and map variables + String localVarPath = "/Contacts/{ContactID}/Attachments/{AttachmentID}" + .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())) + .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments getContactAttachments(String xeroTenantId, UUID contactID) throws ApiException { + return getContactAttachmentsWithHttpInfo(xeroTenantId, contactID).getData(); + } + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getContactAttachmentsWithHttpInfo(String xeroTenantId, UUID contactID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); + } + + // verify the required parameter 'contactID' is set + if (contactID == null) { + throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContactAttachments"); + } + + // create path and map variables + String localVarPath = "/Contacts/{ContactID}/Attachments" + .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve CISSettings for a contact in a Xero organisation + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @return CISSettings + * @throws ApiException if fails to make API call + */ + public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) throws ApiException { + return getContactCISSettingsWithHttpInfo(xeroTenantId, contactID).getData(); + } + + /** + * Allows you to retrieve CISSettings for a contact in a Xero organisation + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @return ApiResponse<CISSettings> + * @throws ApiException if fails to make API call + */ + public ApiResponse getContactCISSettingsWithHttpInfo(String xeroTenantId, UUID contactID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); + } + + // verify the required parameter 'contactID' is set + if (contactID == null) { + throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContactCISSettings"); + } + + // create path and map variables + String localVarPath = "/Contacts/{ContactID}/CISSettings" + .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a unique Contract Group by ID + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroupID Unique identifier for a Contact Group (required) + * @return ContactGroups + * @throws ApiException if fails to make API call + */ + public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) throws ApiException { + return getContactGroupWithHttpInfo(xeroTenantId, contactGroupID).getData(); + } + + /** + * Allows you to retrieve a unique Contract Group by ID + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroupID Unique identifier for a Contact Group (required) + * @return ApiResponse<ContactGroups> + * @throws ApiException if fails to make API call + */ + public ApiResponse getContactGroupWithHttpInfo(String xeroTenantId, UUID contactGroupID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactGroup"); + } + + // verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new ApiException(400, "Missing the required parameter 'contactGroupID' when calling getContactGroup"); + } + + // create path and map variables + String localVarPath = "/ContactGroups/{ContactGroupID}" + .replaceAll("\\{" + "ContactGroupID" + "\\}", apiClient.escapeString(contactGroupID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve the ContactID and Name of all the contacts in a contact group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ContactGroups + * @throws ApiException if fails to make API call + */ + public ContactGroups getContactGroups(String xeroTenantId, String where, String order) throws ApiException { + return getContactGroupsWithHttpInfo(xeroTenantId, where, order).getData(); + } + + /** + * Allows you to retrieve the ContactID and Name of all the contacts in a contact group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ApiResponse<ContactGroups> + * @throws ApiException if fails to make API call + */ + public ApiResponse getContactGroupsWithHttpInfo(String xeroTenantId, String where, String order) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactGroups"); + } + + // create path and map variables + String localVarPath = "/ContactGroups"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a history records of an Contact + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID) throws ApiException { + return getContactHistoryWithHttpInfo(xeroTenantId, contactID).getData(); + } + + /** + * Allows you to retrieve a history records of an Contact + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getContactHistoryWithHttpInfo(String xeroTenantId, UUID contactID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactHistory"); + } + + // verify the required parameter 'contactID' is set + if (contactID == null) { + throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContactHistory"); + } + + // create path and map variables + String localVarPath = "/Contacts/{ContactID}/History" + .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional) + * @param page e.g. page=1 - Up to 100 contacts will be returned in a single API call. (optional) + * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional) + * @return Contacts + * @throws ApiException if fails to make API call + */ + public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws ApiException { + return getContactsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, ids, page, includeArchived).getData(); + } + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional) + * @param page e.g. page=1 - Up to 100 contacts will be returned in a single API call. (optional) + * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional) + * @return ApiResponse<Contacts> + * @throws ApiException if fails to make API call + */ + public ApiResponse getContactsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContacts"); + } + + // create path and map variables + String localVarPath = "/Contacts"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "IDs", ids)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "includeArchived", includeArchived)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specific credit note + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @return CreditNotes + * @throws ApiException if fails to make API call + */ + public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID) throws ApiException { + return getCreditNoteWithHttpInfo(xeroTenantId, creditNoteID).getData(); + } + + /** + * Allows you to retrieve a specific credit note + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @return ApiResponse<CreditNotes> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCreditNoteWithHttpInfo(String xeroTenantId, UUID creditNoteID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNote"); + } + + // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNote"); + } + + // create path and map variables + String localVarPath = "/CreditNotes/{CreditNoteID}" + .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Credit Note as PDF files + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType) throws ApiException { + return getCreditNoteAsPdfWithHttpInfo(xeroTenantId, creditNoteID, contentType).getData(); + } + + /** + * Allows you to retrieve Credit Note as PDF files + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCreditNoteAsPdfWithHttpInfo(String xeroTenantId, UUID creditNoteID, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); + } + + // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); + } + + // create path and map variables + String localVarPath = "/CreditNotes/{CreditNoteID}/pdf" + .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on CreditNote by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param fileName Name of the file you are attaching to Credit Note (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws ApiException { + return getCreditNoteAttachmentByFileNameWithHttpInfo(xeroTenantId, creditNoteID, fileName, contentType).getData(); + } + + /** + * Allows you to retrieve Attachments on CreditNote by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param fileName Name of the file you are attaching to Credit Note (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCreditNoteAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); + } + + // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling getCreditNoteAttachmentByFileName"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}" + .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on CreditNote + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param attachmentID Unique identifier for a Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws ApiException { + return getCreditNoteAttachmentByIdWithHttpInfo(xeroTenantId, creditNoteID, attachmentID, contentType).getData(); + } + + /** + * Allows you to retrieve Attachments on CreditNote + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param attachmentID Unique identifier for a Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCreditNoteAttachmentByIdWithHttpInfo(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); + } + + // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); + } + + // verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getCreditNoteAttachmentById"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); + } + + // create path and map variables + String localVarPath = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}" + .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())) + .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments for credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID) throws ApiException { + return getCreditNoteAttachmentsWithHttpInfo(xeroTenantId, creditNoteID).getData(); + } + + /** + * Allows you to retrieve Attachments for credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCreditNoteAttachmentsWithHttpInfo(String xeroTenantId, UUID creditNoteID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); + } + + // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); + } + + // create path and map variables + String localVarPath = "/CreditNotes/{CreditNoteID}/Attachments" + .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a history records of an CreditNote + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID) throws ApiException { + return getCreditNoteHistoryWithHttpInfo(xeroTenantId, creditNoteID).getData(); + } + + /** + * Allows you to retrieve a history records of an CreditNote + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCreditNoteHistoryWithHttpInfo(String xeroTenantId, UUID creditNoteID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); + } + + // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); + } + + // create path and map variables + String localVarPath = "/CreditNotes/{CreditNoteID}/History" + .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve any credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param page e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional) + * @return CreditNotes + * @throws ApiException if fails to make API call + */ + public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws ApiException { + return getCreditNotesWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, page).getData(); + } + + /** + * Allows you to retrieve any credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param page e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional) + * @return ApiResponse<CreditNotes> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCreditNotesWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); + } + + // create path and map variables + String localVarPath = "/CreditNotes"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve currencies for your organisation + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return Currencies + * @throws ApiException if fails to make API call + */ + public Currencies getCurrencies(String xeroTenantId, String where, String order) throws ApiException { + return getCurrenciesWithHttpInfo(xeroTenantId, where, order).getData(); + } + + /** + * Allows you to retrieve currencies for your organisation + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ApiResponse<Currencies> + * @throws ApiException if fails to make API call + */ + public ApiResponse getCurrenciesWithHttpInfo(String xeroTenantId, String where, String order) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCurrencies"); + } + + // create path and map variables + String localVarPath = "/Currencies"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specific employee used in Xero payrun + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param employeeID Unique identifier for a Employee (required) + * @return Employees + * @throws ApiException if fails to make API call + */ + public Employees getEmployee(String xeroTenantId, UUID employeeID) throws ApiException { + return getEmployeeWithHttpInfo(xeroTenantId, employeeID).getData(); + } + + /** + * Allows you to retrieve a specific employee used in Xero payrun + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param employeeID Unique identifier for a Employee (required) + * @return ApiResponse<Employees> + * @throws ApiException if fails to make API call + */ + public ApiResponse getEmployeeWithHttpInfo(String xeroTenantId, UUID employeeID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getEmployee"); + } + + // verify the required parameter 'employeeID' is set + if (employeeID == null) { + throw new ApiException(400, "Missing the required parameter 'employeeID' when calling getEmployee"); + } + + // create path and map variables + String localVarPath = "/Employees/{EmployeeID}" + .replaceAll("\\{" + "EmployeeID" + "\\}", apiClient.escapeString(employeeID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve employees used in Xero payrun + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return Employees + * @throws ApiException if fails to make API call + */ + public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + return getEmployeesWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); + } + + /** + * Allows you to retrieve employees used in Xero payrun + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ApiResponse<Employees> + * @throws ApiException if fails to make API call + */ + public ApiResponse getEmployeesWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getEmployees"); + } + + // create path and map variables + String localVarPath = "/Employees"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified expense claim + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param expenseClaimID Unique identifier for a ExpenseClaim (required) + * @return ExpenseClaims + * @throws ApiException if fails to make API call + */ + public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID) throws ApiException { + return getExpenseClaimWithHttpInfo(xeroTenantId, expenseClaimID).getData(); + } + + /** + * Allows you to retrieve a specified expense claim + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param expenseClaimID Unique identifier for a ExpenseClaim (required) + * @return ApiResponse<ExpenseClaims> + * @throws ApiException if fails to make API call + */ + public ApiResponse getExpenseClaimWithHttpInfo(String xeroTenantId, UUID expenseClaimID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); + } + + // verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new ApiException(400, "Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); + } + + // create path and map variables + String localVarPath = "/ExpenseClaims/{ExpenseClaimID}" + .replaceAll("\\{" + "ExpenseClaimID" + "\\}", apiClient.escapeString(expenseClaimID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a history records of an ExpenseClaim + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param expenseClaimID Unique identifier for a ExpenseClaim (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID) throws ApiException { + return getExpenseClaimHistoryWithHttpInfo(xeroTenantId, expenseClaimID).getData(); + } + + /** + * Allows you to retrieve a history records of an ExpenseClaim + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param expenseClaimID Unique identifier for a ExpenseClaim (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getExpenseClaimHistoryWithHttpInfo(String xeroTenantId, UUID expenseClaimID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); + } + + // verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new ApiException(400, "Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); + } + + // create path and map variables + String localVarPath = "/ExpenseClaims/{ExpenseClaimID}/History" + .replaceAll("\\{" + "ExpenseClaimID" + "\\}", apiClient.escapeString(expenseClaimID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve expense claims + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ExpenseClaims + * @throws ApiException if fails to make API call + */ + public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + return getExpenseClaimsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); + } + + /** + * Allows you to retrieve expense claims + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ApiResponse<ExpenseClaims> + * @throws ApiException if fails to make API call + */ + public ApiResponse getExpenseClaimsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); + } + + // create path and map variables + String localVarPath = "/ExpenseClaims"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified sales invoice or purchase bill + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @return Invoices + * @throws ApiException if fails to make API call + */ + public Invoices getInvoice(String xeroTenantId, UUID invoiceID) throws ApiException { + return getInvoiceWithHttpInfo(xeroTenantId, invoiceID).getData(); + } + + /** + * Allows you to retrieve a specified sales invoice or purchase bill + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @return ApiResponse<Invoices> + * @throws ApiException if fails to make API call + */ + public ApiResponse getInvoiceWithHttpInfo(String xeroTenantId, UUID invoiceID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoice"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoice"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve invoices or purchase bills as PDF files + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType) throws ApiException { + return getInvoiceAsPdfWithHttpInfo(xeroTenantId, invoiceID, contentType).getData(); + } + + /** + * Allows you to retrieve invoices or purchase bills as PDF files + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getInvoiceAsPdfWithHttpInfo(String xeroTenantId, UUID invoiceID, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}/pdf" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachment on invoices or purchase bills by it's filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param fileName Name of the file you are attaching (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws ApiException { + return getInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, invoiceID, fileName, contentType).getData(); + } + + /** + * Allows you to retrieve Attachment on invoices or purchase bills by it's filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param fileName Name of the file you are attaching (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling getInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}/Attachments/{FileName}" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param attachmentID Unique identifier for an Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws ApiException { + return getInvoiceAttachmentByIdWithHttpInfo(xeroTenantId, invoiceID, attachmentID, contentType).getData(); + } + + /** + * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param attachmentID Unique identifier for an Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getInvoiceAttachmentByIdWithHttpInfo(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); + } + + // verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getInvoiceAttachmentById"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())) + .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on invoices or purchase bills + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) throws ApiException { + return getInvoiceAttachmentsWithHttpInfo(xeroTenantId, invoiceID).getData(); + } + + /** + * Allows you to retrieve Attachments on invoices or purchase bills + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getInvoiceAttachmentsWithHttpInfo(String xeroTenantId, UUID invoiceID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}/Attachments" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a history records of an invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) throws ApiException { + return getInvoiceHistoryWithHttpInfo(xeroTenantId, invoiceID).getData(); + } + + /** + * Allows you to retrieve a history records of an invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getInvoiceHistoryWithHttpInfo(String xeroTenantId, UUID invoiceID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}/History" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve invoice reminder settings + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @return InvoiceReminders + * @throws ApiException if fails to make API call + */ + public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws ApiException { + return getInvoiceRemindersWithHttpInfo(xeroTenantId).getData(); + } + + /** + * Allows you to retrieve invoice reminder settings + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @return ApiResponse<InvoiceReminders> + * @throws ApiException if fails to make API call + */ + public ApiResponse getInvoiceRemindersWithHttpInfo(String xeroTenantId) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); + } + + // create path and map variables + String localVarPath = "/InvoiceReminders/Settings"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve any sales invoices or purchase bills + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param ids Filter by a comma-separated list of InvoicesIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) + * @param invoiceNumbers Filter by a comma-separated list of InvoiceNumbers. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) + * @param contactIDs Filter by a comma-separated list of ContactIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) + * @param statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) + * @param page e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional) + * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional) + * @param createdByMyApp When set to true you'll only retrieve Invoices created by your app (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return Invoices + * @throws ApiException if fails to make API call + */ + public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws ApiException { + return getInvoicesWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp).getData(); + } + + /** + * Allows you to retrieve any sales invoices or purchase bills + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param ids Filter by a comma-separated list of InvoicesIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) + * @param invoiceNumbers Filter by a comma-separated list of InvoiceNumbers. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) + * @param contactIDs Filter by a comma-separated list of ContactIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) + * @param statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) + * @param page e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional) + * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional) + * @param createdByMyApp When set to true you'll only retrieve Invoices created by your app (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return ApiResponse<Invoices> + * @throws ApiException if fails to make API call + */ + public ApiResponse getInvoicesWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoices"); + } + + // create path and map variables + String localVarPath = "/Invoices"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "IDs", ids)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "InvoiceNumbers", invoiceNumbers)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "ContactIDs", contactIDs)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "Statuses", statuses)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "includeArchived", includeArchived)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "createdByMyApp", createdByMyApp)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified item + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param itemID Unique identifier for an Item (required) + * @return Items + * @throws ApiException if fails to make API call + */ + public Items getItem(String xeroTenantId, UUID itemID) throws ApiException { + return getItemWithHttpInfo(xeroTenantId, itemID).getData(); + } + + /** + * Allows you to retrieve a specified item + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param itemID Unique identifier for an Item (required) + * @return ApiResponse<Items> + * @throws ApiException if fails to make API call + */ + public ApiResponse getItemWithHttpInfo(String xeroTenantId, UUID itemID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getItem"); + } + + // verify the required parameter 'itemID' is set + if (itemID == null) { + throw new ApiException(400, "Missing the required parameter 'itemID' when calling getItem"); + } + + // create path and map variables + String localVarPath = "/Items/{ItemID}" + .replaceAll("\\{" + "ItemID" + "\\}", apiClient.escapeString(itemID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve history for items + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param itemID Unique identifier for an Item (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws ApiException { + return getItemHistoryWithHttpInfo(xeroTenantId, itemID).getData(); + } + + /** + * Allows you to retrieve history for items + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param itemID Unique identifier for an Item (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getItemHistoryWithHttpInfo(String xeroTenantId, UUID itemID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getItemHistory"); + } + + // verify the required parameter 'itemID' is set + if (itemID == null) { + throw new ApiException(400, "Missing the required parameter 'itemID' when calling getItemHistory"); + } + + // create path and map variables + String localVarPath = "/Items/{ItemID}/History" + .replaceAll("\\{" + "ItemID" + "\\}", apiClient.escapeString(itemID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve any items + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return Items + * @throws ApiException if fails to make API call + */ + public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws ApiException { + return getItemsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, unitdp).getData(); + } + + /** + * Allows you to retrieve any items + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return ApiResponse<Items> + * @throws ApiException if fails to make API call + */ + public ApiResponse getItemsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getItems"); + } + + // create path and map variables + String localVarPath = "/Items"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified journals. + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param journalID Unique identifier for a Journal (required) + * @return Journals + * @throws ApiException if fails to make API call + */ + public Journals getJournal(String xeroTenantId, UUID journalID) throws ApiException { + return getJournalWithHttpInfo(xeroTenantId, journalID).getData(); + } + + /** + * Allows you to retrieve a specified journals. + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param journalID Unique identifier for a Journal (required) + * @return ApiResponse<Journals> + * @throws ApiException if fails to make API call + */ + public ApiResponse getJournalWithHttpInfo(String xeroTenantId, UUID journalID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getJournal"); + } + + // verify the required parameter 'journalID' is set + if (journalID == null) { + throw new ApiException(400, "Missing the required parameter 'journalID' when calling getJournal"); + } + + // create path and map variables + String localVarPath = "/Journals/{JournalID}" + .replaceAll("\\{" + "JournalID" + "\\}", apiClient.escapeString(journalID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve any journals. + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional) + * @param paymentsOnly Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional) + * @return Journals + * @throws ApiException if fails to make API call + */ + public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws ApiException { + return getJournalsWithHttpInfo(xeroTenantId, ifModifiedSince, offset, paymentsOnly).getData(); + } + + /** + * Allows you to retrieve any journals. + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional) + * @param paymentsOnly Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional) + * @return ApiResponse<Journals> + * @throws ApiException if fails to make API call + */ + public ApiResponse getJournalsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getJournals"); + } + + // create path and map variables + String localVarPath = "/Journals"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "paymentsOnly", paymentsOnly)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified linked transactions (billable expenses) + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) + * @return LinkedTransactions + * @throws ApiException if fails to make API call + */ + public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws ApiException { + return getLinkedTransactionWithHttpInfo(xeroTenantId, linkedTransactionID).getData(); + } + + /** + * Allows you to retrieve a specified linked transactions (billable expenses) + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) + * @return ApiResponse<LinkedTransactions> + * @throws ApiException if fails to make API call + */ + public ApiResponse getLinkedTransactionWithHttpInfo(String xeroTenantId, UUID linkedTransactionID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); + } + + // verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); + } + + // create path and map variables + String localVarPath = "/LinkedTransactions/{LinkedTransactionID}" + .replaceAll("\\{" + "LinkedTransactionID" + "\\}", apiClient.escapeString(linkedTransactionID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Retrieve linked transactions (billable expenses) + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. (optional) + * @param linkedTransactionID The Xero identifier for an Linked Transaction (optional) + * @param sourceTransactionID Filter by the SourceTransactionID. Get all the linked transactions created from a particular ACCPAY invoice (optional) + * @param contactID Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional) + * @param status Filter by the combination of ContactID and Status. Get all the linked transactions that have been assigned to a particular customer and have a particular status e.g. GET /LinkedTransactions?ContactID=4bb34b03-3378-4bb2-a0ed-6345abf3224e&Status=APPROVED. (optional) + * @param targetTransactionID Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional) + * @return LinkedTransactions + * @throws ApiException if fails to make API call + */ + public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws ApiException { + return getLinkedTransactionsWithHttpInfo(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID).getData(); + } + + /** + * Retrieve linked transactions (billable expenses) + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. (optional) + * @param linkedTransactionID The Xero identifier for an Linked Transaction (optional) + * @param sourceTransactionID Filter by the SourceTransactionID. Get all the linked transactions created from a particular ACCPAY invoice (optional) + * @param contactID Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional) + * @param status Filter by the combination of ContactID and Status. Get all the linked transactions that have been assigned to a particular customer and have a particular status e.g. GET /LinkedTransactions?ContactID=4bb34b03-3378-4bb2-a0ed-6345abf3224e&Status=APPROVED. (optional) + * @param targetTransactionID Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional) + * @return ApiResponse<LinkedTransactions> + * @throws ApiException if fails to make API call + */ + public ApiResponse getLinkedTransactionsWithHttpInfo(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); + } + + // create path and map variables + String localVarPath = "/LinkedTransactions"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "LinkedTransactionID", linkedTransactionID)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "SourceTransactionID", sourceTransactionID)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "ContactID", contactID)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "Status", status)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "TargetTransactionID", targetTransactionID)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified manual journals + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @return ManualJournals + * @throws ApiException if fails to make API call + */ + public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID) throws ApiException { + return getManualJournalWithHttpInfo(xeroTenantId, manualJournalID).getData(); + } + + /** + * Allows you to retrieve a specified manual journals + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @return ApiResponse<ManualJournals> + * @throws ApiException if fails to make API call + */ + public ApiResponse getManualJournalWithHttpInfo(String xeroTenantId, UUID manualJournalID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getManualJournal"); + } + + // verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling getManualJournal"); + } + + // create path and map variables + String localVarPath = "/ManualJournals/{ManualJournalID}" + .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve specified Attachment on ManualJournal by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @param fileName The name of the file being attached to a ManualJournal (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws ApiException { + return getManualJournalAttachmentByFileNameWithHttpInfo(xeroTenantId, manualJournalID, fileName, contentType).getData(); + } + + /** + * Allows you to retrieve specified Attachment on ManualJournal by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @param fileName The name of the file being attached to a ManualJournal (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getManualJournalAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); + } + + // verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling getManualJournalAttachmentByFileName"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}" + .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve specified Attachment on ManualJournals + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @param attachmentID Unique identifier for a Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws ApiException { + return getManualJournalAttachmentByIdWithHttpInfo(xeroTenantId, manualJournalID, attachmentID, contentType).getData(); + } + + /** + * Allows you to retrieve specified Attachment on ManualJournals + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @param attachmentID Unique identifier for a Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getManualJournalAttachmentByIdWithHttpInfo(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); + } + + // verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); + } + + // verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getManualJournalAttachmentById"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); + } + + // create path and map variables + String localVarPath = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}" + .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())) + .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachment for manual journals + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID) throws ApiException { + return getManualJournalAttachmentsWithHttpInfo(xeroTenantId, manualJournalID).getData(); + } + + /** + * Allows you to retrieve Attachment for manual journals + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getManualJournalAttachmentsWithHttpInfo(String xeroTenantId, UUID manualJournalID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); + } + + // verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); + } + + // create path and map variables + String localVarPath = "/ManualJournals/{ManualJournalID}/Attachments" + .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve any manual journals + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param page e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional) + * @return ManualJournals + * @throws ApiException if fails to make API call + */ + public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws ApiException { + return getManualJournalsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, page).getData(); + } + + /** + * Allows you to retrieve any manual journals + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param page e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional) + * @return ApiResponse<ManualJournals> + * @throws ApiException if fails to make API call + */ + public ApiResponse getManualJournalsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getManualJournals"); + } + + // create path and map variables + String localVarPath = "/ManualJournals"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a URL to an online invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @return OnlineInvoices + * @throws ApiException if fails to make API call + */ + public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID) throws ApiException { + return getOnlineInvoiceWithHttpInfo(xeroTenantId, invoiceID).getData(); + } + + /** + * Allows you to retrieve a URL to an online invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @return ApiResponse<OnlineInvoices> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOnlineInvoiceWithHttpInfo(String xeroTenantId, UUID invoiceID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}/OnlineInvoice" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param organisationID (required) + * @return CISOrgSetting + * @throws ApiException if fails to make API call + */ + public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID) throws ApiException { + return getOrganisationCISSettingsWithHttpInfo(xeroTenantId, organisationID).getData(); + } + + /** + * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param organisationID (required) + * @return ApiResponse<CISOrgSetting> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrganisationCISSettingsWithHttpInfo(String xeroTenantId, UUID organisationID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); + } + + // verify the required parameter 'organisationID' is set + if (organisationID == null) { + throw new ApiException(400, "Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); + } + + // create path and map variables + String localVarPath = "/Organisation/{OrganisationID}/CISSettings" + .replaceAll("\\{" + "OrganisationID" + "\\}", apiClient.escapeString(organisationID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Organisation details + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @return Organisations + * @throws ApiException if fails to make API call + */ + public Organisations getOrganisations(String xeroTenantId) throws ApiException { + return getOrganisationsWithHttpInfo(xeroTenantId).getData(); + } + + /** + * Allows you to retrieve Organisation details + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @return ApiResponse<Organisations> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOrganisationsWithHttpInfo(String xeroTenantId) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOrganisations"); + } + + // create path and map variables + String localVarPath = "/Organisation"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "OAuth2" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified overpayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param overpaymentID Unique identifier for a Overpayment (required) + * @return Overpayments + * @throws ApiException if fails to make API call + */ + public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID) throws ApiException { + return getOverpaymentWithHttpInfo(xeroTenantId, overpaymentID).getData(); + } + + /** + * Allows you to retrieve a specified overpayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param overpaymentID Unique identifier for a Overpayment (required) + * @return ApiResponse<Overpayments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOverpaymentWithHttpInfo(String xeroTenantId, UUID overpaymentID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOverpayment"); + } + + // verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new ApiException(400, "Missing the required parameter 'overpaymentID' when calling getOverpayment"); + } + + // create path and map variables + String localVarPath = "/Overpayments/{OverpaymentID}" + .replaceAll("\\{" + "OverpaymentID" + "\\}", apiClient.escapeString(overpaymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a history records of an Overpayment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param overpaymentID Unique identifier for a Overpayment (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID) throws ApiException { + return getOverpaymentHistoryWithHttpInfo(xeroTenantId, overpaymentID).getData(); + } + + /** + * Allows you to retrieve a history records of an Overpayment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param overpaymentID Unique identifier for a Overpayment (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOverpaymentHistoryWithHttpInfo(String xeroTenantId, UUID overpaymentID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); + } + + // verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new ApiException(400, "Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); + } + + // create path and map variables + String localVarPath = "/Overpayments/{OverpaymentID}/History" + .replaceAll("\\{" + "OverpaymentID" + "\\}", apiClient.escapeString(overpaymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve overpayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param page e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return Overpayments + * @throws ApiException if fails to make API call + */ + public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { + return getOverpaymentsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, page, unitdp).getData(); + } + + /** + * Allows you to retrieve overpayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param page e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return ApiResponse<Overpayments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getOverpaymentsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOverpayments"); + } + + // create path and map variables + String localVarPath = "/Overpayments"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified payment for invoices and credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param paymentID Unique identifier for a Payment (required) + * @return Payments + * @throws ApiException if fails to make API call + */ + public Payments getPayment(String xeroTenantId, UUID paymentID) throws ApiException { + return getPaymentWithHttpInfo(xeroTenantId, paymentID).getData(); + } + + /** + * Allows you to retrieve a specified payment for invoices and credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param paymentID Unique identifier for a Payment (required) + * @return ApiResponse<Payments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPaymentWithHttpInfo(String xeroTenantId, UUID paymentID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPayment"); + } + + // verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new ApiException(400, "Missing the required parameter 'paymentID' when calling getPayment"); + } + + // create path and map variables + String localVarPath = "/Payments/{PaymentID}" + .replaceAll("\\{" + "PaymentID" + "\\}", apiClient.escapeString(paymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve history records of a payment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param paymentID Unique identifier for a Payment (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) throws ApiException { + return getPaymentHistoryWithHttpInfo(xeroTenantId, paymentID).getData(); + } + + /** + * Allows you to retrieve history records of a payment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param paymentID Unique identifier for a Payment (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPaymentHistoryWithHttpInfo(String xeroTenantId, UUID paymentID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); + } + + // verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new ApiException(400, "Missing the required parameter 'paymentID' when calling getPaymentHistory"); + } + + // create path and map variables + String localVarPath = "/Payments/{PaymentID}/History" + .replaceAll("\\{" + "PaymentID" + "\\}", apiClient.escapeString(paymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve payment services + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @return PaymentServices + * @throws ApiException if fails to make API call + */ + public PaymentServices getPaymentServices(String xeroTenantId) throws ApiException { + return getPaymentServicesWithHttpInfo(xeroTenantId).getData(); + } + + /** + * Allows you to retrieve payment services + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @return ApiResponse<PaymentServices> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPaymentServicesWithHttpInfo(String xeroTenantId) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); + } + + // create path and map variables + String localVarPath = "/PaymentServices"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve payments for invoices and credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return Payments + * @throws ApiException if fails to make API call + */ + public Payments getPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + return getPaymentsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); + } + + /** + * Allows you to retrieve payments for invoices and credit notes + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ApiResponse<Payments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPaymentsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPayments"); + } + + // create path and map variables + String localVarPath = "/Payments"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified prepayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param prepaymentID Unique identifier for a PrePayment (required) + * @return Prepayments + * @throws ApiException if fails to make API call + */ + public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID) throws ApiException { + return getPrepaymentWithHttpInfo(xeroTenantId, prepaymentID).getData(); + } + + /** + * Allows you to retrieve a specified prepayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param prepaymentID Unique identifier for a PrePayment (required) + * @return ApiResponse<Prepayments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPrepaymentWithHttpInfo(String xeroTenantId, UUID prepaymentID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPrepayment"); + } + + // verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new ApiException(400, "Missing the required parameter 'prepaymentID' when calling getPrepayment"); + } + + // create path and map variables + String localVarPath = "/Prepayments/{PrepaymentID}" + .replaceAll("\\{" + "PrepaymentID" + "\\}", apiClient.escapeString(prepaymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a history records of an Prepayment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param prepaymentID Unique identifier for a PrePayment (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID) throws ApiException { + return getPrepaymentHistoryWithHttpInfo(xeroTenantId, prepaymentID).getData(); + } + + /** + * Allows you to retrieve a history records of an Prepayment + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param prepaymentID Unique identifier for a PrePayment (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPrepaymentHistoryWithHttpInfo(String xeroTenantId, UUID prepaymentID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); + } + + // verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new ApiException(400, "Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); + } + + // create path and map variables + String localVarPath = "/Prepayments/{PrepaymentID}/History" + .replaceAll("\\{" + "PrepaymentID" + "\\}", apiClient.escapeString(prepaymentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve prepayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param page e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return Prepayments + * @throws ApiException if fails to make API call + */ + public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { + return getPrepaymentsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, page, unitdp).getData(); + } + + /** + * Allows you to retrieve prepayments + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param page e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return ApiResponse<Prepayments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPrepaymentsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPrepayments"); + } + + // create path and map variables + String localVarPath = "/Prepayments"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified purchase orders + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) + * @return PurchaseOrders + * @throws ApiException if fails to make API call + */ + public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID) throws ApiException { + return getPurchaseOrderWithHttpInfo(xeroTenantId, purchaseOrderID).getData(); + } + + /** + * Allows you to retrieve a specified purchase orders + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) + * @return ApiResponse<PurchaseOrders> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPurchaseOrderWithHttpInfo(String xeroTenantId, UUID purchaseOrderID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); + } + + // verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new ApiException(400, "Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); + } + + // create path and map variables + String localVarPath = "/PurchaseOrders/{PurchaseOrderID}" + .replaceAll("\\{" + "PurchaseOrderID" + "\\}", apiClient.escapeString(purchaseOrderID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve history for PurchaseOrder + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID) throws ApiException { + return getPurchaseOrderHistoryWithHttpInfo(xeroTenantId, purchaseOrderID).getData(); + } + + /** + * Allows you to retrieve history for PurchaseOrder + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPurchaseOrderHistoryWithHttpInfo(String xeroTenantId, UUID purchaseOrderID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); + } + + // verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new ApiException(400, "Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); + } + + // create path and map variables + String localVarPath = "/PurchaseOrders/{PurchaseOrderID}/History" + .replaceAll("\\{" + "PurchaseOrderID" + "\\}", apiClient.escapeString(purchaseOrderID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve purchase orders + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param status Filter by purchase order status (optional) + * @param dateFrom Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) + * @param dateTo Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) + * @param order Order by an any element (optional) + * @param page To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned. (optional) + * @return PurchaseOrders + * @throws ApiException if fails to make API call + */ + public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws ApiException { + return getPurchaseOrdersWithHttpInfo(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page).getData(); + } + + /** + * Allows you to retrieve purchase orders + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param status Filter by purchase order status (optional) + * @param dateFrom Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) + * @param dateTo Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) + * @param order Order by an any element (optional) + * @param page To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned. (optional) + * @return ApiResponse<PurchaseOrders> + * @throws ApiException if fails to make API call + */ + public ApiResponse getPurchaseOrdersWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); + } + + // create path and map variables + String localVarPath = "/PurchaseOrders"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "Status", status)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "DateFrom", dateFrom)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "DateTo", dateTo)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified draft expense claim receipts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @return Receipts + * @throws ApiException if fails to make API call + */ + public Receipts getReceipt(String xeroTenantId, UUID receiptID) throws ApiException { + return getReceiptWithHttpInfo(xeroTenantId, receiptID).getData(); + } + + /** + * Allows you to retrieve a specified draft expense claim receipts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @return ApiResponse<Receipts> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReceiptWithHttpInfo(String xeroTenantId, UUID receiptID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceipt"); + } + + // verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new ApiException(400, "Missing the required parameter 'receiptID' when calling getReceipt"); + } + + // create path and map variables + String localVarPath = "/Receipts/{ReceiptID}" + .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on expense claim receipts by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param fileName The name of the file being attached to the Receipt (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws ApiException { + return getReceiptAttachmentByFileNameWithHttpInfo(xeroTenantId, receiptID, fileName, contentType).getData(); + } + + /** + * Allows you to retrieve Attachments on expense claim receipts by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param fileName The name of the file being attached to the Receipt (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReceiptAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); + } + + // verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new ApiException(400, "Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling getReceiptAttachmentByFileName"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Receipts/{ReceiptID}/Attachments/{FileName}" + .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on expense claim receipts by ID + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param attachmentID Unique identifier for a Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws ApiException { + return getReceiptAttachmentByIdWithHttpInfo(xeroTenantId, receiptID, attachmentID, contentType).getData(); + } + + /** + * Allows you to retrieve Attachments on expense claim receipts by ID + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param attachmentID Unique identifier for a Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReceiptAttachmentByIdWithHttpInfo(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); + } + + // verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new ApiException(400, "Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); + } + + // verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getReceiptAttachmentById"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); + } + + // create path and map variables + String localVarPath = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}" + .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())) + .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments for expense claim receipts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) throws ApiException { + return getReceiptAttachmentsWithHttpInfo(xeroTenantId, receiptID).getData(); + } + + /** + * Allows you to retrieve Attachments for expense claim receipts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReceiptAttachmentsWithHttpInfo(String xeroTenantId, UUID receiptID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); + } + + // verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new ApiException(400, "Missing the required parameter 'receiptID' when calling getReceiptAttachments"); + } + + // create path and map variables + String localVarPath = "/Receipts/{ReceiptID}/Attachments" + .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a history records of an Receipt + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) throws ApiException { + return getReceiptHistoryWithHttpInfo(xeroTenantId, receiptID).getData(); + } + + /** + * Allows you to retrieve a history records of an Receipt + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReceiptHistoryWithHttpInfo(String xeroTenantId, UUID receiptID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); + } + + // verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new ApiException(400, "Missing the required parameter 'receiptID' when calling getReceiptHistory"); + } + + // create path and map variables + String localVarPath = "/Receipts/{ReceiptID}/History" + .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve draft expense claim receipts for any user + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return Receipts + * @throws ApiException if fails to make API call + */ + public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws ApiException { + return getReceiptsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, unitdp).getData(); + } + + /** + * Allows you to retrieve draft expense claim receipts for any user + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) + * @return ApiResponse<Receipts> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReceiptsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceipts"); + } + + // create path and map variables + String localVarPath = "/Receipts"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified repeating invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @return RepeatingInvoices + * @throws ApiException if fails to make API call + */ + public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { + return getRepeatingInvoiceWithHttpInfo(xeroTenantId, repeatingInvoiceID).getData(); + } + + /** + * Allows you to retrieve a specified repeating invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @return ApiResponse<RepeatingInvoices> + * @throws ApiException if fails to make API call + */ + public ApiResponse getRepeatingInvoiceWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); + } + + // verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); + } + + // create path and map variables + String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}" + .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve specified attachment on repeating invoices by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @param fileName The name of the file being attached to a Repeating Invoice (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws ApiException { + return getRepeatingInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, repeatingInvoiceID, fileName, contentType).getData(); + } + + /** + * Allows you to retrieve specified attachment on repeating invoices by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @param fileName The name of the file being attached to a Repeating Invoice (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getRepeatingInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling getRepeatingInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}" + .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified Attachments on repeating invoices + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @param attachmentID Unique identifier for a Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws ApiException { + return getRepeatingInvoiceAttachmentByIdWithHttpInfo(xeroTenantId, repeatingInvoiceID, attachmentID, contentType).getData(); + } + + /** + * Allows you to retrieve a specified Attachments on repeating invoices + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @param attachmentID Unique identifier for a Attachment (required) + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse getRepeatingInvoiceAttachmentByIdWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); + } + + // verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); + } + + // verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getRepeatingInvoiceAttachmentById"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException(400, "Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); + } + + // create path and map variables + String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}" + .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())) + .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (contentType != null) + localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); + + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Attachments on repeating invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { + return getRepeatingInvoiceAttachmentsWithHttpInfo(xeroTenantId, repeatingInvoiceID).getData(); + } + + /** + * Allows you to retrieve Attachments on repeating invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse getRepeatingInvoiceAttachmentsWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); + } + + // verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); + } + + // create path and map variables + String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments" + .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve history for a repeating invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @return HistoryRecords + * @throws ApiException if fails to make API call + */ + public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { + return getRepeatingInvoiceHistoryWithHttpInfo(xeroTenantId, repeatingInvoiceID).getData(); + } + + /** + * Allows you to retrieve history for a repeating invoice + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @return ApiResponse<HistoryRecords> + * @throws ApiException if fails to make API call + */ + public ApiResponse getRepeatingInvoiceHistoryWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); + } + + // verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); + } + + // create path and map variables + String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History" + .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve any repeating invoices + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return RepeatingInvoices + * @throws ApiException if fails to make API call + */ + public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, String order) throws ApiException { + return getRepeatingInvoicesWithHttpInfo(xeroTenantId, where, order).getData(); + } + + /** + * Allows you to retrieve any repeating invoices + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ApiResponse<RepeatingInvoices> + * @throws ApiException if fails to make API call + */ + public ApiResponse getRepeatingInvoicesWithHttpInfo(String xeroTenantId, String where, String order) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); + } + + // create path and map variables + String localVarPath = "/RepeatingInvoices"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve report for AgedPayablesByContact + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactId Unique identifier for a Contact (required) + * @param date The date of the Aged Payables By Contact report (optional) + * @param fromDate The from date of the Aged Payables By Contact report (optional) + * @param toDate The to date of the Aged Payables By Contact report (optional) + * @return ReportWithRows + * @throws ApiException if fails to make API call + */ + public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws ApiException { + return getReportAgedPayablesByContactWithHttpInfo(xeroTenantId, contactId, date, fromDate, toDate).getData(); + } + + /** + * Allows you to retrieve report for AgedPayablesByContact + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactId Unique identifier for a Contact (required) + * @param date The date of the Aged Payables By Contact report (optional) + * @param fromDate The from date of the Aged Payables By Contact report (optional) + * @param toDate The to date of the Aged Payables By Contact report (optional) + * @return ApiResponse<ReportWithRows> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReportAgedPayablesByContactWithHttpInfo(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); + } + + // verify the required parameter 'contactId' is set + if (contactId == null) { + throw new ApiException(400, "Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); + } + + // create path and map variables + String localVarPath = "/Reports/AgedPayablesByContact"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "contactId", contactId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "fromDate", fromDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "toDate", toDate)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve report for AgedReceivablesByContact + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactId Unique identifier for a Contact (required) + * @param date The date of the Aged Receivables By Contact report (optional) + * @param fromDate The from date of the Aged Receivables By Contact report (optional) + * @param toDate The to date of the Aged Receivables By Contact report (optional) + * @return ReportWithRows + * @throws ApiException if fails to make API call + */ + public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws ApiException { + return getReportAgedReceivablesByContactWithHttpInfo(xeroTenantId, contactId, date, fromDate, toDate).getData(); + } + + /** + * Allows you to retrieve report for AgedReceivablesByContact + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactId Unique identifier for a Contact (required) + * @param date The date of the Aged Receivables By Contact report (optional) + * @param fromDate The from date of the Aged Receivables By Contact report (optional) + * @param toDate The to date of the Aged Receivables By Contact report (optional) + * @return ApiResponse<ReportWithRows> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReportAgedReceivablesByContactWithHttpInfo(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); + } + + // verify the required parameter 'contactId' is set + if (contactId == null) { + throw new ApiException(400, "Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); + } + + // create path and map variables + String localVarPath = "/Reports/AgedReceivablesByContact"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "contactId", contactId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "fromDate", fromDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "toDate", toDate)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve report for BAS only valid for AU orgs + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param reportID Unique identifier for a Report (required) + * @return ReportWithRows + * @throws ApiException if fails to make API call + */ + public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) throws ApiException { + return getReportBASorGSTWithHttpInfo(xeroTenantId, reportID).getData(); + } + + /** + * Allows you to retrieve report for BAS only valid for AU orgs + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param reportID Unique identifier for a Report (required) + * @return ApiResponse<ReportWithRows> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReportBASorGSTWithHttpInfo(String xeroTenantId, String reportID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); + } + + // verify the required parameter 'reportID' is set + if (reportID == null) { + throw new ApiException(400, "Missing the required parameter 'reportID' when calling getReportBASorGST"); + } + + // create path and map variables + String localVarPath = "/Reports/{ReportID}" + .replaceAll("\\{" + "ReportID" + "\\}", apiClient.escapeString(reportID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve report for BAS only valid for AU orgs + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @return ReportWithRows + * @throws ApiException if fails to make API call + */ + public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws ApiException { + return getReportBASorGSTListWithHttpInfo(xeroTenantId).getData(); + } + + /** + * Allows you to retrieve report for BAS only valid for AU orgs + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @return ApiResponse<ReportWithRows> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReportBASorGSTListWithHttpInfo(String xeroTenantId) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); + } + + // create path and map variables + String localVarPath = "/Reports"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve report for BalanceSheet + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param date The date of the Balance Sheet report (optional) + * @param periods The number of periods for the Balance Sheet report (optional) + * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional) + * @param trackingOptionID1 The tracking option 1 for the Balance Sheet report (optional) + * @param trackingOptionID2 The tracking option 2 for the Balance Sheet report (optional) + * @param standardLayout The standard layout boolean for the Balance Sheet report (optional) + * @param paymentsOnly return a cash basis for the Balance Sheet report (optional) + * @return ReportWithRows + * @throws ApiException if fails to make API call + */ + public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws ApiException { + return getReportBalanceSheetWithHttpInfo(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly).getData(); + } + + /** + * Allows you to retrieve report for BalanceSheet + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param date The date of the Balance Sheet report (optional) + * @param periods The number of periods for the Balance Sheet report (optional) + * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional) + * @param trackingOptionID1 The tracking option 1 for the Balance Sheet report (optional) + * @param trackingOptionID2 The tracking option 2 for the Balance Sheet report (optional) + * @param standardLayout The standard layout boolean for the Balance Sheet report (optional) + * @param paymentsOnly return a cash basis for the Balance Sheet report (optional) + * @return ApiResponse<ReportWithRows> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReportBalanceSheetWithHttpInfo(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); + } + + // create path and map variables + String localVarPath = "/Reports/BalanceSheet"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "periods", periods)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "timeframe", timeframe)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingOptionID1", trackingOptionID1)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingOptionID2", trackingOptionID2)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "standardLayout", standardLayout)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "paymentsOnly", paymentsOnly)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve report for BankSummary + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) + * @param period The number of periods to compare (integer between 1 and 12) (optional) + * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) (optional) + * @return ReportWithRows + * @throws ApiException if fails to make API call + */ + public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws ApiException { + return getReportBankSummaryWithHttpInfo(xeroTenantId, date, period, timeframe).getData(); + } + + /** + * Allows you to retrieve report for BankSummary + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) + * @param period The number of periods to compare (integer between 1 and 12) (optional) + * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) (optional) + * @return ApiResponse<ReportWithRows> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReportBankSummaryWithHttpInfo(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); + } + + // create path and map variables + String localVarPath = "/Reports/BankSummary"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "period", period)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "timeframe", timeframe)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve report for Budget Summary + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) + * @param period The number of periods to compare (integer between 1 and 12) (optional) + * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) (optional) + * @return ReportWithRows + * @throws ApiException if fails to make API call + */ + public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws ApiException { + return getReportBudgetSummaryWithHttpInfo(xeroTenantId, date, period, timeframe).getData(); + } + + /** + * Allows you to retrieve report for Budget Summary + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) + * @param period The number of periods to compare (integer between 1 and 12) (optional) + * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) (optional) + * @return ApiResponse<ReportWithRows> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReportBudgetSummaryWithHttpInfo(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); + } + + // create path and map variables + String localVarPath = "/Reports/BudgetSummary"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "period", period)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "timeframe", timeframe)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve report for ExecutiveSummary + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) + * @return ReportWithRows + * @throws ApiException if fails to make API call + */ + public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate date) throws ApiException { + return getReportExecutiveSummaryWithHttpInfo(xeroTenantId, date).getData(); + } + + /** + * Allows you to retrieve report for ExecutiveSummary + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) + * @return ApiResponse<ReportWithRows> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReportExecutiveSummaryWithHttpInfo(String xeroTenantId, LocalDate date) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); + } + + // create path and map variables + String localVarPath = "/Reports/ExecutiveSummary"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve report for ProfitAndLoss + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param fromDate The from date for the ProfitAndLoss report e.g. 2018-03-31 (optional) + * @param toDate The to date for the ProfitAndLoss report e.g. 2018-03-31 (optional) + * @param periods The number of periods to compare (integer between 1 and 12) (optional) + * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional) + * @param trackingCategoryID The trackingCategory 1 for the ProfitAndLoss report (optional) + * @param trackingCategoryID2 The trackingCategory 2 for the ProfitAndLoss report (optional) + * @param trackingOptionID The tracking option 1 for the ProfitAndLoss report (optional) + * @param trackingOptionID2 The tracking option 2 for the ProfitAndLoss report (optional) + * @param standardLayout Return the standard layout for the ProfitAndLoss report (optional) + * @param paymentsOnly Return cash only basis for the ProfitAndLoss report (optional) + * @return ReportWithRows + * @throws ApiException if fails to make API call + */ + public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws ApiException { + return getReportProfitAndLossWithHttpInfo(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly).getData(); + } + + /** + * Allows you to retrieve report for ProfitAndLoss + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param fromDate The from date for the ProfitAndLoss report e.g. 2018-03-31 (optional) + * @param toDate The to date for the ProfitAndLoss report e.g. 2018-03-31 (optional) + * @param periods The number of periods to compare (integer between 1 and 12) (optional) + * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional) + * @param trackingCategoryID The trackingCategory 1 for the ProfitAndLoss report (optional) + * @param trackingCategoryID2 The trackingCategory 2 for the ProfitAndLoss report (optional) + * @param trackingOptionID The tracking option 1 for the ProfitAndLoss report (optional) + * @param trackingOptionID2 The tracking option 2 for the ProfitAndLoss report (optional) + * @param standardLayout Return the standard layout for the ProfitAndLoss report (optional) + * @param paymentsOnly Return cash only basis for the ProfitAndLoss report (optional) + * @return ApiResponse<ReportWithRows> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReportProfitAndLossWithHttpInfo(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); + } + + // create path and map variables + String localVarPath = "/Reports/ProfitAndLoss"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "fromDate", fromDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "toDate", toDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "periods", periods)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "timeframe", timeframe)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingCategoryID", trackingCategoryID)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingCategoryID2", trackingCategoryID2)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingOptionID", trackingOptionID)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingOptionID2", trackingOptionID2)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "standardLayout", standardLayout)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "paymentsOnly", paymentsOnly)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve report for TenNinetyNine + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param reportYear The year of the 1099 report (optional) + * @return Reports + * @throws ApiException if fails to make API call + */ + public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) throws ApiException { + return getReportTenNinetyNineWithHttpInfo(xeroTenantId, reportYear).getData(); + } + + /** + * Allows you to retrieve report for TenNinetyNine + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param reportYear The year of the 1099 report (optional) + * @return ApiResponse<Reports> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReportTenNinetyNineWithHttpInfo(String xeroTenantId, String reportYear) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); + } + + // create path and map variables + String localVarPath = "/Reports/TenNinetyNine"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "reportYear", reportYear)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve report for TrialBalance + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param date The date for the Trial Balance report e.g. 2018-03-31 (optional) + * @param paymentsOnly Return cash only basis for the Trial Balance report (optional) + * @return ReportWithRows + * @throws ApiException if fails to make API call + */ + public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws ApiException { + return getReportTrialBalanceWithHttpInfo(xeroTenantId, date, paymentsOnly).getData(); + } + + /** + * Allows you to retrieve report for TrialBalance + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param date The date for the Trial Balance report e.g. 2018-03-31 (optional) + * @param paymentsOnly Return cash only basis for the Trial Balance report (optional) + * @return ApiResponse<ReportWithRows> + * @throws ApiException if fails to make API call + */ + public ApiResponse getReportTrialBalanceWithHttpInfo(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); + } + + // create path and map variables + String localVarPath = "/Reports/TrialBalance"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "paymentsOnly", paymentsOnly)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve Tax Rates + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param taxType Filter by tax type (optional) + * @return TaxRates + * @throws ApiException if fails to make API call + */ + public TaxRates getTaxRates(String xeroTenantId, String where, String order, String taxType) throws ApiException { + return getTaxRatesWithHttpInfo(xeroTenantId, where, order, taxType).getData(); + } + + /** + * Allows you to retrieve Tax Rates + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param taxType Filter by tax type (optional) + * @return ApiResponse<TaxRates> + * @throws ApiException if fails to make API call + */ + public ApiResponse getTaxRatesWithHttpInfo(String xeroTenantId, String where, String order, String taxType) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getTaxRates"); + } + + // create path and map variables + String localVarPath = "/TaxRates"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "TaxType", taxType)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve tracking categories and options + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param includeArchived e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response (optional) + * @return TrackingCategories + * @throws ApiException if fails to make API call + */ + public TrackingCategories getTrackingCategories(String xeroTenantId, String where, String order, Boolean includeArchived) throws ApiException { + return getTrackingCategoriesWithHttpInfo(xeroTenantId, where, order, includeArchived).getData(); + } + + /** + * Allows you to retrieve tracking categories and options + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @param includeArchived e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response (optional) + * @return ApiResponse<TrackingCategories> + * @throws ApiException if fails to make API call + */ + public ApiResponse getTrackingCategoriesWithHttpInfo(String xeroTenantId, String where, String order, Boolean includeArchived) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); + } + + // create path and map variables + String localVarPath = "/TrackingCategories"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "includeArchived", includeArchived)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve tracking categories and options for specified category + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategoryID Unique identifier for a TrackingCategory (required) + * @return TrackingCategories + * @throws ApiException if fails to make API call + */ + public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws ApiException { + return getTrackingCategoryWithHttpInfo(xeroTenantId, trackingCategoryID).getData(); + } + + /** + * Allows you to retrieve tracking categories and options for specified category + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategoryID Unique identifier for a TrackingCategory (required) + * @return ApiResponse<TrackingCategories> + * @throws ApiException if fails to make API call + */ + public ApiResponse getTrackingCategoryWithHttpInfo(String xeroTenantId, UUID trackingCategoryID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); + } + + // verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new ApiException(400, "Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); + } + + // create path and map variables + String localVarPath = "/TrackingCategories/{TrackingCategoryID}" + .replaceAll("\\{" + "TrackingCategoryID" + "\\}", apiClient.escapeString(trackingCategoryID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified user + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param userID Unique identifier for a User (required) + * @return Users + * @throws ApiException if fails to make API call + */ + public Users getUser(String xeroTenantId, UUID userID) throws ApiException { + return getUserWithHttpInfo(xeroTenantId, userID).getData(); + } + + /** + * Allows you to retrieve a specified user + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param userID Unique identifier for a User (required) + * @return ApiResponse<Users> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUserWithHttpInfo(String xeroTenantId, UUID userID) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getUser"); + } + + // verify the required parameter 'userID' is set + if (userID == null) { + throw new ApiException(400, "Missing the required parameter 'userID' when calling getUser"); + } + + // create path and map variables + String localVarPath = "/Users/{UserID}" + .replaceAll("\\{" + "UserID" + "\\}", apiClient.escapeString(userID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve users + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return Users + * @throws ApiException if fails to make API call + */ + public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + return getUsersWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); + } + + /** + * Allows you to retrieve users + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) + * @param where Filter by an any element (optional) + * @param order Order by an any element (optional) + * @return ApiResponse<Users> + * @throws ApiException if fails to make API call + */ + public ApiResponse getUsersWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { + Object localVarPostBody = new Object(); + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getUsers"); + } + + // create path and map variables + String localVarPath = "/Users"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); +if (ifModifiedSince != null) + localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update a chart of accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for retrieving single object (required) + * @param accounts Request of type Accounts array with one Account (required) + * @return Accounts + * @throws ApiException if fails to make API call + */ + public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts) throws ApiException { + return updateAccountWithHttpInfo(xeroTenantId, accountID, accounts).getData(); + } + + /** + * Allows you to update a chart of accounts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for retrieving single object (required) + * @param accounts Request of type Accounts array with one Account (required) + * @return ApiResponse<Accounts> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateAccountWithHttpInfo(String xeroTenantId, UUID accountID, Accounts accounts) throws ApiException { + Object localVarPostBody = accounts; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateAccount"); + } + + // verify the required parameter 'accountID' is set + if (accountID == null) { + throw new ApiException(400, "Missing the required parameter 'accountID' when calling updateAccount"); + } + + // verify the required parameter 'accounts' is set + if (accounts == null) { + throw new ApiException(400, "Missing the required parameter 'accounts' when calling updateAccount"); + } + + // create path and map variables + String localVarPath = "/Accounts/{AccountID}" + .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update Attachment on Account by Filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for Account object (required) + * @param fileName Name of the attachment (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws ApiException { + return updateAccountAttachmentByFileNameWithHttpInfo(xeroTenantId, accountID, fileName, body).getData(); + } + + /** + * Allows you to update Attachment on Account by Filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param accountID Unique identifier for Account object (required) + * @param fileName Name of the attachment (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateAccountAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); + } + + // verify the required parameter 'accountID' is set + if (accountID == null) { + throw new ApiException(400, "Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Accounts/{AccountID}/Attachments/{FileName}" + .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update a single spend or receive money transaction + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param bankTransactions (required) + * @return BankTransactions + * @throws ApiException if fails to make API call + */ + public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws ApiException { + return updateBankTransactionWithHttpInfo(xeroTenantId, bankTransactionID, bankTransactions).getData(); + } + + /** + * Allows you to update a single spend or receive money transaction + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param bankTransactions (required) + * @return ApiResponse<BankTransactions> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateBankTransactionWithHttpInfo(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws ApiException { + Object localVarPostBody = bankTransactions; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); + } + + // verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); + } + + // verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); + } + + // create path and map variables + String localVarPath = "/BankTransactions/{BankTransactionID}" + .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update an Attachment on BankTransaction by Filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param fileName The name of the file being attached (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws ApiException { + return updateBankTransactionAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransactionID, fileName, body).getData(); + } + + /** + * Allows you to update an Attachment on BankTransaction by Filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) + * @param fileName The name of the file being attached (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateBankTransactionAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); + } + + // verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}" + .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @param fileName The name of the file being attached to a Bank Transfer (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws ApiException { + return updateBankTransferAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransferID, fileName, body).getData(); + } + + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param bankTransferID Xero generated unique identifier for a bank transfer (required) + * @param fileName The name of the file being attached to a Bank Transfer (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateBankTransferAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); + } + + // verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}" + .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param contacts an array of Contacts containing single Contact object with properties to update (required) + * @return Contacts + * @throws ApiException if fails to make API call + */ + public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts) throws ApiException { + return updateContactWithHttpInfo(xeroTenantId, contactID, contacts).getData(); + } + + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param contacts an array of Contacts containing single Contact object with properties to update (required) + * @return ApiResponse<Contacts> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateContactWithHttpInfo(String xeroTenantId, UUID contactID, Contacts contacts) throws ApiException { + Object localVarPostBody = contacts; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateContact"); + } + + // verify the required parameter 'contactID' is set + if (contactID == null) { + throw new ApiException(400, "Missing the required parameter 'contactID' when calling updateContact"); + } + + // verify the required parameter 'contacts' is set + if (contacts == null) { + throw new ApiException(400, "Missing the required parameter 'contacts' when calling updateContact"); + } + + // create path and map variables + String localVarPath = "/Contacts/{ContactID}" + .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param fileName Name for the file you are attaching (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws ApiException { + return updateContactAttachmentByFileNameWithHttpInfo(xeroTenantId, contactID, fileName, body).getData(); + } + + /** + * + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactID Unique identifier for a Contact (required) + * @param fileName Name for the file you are attaching (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateContactAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); + } + + // verify the required parameter 'contactID' is set + if (contactID == null) { + throw new ApiException(400, "Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Contacts/{ContactID}/Attachments/{FileName}" + .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update a Contract Group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroupID Unique identifier for a Contact Group (required) + * @param contactGroups an array of Contact groups with Name of specific group to update (required) + * @return ContactGroups + * @throws ApiException if fails to make API call + */ + public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws ApiException { + return updateContactGroupWithHttpInfo(xeroTenantId, contactGroupID, contactGroups).getData(); + } + + /** + * Allows you to update a Contract Group + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param contactGroupID Unique identifier for a Contact Group (required) + * @param contactGroups an array of Contact groups with Name of specific group to update (required) + * @return ApiResponse<ContactGroups> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateContactGroupWithHttpInfo(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws ApiException { + Object localVarPostBody = contactGroups; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); + } + + // verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new ApiException(400, "Missing the required parameter 'contactGroupID' when calling updateContactGroup"); + } + + // verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new ApiException(400, "Missing the required parameter 'contactGroups' when calling updateContactGroup"); + } + + // create path and map variables + String localVarPath = "/ContactGroups/{ContactGroupID}" + .replaceAll("\\{" + "ContactGroupID" + "\\}", apiClient.escapeString(contactGroupID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update a specific credit note + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param creditNotes an array of Credit Notes containing credit note details to update (required) + * @return CreditNotes + * @throws ApiException if fails to make API call + */ + public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws ApiException { + return updateCreditNoteWithHttpInfo(xeroTenantId, creditNoteID, creditNotes).getData(); + } + + /** + * Allows you to update a specific credit note + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param creditNotes an array of Credit Notes containing credit note details to update (required) + * @return ApiResponse<CreditNotes> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateCreditNoteWithHttpInfo(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws ApiException { + Object localVarPostBody = creditNotes; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); + } + + // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling updateCreditNote"); + } + + // verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new ApiException(400, "Missing the required parameter 'creditNotes' when calling updateCreditNote"); + } + + // create path and map variables + String localVarPath = "/CreditNotes/{CreditNoteID}" + .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update Attachments on CreditNote by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param fileName Name of the file you are attaching to Credit Note (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws ApiException { + return updateCreditNoteAttachmentByFileNameWithHttpInfo(xeroTenantId, creditNoteID, fileName, body).getData(); + } + + /** + * Allows you to update Attachments on CreditNote by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param creditNoteID Unique identifier for a Credit Note (required) + * @param fileName Name of the file you are attaching to Credit Note (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateCreditNoteAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); + } + + // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}" + .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update a specific employee used in Xero payrun + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param employeeID Unique identifier for a Employee (required) + * @param employees (required) + * @return Employees + * @throws ApiException if fails to make API call + */ + public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees) throws ApiException { + return updateEmployeeWithHttpInfo(xeroTenantId, employeeID, employees).getData(); + } + + /** + * Allows you to update a specific employee used in Xero payrun + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param employeeID Unique identifier for a Employee (required) + * @param employees (required) + * @return ApiResponse<Employees> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateEmployeeWithHttpInfo(String xeroTenantId, UUID employeeID, Employees employees) throws ApiException { + Object localVarPostBody = employees; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateEmployee"); + } + + // verify the required parameter 'employeeID' is set + if (employeeID == null) { + throw new ApiException(400, "Missing the required parameter 'employeeID' when calling updateEmployee"); + } + + // verify the required parameter 'employees' is set + if (employees == null) { + throw new ApiException(400, "Missing the required parameter 'employees' when calling updateEmployee"); + } + + // create path and map variables + String localVarPath = "/Employees/{EmployeeID}" + .replaceAll("\\{" + "EmployeeID" + "\\}", apiClient.escapeString(employeeID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update specified expense claims + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param expenseClaimID Unique identifier for a ExpenseClaim (required) + * @param expenseClaims (required) + * @return ExpenseClaims + * @throws ApiException if fails to make API call + */ + public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws ApiException { + return updateExpenseClaimWithHttpInfo(xeroTenantId, expenseClaimID, expenseClaims).getData(); + } + + /** + * Allows you to update specified expense claims + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param expenseClaimID Unique identifier for a ExpenseClaim (required) + * @param expenseClaims (required) + * @return ApiResponse<ExpenseClaims> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateExpenseClaimWithHttpInfo(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws ApiException { + Object localVarPostBody = expenseClaims; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); + } + + // verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new ApiException(400, "Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); + } + + // verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new ApiException(400, "Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); + } + + // create path and map variables + String localVarPath = "/ExpenseClaims/{ExpenseClaimID}" + .replaceAll("\\{" + "ExpenseClaimID" + "\\}", apiClient.escapeString(expenseClaimID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update a specified sales invoices or purchase bills + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param invoices (required) + * @return Invoices + * @throws ApiException if fails to make API call + */ + public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices) throws ApiException { + return updateInvoiceWithHttpInfo(xeroTenantId, invoiceID, invoices).getData(); + } + + /** + * Allows you to update a specified sales invoices or purchase bills + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param invoices (required) + * @return ApiResponse<Invoices> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateInvoiceWithHttpInfo(String xeroTenantId, UUID invoiceID, Invoices invoices) throws ApiException { + Object localVarPostBody = invoices; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateInvoice"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling updateInvoice"); + } + + // verify the required parameter 'invoices' is set + if (invoices == null) { + throw new ApiException(400, "Missing the required parameter 'invoices' when calling updateInvoice"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update Attachment on invoices or purchase bills by it's filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param fileName Name of the file you are attaching (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws ApiException { + return updateInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, invoiceID, fileName, body).getData(); + } + + /** + * Allows you to update Attachment on invoices or purchase bills by it's filename + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param invoiceID Unique identifier for an Invoice (required) + * @param fileName Name of the file you are attaching (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Invoices/{InvoiceID}/Attachments/{FileName}" + .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to udpate a specified item + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param itemID Unique identifier for an Item (required) + * @param items (required) + * @return Items + * @throws ApiException if fails to make API call + */ + public Items updateItem(String xeroTenantId, UUID itemID, Items items) throws ApiException { + return updateItemWithHttpInfo(xeroTenantId, itemID, items).getData(); + } + + /** + * Allows you to udpate a specified item + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param itemID Unique identifier for an Item (required) + * @param items (required) + * @return ApiResponse<Items> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateItemWithHttpInfo(String xeroTenantId, UUID itemID, Items items) throws ApiException { + Object localVarPostBody = items; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateItem"); + } + + // verify the required parameter 'itemID' is set + if (itemID == null) { + throw new ApiException(400, "Missing the required parameter 'itemID' when calling updateItem"); + } + + // verify the required parameter 'items' is set + if (items == null) { + throw new ApiException(400, "Missing the required parameter 'items' when calling updateItem"); + } + + // create path and map variables + String localVarPath = "/Items/{ItemID}" + .replaceAll("\\{" + "ItemID" + "\\}", apiClient.escapeString(itemID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update a specified linked transactions (billable expenses) + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) + * @param linkedTransactions (required) + * @return LinkedTransactions + * @throws ApiException if fails to make API call + */ + public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws ApiException { + return updateLinkedTransactionWithHttpInfo(xeroTenantId, linkedTransactionID, linkedTransactions).getData(); + } + + /** + * Allows you to update a specified linked transactions (billable expenses) + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) + * @param linkedTransactions (required) + * @return ApiResponse<LinkedTransactions> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateLinkedTransactionWithHttpInfo(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws ApiException { + Object localVarPostBody = linkedTransactions; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); + } + + // verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new ApiException(400, "Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); + } + + // verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new ApiException(400, "Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); + } + + // create path and map variables + String localVarPath = "/LinkedTransactions/{LinkedTransactionID}" + .replaceAll("\\{" + "LinkedTransactionID" + "\\}", apiClient.escapeString(linkedTransactionID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update a specified manual journal + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @param manualJournals (required) + * @return ManualJournals + * @throws ApiException if fails to make API call + */ + public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws ApiException { + return updateManualJournalWithHttpInfo(xeroTenantId, manualJournalID, manualJournals).getData(); + } + + /** + * Allows you to update a specified manual journal + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @param manualJournals (required) + * @return ApiResponse<ManualJournals> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateManualJournalWithHttpInfo(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws ApiException { + Object localVarPostBody = manualJournals; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); + } + + // verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling updateManualJournal"); + } + + // verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new ApiException(400, "Missing the required parameter 'manualJournals' when calling updateManualJournal"); + } + + // create path and map variables + String localVarPath = "/ManualJournals/{ManualJournalID}" + .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update a specified Attachment on ManualJournal by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @param fileName The name of the file being attached to a ManualJournal (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws ApiException { + return updateManualJournalAttachmentByFileNameWithHttpInfo(xeroTenantId, manualJournalID, fileName, body).getData(); + } + + /** + * Allows you to update a specified Attachment on ManualJournal by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param manualJournalID Unique identifier for a ManualJournal (required) + * @param fileName The name of the file being attached to a ManualJournal (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateManualJournalAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); + } + + // verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}" + .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update a specified purchase order + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) + * @param purchaseOrders (required) + * @return PurchaseOrders + * @throws ApiException if fails to make API call + */ + public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws ApiException { + return updatePurchaseOrderWithHttpInfo(xeroTenantId, purchaseOrderID, purchaseOrders).getData(); + } + + /** + * Allows you to update a specified purchase order + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) + * @param purchaseOrders (required) + * @return ApiResponse<PurchaseOrders> + * @throws ApiException if fails to make API call + */ + public ApiResponse updatePurchaseOrderWithHttpInfo(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws ApiException { + Object localVarPostBody = purchaseOrders; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); + } + + // verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new ApiException(400, "Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); + } + + // verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new ApiException(400, "Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); + } + + // create path and map variables + String localVarPath = "/PurchaseOrders/{PurchaseOrderID}" + .replaceAll("\\{" + "PurchaseOrderID" + "\\}", apiClient.escapeString(purchaseOrderID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to retrieve a specified draft expense claim receipts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param receipts (required) + * @return Receipts + * @throws ApiException if fails to make API call + */ + public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts) throws ApiException { + return updateReceiptWithHttpInfo(xeroTenantId, receiptID, receipts).getData(); + } + + /** + * Allows you to retrieve a specified draft expense claim receipts + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param receipts (required) + * @return ApiResponse<Receipts> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateReceiptWithHttpInfo(String xeroTenantId, UUID receiptID, Receipts receipts) throws ApiException { + Object localVarPostBody = receipts; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateReceipt"); + } + + // verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new ApiException(400, "Missing the required parameter 'receiptID' when calling updateReceipt"); + } + + // verify the required parameter 'receipts' is set + if (receipts == null) { + throw new ApiException(400, "Missing the required parameter 'receipts' when calling updateReceipt"); + } + + // create path and map variables + String localVarPath = "/Receipts/{ReceiptID}" + .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update Attachment on expense claim receipts by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param fileName The name of the file being attached to the Receipt (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws ApiException { + return updateReceiptAttachmentByFileNameWithHttpInfo(xeroTenantId, receiptID, fileName, body).getData(); + } + + /** + * Allows you to update Attachment on expense claim receipts by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param receiptID Unique identifier for a Receipt (required) + * @param fileName The name of the file being attached to the Receipt (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateReceiptAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); + } + + // verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new ApiException(400, "Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/Receipts/{ReceiptID}/Attachments/{FileName}" + .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update specified attachment on repeating invoices by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @param fileName The name of the file being attached to a Repeating Invoice (required) + * @param body Byte array of file in body of request (required) + * @return Attachments + * @throws ApiException if fails to make API call + */ + public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws ApiException { + return updateRepeatingInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, repeatingInvoiceID, fileName, body).getData(); + } + + /** + * Allows you to update specified attachment on repeating invoices by file name + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) + * @param fileName The name of the file being attached to a Repeating Invoice (required) + * @param body Byte array of file in body of request (required) + * @return ApiResponse<Attachments> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateRepeatingInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'fileName' is set + if (fileName == null) { + throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); + } + + // create path and map variables + String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}" + .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())) + .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update Tax Rates + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param taxRates (required) + * @return TaxRates + * @throws ApiException if fails to make API call + */ + public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates) throws ApiException { + return updateTaxRateWithHttpInfo(xeroTenantId, taxRates).getData(); + } + + /** + * Allows you to update Tax Rates + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param taxRates (required) + * @return ApiResponse<TaxRates> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateTaxRateWithHttpInfo(String xeroTenantId, TaxRates taxRates) throws ApiException { + Object localVarPostBody = taxRates; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); + } + + // verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new ApiException(400, "Missing the required parameter 'taxRates' when calling updateTaxRate"); + } + + // create path and map variables + String localVarPath = "/TaxRates"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Allows you to update tracking categories + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategoryID Unique identifier for a TrackingCategory (required) + * @param trackingCategory (required) + * @return TrackingCategories + * @throws ApiException if fails to make API call + */ + public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws ApiException { + return updateTrackingCategoryWithHttpInfo(xeroTenantId, trackingCategoryID, trackingCategory).getData(); + } + + /** + * Allows you to update tracking categories + * + * @param xeroTenantId Xero identifier for Tenant (required) + * @param trackingCategoryID Unique identifier for a TrackingCategory (required) + * @param trackingCategory (required) + * @return ApiResponse<TrackingCategories> + * @throws ApiException if fails to make API call + */ + public ApiResponse updateTrackingCategoryWithHttpInfo(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws ApiException { + Object localVarPostBody = trackingCategory; + + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); + } + + // verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new ApiException(400, "Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); + } + + // verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new ApiException(400, "Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); + } + + // create path and map variables + String localVarPath = "/TrackingCategories/{TrackingCategoryID}" + .replaceAll("\\{" + "TrackingCategoryID" + "\\}", apiClient.escapeString(trackingCategoryID.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (xeroTenantId != null) + localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } } diff --git a/src/main/java/com/xero/example/RequestTokenServlet.java b/src/main/java/com/xero/example/Authorization.java old mode 100755 new mode 100644 similarity index 59% rename from src/main/java/com/xero/example/RequestTokenServlet.java rename to src/main/java/com/xero/example/Authorization.java index dfd78078..4dc4d3fc --- a/src/main/java/com/xero/example/RequestTokenServlet.java +++ b/src/main/java/com/xero/example/Authorization.java @@ -13,24 +13,32 @@ import com.github.scribejava.core.oauth.OAuth20Service; import com.xero.api.XeroApi20; -public class RequestTokenServlet extends HttpServlet { +/** + * Servlet implementation class Authorization + */ +@WebServlet("/Authorization") +public class Authorization extends HttpServlet { private static final long serialVersionUID = 1L; - //private Config config = null; + + /** + * @see HttpServlet#HttpServlet() + */ + public Authorization() { + super(); + } - public RequestTokenServlet() { - super(); - } - - @Override + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - final String clientId = "--your-client-id--"; - final String clientSecret = "--your-client-secret--"; + // Replace these with your client id and secret + final String clientId = "--your-clientid--"; + final String clientSecret = "--your-clientsecret--"; final String secretState = "secret" + new Random().nextInt(999_999); final OAuth20Service service = new ServiceBuilder(clientId) .apiSecret(clientSecret) .defaultScope("openid email profile offline_access accounting.settings accounting.transactions") // replace with desired scope - .callback("http://localhost/Callback") + .callback("http://localhost:8080/Callback") .build(XeroApi20.instance()); // Obtain the Authorization URL @@ -40,4 +48,13 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t response.sendRedirect(authorizationUrl); } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // TODO Auto-generated method stub + doGet(request, response); + } + } diff --git a/src/main/java/com/xero/example/Callback.java b/src/main/java/com/xero/example/Callback.java new file mode 100644 index 00000000..88369dd2 --- /dev/null +++ b/src/main/java/com/xero/example/Callback.java @@ -0,0 +1,110 @@ +package com.xero.example; + +import java.io.IOException; +import java.util.Random; +import java.util.concurrent.ExecutionException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.model.OAuthRequest; +import com.github.scribejava.core.model.Response; +import com.github.scribejava.core.model.Verb; +import com.github.scribejava.core.oauth.OAuth20Service; +import com.xero.api.XeroApi20; + + +/** + * Servlet implementation class Callback + */ +@WebServlet("/Callback") +public class Callback extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public Callback() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + final String clientId = "--your-clientid--"; + final String clientSecret = "--your-clientsecret--"; + final String secretState = "secret" + new Random().nextInt(999_999); + final OAuth20Service service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .defaultScope("openid email profile offline_access accounting.settings accounting.transactions") // replace with desired scope + .callback("http://localhost:8080/Callback") + .build(XeroApi20.instance()); + + String code = "123"; + if (request.getParameter("code") != null) { + code = request.getParameter("code"); + } + System.out.println("Trading the Authorization Code for an Access Token..."); + OAuth2AccessToken accessToken; + try { + accessToken = service.getAccessToken(code); + TokenStorage store = new TokenStorage(); + store.saveItem(response, "access_token", accessToken.getAccessToken()); + System.out.println("Got the Access Token!"); + + System.out.println("Refreshing the Access Token..."); + accessToken = service.refreshAccessToken(accessToken.getRefreshToken()); + store.saveItem(response, "access_token", accessToken.getAccessToken()); + + // GET CONNECTIONS + String requestUrl = "https://api.xero.com/connections"; + final OAuthRequest requestConn = new OAuthRequest(Verb.GET, requestUrl); + requestConn.addHeader("Accept", "application/json"); + service.signRequest(accessToken.getAccessToken(), requestConn); + final Response responseConn = service.execute(requestConn); + + JSONParser parser = new JSONParser(); + JSONArray jsonArray = (JSONArray) parser.parse(responseConn.getBody()); + JSONObject jsonObject = (JSONObject) jsonArray.get(0); + System.out.println(jsonObject.get("tenantId")); + store.saveItem(response, "tenant_id", jsonObject.get("tenantId").toString()); + + System.out.println(store.get(request, "access_token")); + System.out.println(store.get(request, "tenant_id")); + + // GET ORGANISATION + requestUrl = "https://api.xero.com/api.xro/2.0/Organisation"; + final OAuthRequest requestOrg = new OAuthRequest(Verb.GET, requestUrl); + requestOrg.addHeader("Accept", "application/json"); + requestOrg.addHeader("xero-tenant-id",jsonObject.get("tenantId").toString()); + service.signRequest(accessToken.getAccessToken(), requestOrg); + final Response responseOrg = service.execute(requestOrg); + System.out.println(responseOrg.getBody()); + + } catch (InterruptedException | ExecutionException | ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // TODO Auto-generated method stub + doGet(request, response); + } + +} diff --git a/src/main/java/com/xero/example/TokenStorage.java b/src/main/java/com/xero/example/TokenStorage.java old mode 100755 new mode 100644 index 2e872e01..0b6d9146 --- a/src/main/java/com/xero/example/TokenStorage.java +++ b/src/main/java/com/xero/example/TokenStorage.java @@ -15,7 +15,7 @@ public class TokenStorage public TokenStorage() { - + super(); } public String get(HttpServletRequest request,String key) @@ -45,7 +45,6 @@ public boolean tokenIsNull(String token) { public void clear(HttpServletResponse response) { HashMap map = new HashMap(); - map.put("tempToken",""); map.put("tempTokenSecret",""); map.put("sessionHandle",""); @@ -53,12 +52,18 @@ public void clear(HttpServletResponse response) save(response,map); } + + public void saveItem(HttpServletResponse response,String key, String value) + { + Cookie t = new Cookie(key,value); + response.addCookie(t); + } - public void save(HttpServletResponse response, HashMap map) + public void save(HttpServletResponse response,HashMap map) { Set> set = map.entrySet(); Iterator> iterator = set.iterator(); - + while(iterator.hasNext()) { Map.Entry mentry = iterator.next(); String key = (String)mentry.getKey(); @@ -68,4 +73,4 @@ public void save(HttpServletResponse response, HashMap map) response.addCookie(t); } } -} +} \ No newline at end of file From e72b4e6c92ea6939e091bbf6ef5f07d489fa458f Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Mon, 10 Jun 2019 10:28:39 -0700 Subject: [PATCH 03/76] Google API Client --- pom.xml | 77 +- src/main/java/com/xero/api/ApiClient.java | 833 +- src/main/java/com/xero/api/ApiException.java | 91 - src/main/java/com/xero/api/ApiResponse.java | 59 - src/main/java/com/xero/api/Configuration.java | 39 - src/main/java/com/xero/api/JSON.java | 44 - src/main/java/com/xero/api/JSONUtils.java | 19 - src/main/java/com/xero/api/Pair.java | 61 - .../java/com/xero/api/auth/ApiKeyAuth.java | 75 - .../com/xero/api/auth/Authentication.java | 29 - .../java/com/xero/api/auth/HttpBasicAuth.java | 58 - .../com/xero/api/auth/HttpBearerAuth.java | 60 - src/main/java/com/xero/api/auth/OAuth.java | 39 - .../java/com/xero/api/auth/OAuthFlow.java | 18 - .../com/xero/api/client/AccountingApi.java | 34142 ++++++++++------ .../java/com/xero/models/assets/Asset.java | 408 - .../com/xero/models/assets/AssetType.java | 231 - .../java/com/xero/models/assets/Assets.java | 126 - .../models/assets/BookDepreciationDetail.java | 230 - .../assets/BookDepreciationSetting.java | 298 - .../com/xero/models/assets/Pagination.java | 160 - .../java/com/xero/models/assets/Setting.java | 254 - .../bankfeeds/CreditDebitIndicator.java | 57 - .../com/xero/models/bankfeeds/EndBalance.java | 115 - .../java/com/xero/models/bankfeeds/Error.java | 208 - .../xero/models/bankfeeds/FeedConnection.java | 369 - .../models/bankfeeds/FeedConnections.java | 126 - .../com/xero/models/bankfeeds/Pagination.java | 160 - .../xero/models/bankfeeds/StartBalance.java | 115 - .../com/xero/models/bankfeeds/Statement.java | 350 - .../xero/models/bankfeeds/StatementLine.java | 254 - .../xero/models/bankfeeds/StatementLines.java | 66 - .../com/xero/models/bankfeeds/Statements.java | 126 - .../com/xero/models/files/Association.java | 169 - .../com/xero/models/files/FileObject.java | 265 - .../xero/models/files/FileResponse204.java | 94 - .../java/com/xero/models/files/Files.java | 177 - .../java/com/xero/models/files/Folder.java | 191 - .../java/com/xero/models/files/Folders.java | 105 - .../com/xero/models/files/ObjectGroup.java | 76 - .../com/xero/models/files/ObjectType.java | 120 - src/main/java/com/xero/models/files/User.java | 283 - 42 files changed, 21520 insertions(+), 19257 deletions(-) delete mode 100644 src/main/java/com/xero/api/ApiException.java delete mode 100644 src/main/java/com/xero/api/ApiResponse.java delete mode 100644 src/main/java/com/xero/api/Configuration.java delete mode 100644 src/main/java/com/xero/api/JSON.java delete mode 100644 src/main/java/com/xero/api/JSONUtils.java delete mode 100644 src/main/java/com/xero/api/Pair.java delete mode 100644 src/main/java/com/xero/api/auth/ApiKeyAuth.java delete mode 100644 src/main/java/com/xero/api/auth/Authentication.java delete mode 100644 src/main/java/com/xero/api/auth/HttpBasicAuth.java delete mode 100644 src/main/java/com/xero/api/auth/HttpBearerAuth.java delete mode 100644 src/main/java/com/xero/api/auth/OAuth.java delete mode 100644 src/main/java/com/xero/api/auth/OAuthFlow.java delete mode 100644 src/main/java/com/xero/models/assets/Asset.java delete mode 100644 src/main/java/com/xero/models/assets/AssetType.java delete mode 100644 src/main/java/com/xero/models/assets/Assets.java delete mode 100644 src/main/java/com/xero/models/assets/BookDepreciationDetail.java delete mode 100644 src/main/java/com/xero/models/assets/BookDepreciationSetting.java delete mode 100644 src/main/java/com/xero/models/assets/Pagination.java delete mode 100644 src/main/java/com/xero/models/assets/Setting.java delete mode 100644 src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java delete mode 100644 src/main/java/com/xero/models/bankfeeds/EndBalance.java delete mode 100644 src/main/java/com/xero/models/bankfeeds/Error.java delete mode 100644 src/main/java/com/xero/models/bankfeeds/FeedConnection.java delete mode 100644 src/main/java/com/xero/models/bankfeeds/FeedConnections.java delete mode 100644 src/main/java/com/xero/models/bankfeeds/Pagination.java delete mode 100644 src/main/java/com/xero/models/bankfeeds/StartBalance.java delete mode 100644 src/main/java/com/xero/models/bankfeeds/Statement.java delete mode 100644 src/main/java/com/xero/models/bankfeeds/StatementLine.java delete mode 100644 src/main/java/com/xero/models/bankfeeds/StatementLines.java delete mode 100644 src/main/java/com/xero/models/bankfeeds/Statements.java delete mode 100644 src/main/java/com/xero/models/files/Association.java delete mode 100644 src/main/java/com/xero/models/files/FileObject.java delete mode 100644 src/main/java/com/xero/models/files/FileResponse204.java delete mode 100644 src/main/java/com/xero/models/files/Files.java delete mode 100644 src/main/java/com/xero/models/files/Folder.java delete mode 100644 src/main/java/com/xero/models/files/Folders.java delete mode 100644 src/main/java/com/xero/models/files/ObjectGroup.java delete mode 100644 src/main/java/com/xero/models/files/ObjectType.java delete mode 100644 src/main/java/com/xero/models/files/User.java diff --git a/pom.xml b/pom.xml index 85fb37a8..e1c692d8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.xeroapi xero-java jar - 3.0.0-beta-1 + 3.0.0-beta-5 Xero-Java SDK This is the official Java SDK for Xero API https://github.com/XeroAPI/Xero-Java @@ -153,6 +153,76 @@ migbase64 2.2 + + + + + io.github.openfeign + feign-core + ${feign-version} + + + io.github.openfeign + feign-jackson + ${feign-version} + + + io.github.openfeign + feign-slf4j + ${feign-version} + + + io.github.openfeign.form + feign-form + ${feign-form-version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + + com.github.joschi.jackson + jackson-datatype-threetenbp + ${jackson-threetenbp-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + ${oltu-version} + + + + + junit + junit + ${junit-version} + test + + + com.squareup.okhttp3 + mockwebserver + 3.6.0 + test + + + org.assertj + assertj-core + 1.7.1 + test + Xero-Java-SDK @@ -325,5 +395,10 @@ 2.9.9 2.6.4 1.0.0 + + 9.7.0 + 2.1.0 + 2.9.9 + 1.0.1 diff --git a/src/main/java/com/xero/api/ApiClient.java b/src/main/java/com/xero/api/ApiClient.java index 4f8d8a86..fb9eca0f 100644 --- a/src/main/java/com/xero/api/ApiClient.java +++ b/src/main/java/com/xero/api/ApiClient.java @@ -1,795 +1,94 @@ package com.xero.api; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.Form; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; - -import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.client.ClientProperties; -import org.glassfish.jersey.client.HttpUrlConnectorProvider; -import org.glassfish.jersey.jackson.JacksonFeature; -import org.glassfish.jersey.media.multipart.FormDataBodyPart; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; -import org.glassfish.jersey.media.multipart.MultiPart; -import org.glassfish.jersey.media.multipart.MultiPartFeature; - +import com.xero.api.client.*; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; +import org.threeten.bp.*; +import com.google.api.client.googleapis.util.Utils; +import com.google.api.client.http.AbstractHttpContent; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpRequestInitializer; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.json.Json; import java.io.IOException; -import java.io.InputStream; - -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import org.glassfish.jersey.logging.LoggingFeature; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.Map.Entry; -import java.util.HashMap; -import java.util.List; -import java.util.ArrayList; -import java.util.Date; -import java.util.TimeZone; - -import java.net.URLEncoder; - -import java.io.File; -import java.io.UnsupportedEncodingException; - -import java.text.DateFormat; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import com.xero.api.auth.Authentication; -import com.xero.api.auth.HttpBasicAuth; -import com.xero.api.auth.HttpBearerAuth; -import com.xero.api.auth.ApiKeyAuth; -import com.xero.api.auth.OAuth; +import java.io.OutputStream; public class ApiClient { - protected Map defaultHeaderMap = new HashMap(); - protected String basePath = "https://api.xero.com/api.xro/2.0"; - protected boolean debugging = false; - protected int connectionTimeout = 0; - private int readTimeout = 0; - - protected Client httpClient; - protected JSON json; - protected String tempFolderPath = null; - - protected Map authentications; - - protected DateFormat dateFormat; - - public ApiClient() { - json = new JSON(); - httpClient = buildHttpClient(debugging); - - this.dateFormat = new RFC3339DateFormat(); - - // Set default User-Agent. - setUserAgent("OpenAPI-Generator/2.0.0/java"); - - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap(); - authentications.put("OAuth2", new OAuth()); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - /** - * Gets the JSON instance to do JSON serialization and deserialization. - * @return JSON - */ - public JSON getJSON() { - return json; - } - - public Client getHttpClient() { - return httpClient; - } - - public ApiClient setHttpClient(Client httpClient) { - this.httpClient = httpClient; - return this; - } - - public String getBasePath() { - return basePath; - } - - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - return this; - } - - /** - * Get authentications (key: authentication name, value: authentication). - * @return Map of authentication object - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set username for the first HTTP basic authentication. - * @param username Username - */ - public void setUsername(String username) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(username); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set password for the first HTTP basic authentication. - * @param password Password - */ - public void setPassword(String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setPassword(password); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set API key value for the first API key authentication. - * @param apiKey API key - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - * @param apiKeyPrefix API key prefix - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set bearer token for the first Bearer authentication. - * @param bearerToken Bearer token - */ - public void setBearerToken(String bearerToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBearerAuth) { - ((HttpBearerAuth) auth).setBearerToken(bearerToken); - return; - } - } - throw new RuntimeException("No Bearer authentication configured!"); - } - - /** - * Helper method to set access token for the first OAuth2 authentication. - * @param accessToken Access token - */ - public void setAccessToken(String accessToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(accessToken); - return; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - * @param userAgent Http user agent - * @return API client - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return API client - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * @return True if debugging is switched on - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return API client - */ - public ApiClient setDebugging(boolean debugging) { - this.debugging = debugging; - // Rebuild HTTP Client according to the new "debugging" value. - this.httpClient = buildHttpClient(debugging); - return this; - } - - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default tempopary folder. - * - * @return Temp folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - /** - * Set temp folder path - * @param tempFolderPath Temp folder path - * @return API client - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Connect timeout (in milliseconds). - * @return Connection timeout - */ - public int getConnectTimeout() { - return connectionTimeout; - } - - /** - * Set the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * @param connectionTimeout Connection timeout in milliseconds - * @return API client - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - this.connectionTimeout = connectionTimeout; - httpClient.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); - return this; - } - - /** - * read timeout (in milliseconds). - * @return Read timeout - */ - public int getReadTimeout() { - return readTimeout; - } - - /** - * Set the read timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * @param readTimeout Read timeout in milliseconds - * @return API client - */ - public ApiClient setReadTimeout(int readTimeout) { - this.readTimeout = readTimeout; - httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout); - return this; - } - - /** - * Get the date format used to parse/format date parameters. - * @return Date format - */ - public DateFormat getDateFormat() { - return dateFormat; - } - - /** - * Set the date format used to parse/format date parameters. - * @param dateFormat Date format - * @return API client - */ - public ApiClient setDateFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - // also set the date format for model (de)serialization with Date properties - this.json.setDateFormat((DateFormat) dateFormat.clone()); - return this; - } - - /** - * Parse the given string into Date object. - * @param str String - * @return Date - */ - public Date parseDate(String str) { - try { - return dateFormat.parse(str); - } catch (java.text.ParseException e) { - throw new RuntimeException(e); - } - } - - /** - * Format the given Date object into string. - * @param date Date - * @return Date in string format - */ - public String formatDate(Date date) { - return dateFormat.format(date); - } - - /** - * Format the given parameter object into string. - * @param param Object - * @return Object in string format - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date) { - return formatDate((Date) param); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for(Object o : (Collection)param) { - if(b.length() > 0) { - b.append(','); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /* - * Format to {@code Pair} objects. - * @param collectionFormat Collection format - * @param name Name - * @param value Value - * @return List of pairs - */ - public List parameterToPairs(String collectionFormat, String name, Object value){ - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null) return params; - - Collection valueCollection; - if (value instanceof Collection) { - valueCollection = (Collection) value; - } else { - params.add(new Pair(name, parameterToString(value))); - return params; - } - - if (valueCollection.isEmpty()){ - return params; - } - - // get the collection format (default: csv) - String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); - - // create the params based on the collection format - if ("multi".equals(format)) { - for (Object item : valueCollection) { - params.add(new Pair(name, parameterToString(item))); - } - - return params; - } - - String delimiter = ","; - - if ("csv".equals(format)) { - delimiter = ","; - } else if ("ssv".equals(format)) { - delimiter = " "; - } else if ("tsv".equals(format)) { - delimiter = "\t"; - } else if ("pipes".equals(format)) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder() ; - for (Object item : valueCollection) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - params.add(new Pair(name, sb.substring(1))); - - return params; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * "* / *" is also default to JSON - * @param mime MIME - * @return True if the MIME type is JSON - */ - public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { - return "application/json"; - } - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - * @param str String - * @return Escaped string - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } + private final String basePath; + private final HttpRequestFactory httpRequestFactory; + private final ObjectMapper objectMapper; - /** - * Serialize the given Java object into string entity according the given - * Content-Type (only JSON is supported for now). - * @param obj Object - * @param formParams Form parameters - * @param contentType Context type - * @return Entity - * @throws ApiException API exception - */ - public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { - Entity entity; - if (contentType.startsWith("multipart/form-data")) { - MultiPart multiPart = new MultiPart(); - for (Entry param: formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) - .fileName(file.getName()).size(file.length()).build(); - multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); - } else { - FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); - multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); - } - } - entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); - } else if (contentType.startsWith("application/x-www-form-urlencoded")) { - Form form = new Form(); - for (Entry param: formParams.entrySet()) { - form.param(param.getKey(), parameterToString(param.getValue())); - } - entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); - } else { - // We let jersey handle the serialization - entity = Entity.entity(obj, contentType); - } - return entity; - } + private static final String defaultBasePath = "https://api.xero.com/api.xro/2.0"; - /** - * Deserialize response body to Java object according to the Content-Type. - * @param Type - * @param response Response - * @param returnType Return type - * @return Deserialize object - * @throws ApiException API exception - */ - @SuppressWarnings("unchecked") - public T deserialize(Response response, GenericType returnType) throws ApiException { - if (response == null || returnType == null) { - return null; + // A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults. + private static ObjectMapper createDefaultObjectMapper() { + ObjectMapper objectMapper = new ObjectMapper() + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .setDateFormat(new RFC3339DateFormat()) + .setSerializationInclusion(Include.NON_NULL); + objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); + + ThreeTenModule module = new ThreeTenModule(); + module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); + module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); + module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); + objectMapper.registerModule(module); + return objectMapper; } - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - return (T) response.readEntity(byte[].class); - } else if (returnType.getRawType() == File.class) { - // Handle file downloading. - T file = (T) downloadFileFromResponse(response); - return file; + public ApiClient() { + this(null, null, null, null,null); } - String contentType = null; - List contentTypes = response.getHeaders().get("Content-Type"); - if (contentTypes != null && !contentTypes.isEmpty()) - contentType = String.valueOf(contentTypes.get(0)); - - return response.readEntity(returnType); - } - - /** - * Download file from the given response. - * @param response Response - * @return File - * @throws ApiException If fail to read file content from response and write to disk - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING); - return file; - } catch (IOException e) { - throw new ApiException(e); + public ApiClient( + String basePath, + HttpTransport httpTransport, + HttpRequestInitializer initializer, + ObjectMapper objectMapper + ) { + this.basePath = basePath == null ? defaultBasePath : ( + basePath.endsWith("/") ? basePath.substring(0, basePath.length() - 1) : basePath + ); + this.httpRequestFactory = (reqFactory != null ? reqFactory : (httpTransport == null ? Utils.getDefaultTransport() : httpTransport).createRequestFactory(initializer) ); + this.objectMapper = (objectMapper == null ? createDefaultObjectMapper() : objectMapper); } - } - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) - filename = matcher.group(1); + public HttpRequestFactory getHttpRequestFactory() { + return httpRequestFactory; } - String prefix; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf('.'); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // File.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; + public String getBasePath() { + return basePath; } - if (tempFolderPath == null) - return File.createTempFile(prefix, suffix); - else - return File.createTempFile(prefix, suffix, new File(tempFolderPath)); - } - - /** - * Invoke API by sending HTTP request with the given options. - * - * @param Type - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param formParams The form parameters - * @param accept The request's Accept header - * @param contentType The request's Content-Type header - * @param authNames The authentications to apply - * @param returnType The return type into which to deserialize the response - * @return The response body in type of string - * @throws ApiException API exception - */ - public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams); - - // Not using `.target(this.basePath).path(path)` below, - // to support (constant) query string in `path`, e.g. "/posts?draft=1" - WebTarget target = httpClient.target(this.basePath + path); - - if (queryParams != null) { - for (Pair queryParam : queryParams) { - if (queryParam.getValue() != null) { - target = target.queryParam(queryParam.getName(), queryParam.getValue()); - } - } + public ObjectMapper getObjectMapper() { + return objectMapper; } - Invocation.Builder invocationBuilder = target.request().accept(accept); + public class JacksonJsonHttpContent extends AbstractHttpContent { + /* A POJO that can be serialized with a com.fasterxml Jackson ObjectMapper */ + private final Object data; - for (Entry entry : headerParams.entrySet()) { - String value = entry.getValue(); - if (value != null) { - invocationBuilder = invocationBuilder.header(entry.getKey(), value); - } - } - - for (Entry entry : defaultHeaderMap.entrySet()) { - String key = entry.getKey(); - if (!headerParams.containsKey(key)) { - String value = entry.getValue(); - if (value != null) { - invocationBuilder = invocationBuilder.header(key, value); + public JacksonJsonHttpContent(Object data) { + super(Json.MEDIA_TYPE); + this.data = data; } - } - } - - Entity entity = serialize(body, formParams, contentType); - - Response response = null; - - try { - if ("GET".equals(method)) { - response = invocationBuilder.get(); - } else if ("POST".equals(method)) { - response = invocationBuilder.post(entity); - } else if ("PUT".equals(method)) { - response = invocationBuilder.put(entity); - } else if ("DELETE".equals(method)) { - response = invocationBuilder.delete(); - } else if ("PATCH".equals(method)) { - response = invocationBuilder.method("PATCH", entity); - } else if ("HEAD".equals(method)) { - response = invocationBuilder.head(); - } else { - throw new ApiException(500, "unknown method type " + method); - } - int statusCode = response.getStatusInfo().getStatusCode(); - Map> responseHeaders = buildResponseHeaders(response); - - if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { - return new ApiResponse<>(statusCode, responseHeaders); - } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { - if (returnType == null) - return new ApiResponse<>(statusCode, responseHeaders); - else - return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType)); - } else { - String message = "error"; - String respBody = null; - if (response.hasEntity()) { - try { - respBody = String.valueOf(response.readEntity(String.class)); - message = respBody; - } catch (RuntimeException e) { - // e.printStackTrace(); - } + @Override + public void writeTo(OutputStream out) throws IOException { + objectMapper.writeValue(out, data); } - throw new ApiException( - response.getStatus(), - message, - buildResponseHeaders(response), - respBody); - } - } finally { - try { - response.close(); - } catch (Exception e) { - // it's not critical, since the response object is local in method invokeAPI; that's fine, just continue - } - } - } - - /** - * Build the Client used to make HTTP requests. - * @param debugging Debug setting - * @return Client - */ - protected Client buildHttpClient(boolean debugging) { - final ClientConfig clientConfig = new ClientConfig(); - clientConfig.register(MultiPartFeature.class); - clientConfig.register(json); - clientConfig.register(JacksonFeature.class); - clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); - if (debugging) { - clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); - clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); - // Set logger to ALL - java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL); - } - performAdditionalClientConfiguration(clientConfig); - return ClientBuilder.newClient(clientConfig); - } - - protected void performAdditionalClientConfiguration(ClientConfig clientConfig) { - // No-op extension point - } - - protected Map> buildResponseHeaders(Response response) { - Map> responseHeaders = new HashMap>(); - for (Entry> entry: response.getHeaders().entrySet()) { - List values = entry.getValue(); - List headers = new ArrayList(); - for (Object o : values) { - headers.add(String.valueOf(o)); - } - responseHeaders.put(entry.getKey(), headers); } - return responseHeaders; - } - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - */ - protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams); + // Builder pattern to get API instances for this client. + + public AccountingApi accountingApi() { + return new AccountingApi(this); } - } + } diff --git a/src/main/java/com/xero/api/ApiException.java b/src/main/java/com/xero/api/ApiException.java deleted file mode 100644 index d60740ce..00000000 --- a/src/main/java/com/xero/api/ApiException.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Accounting API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.0.0 - * Contact: api@xero.com - * - * 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; - -import java.util.Map; -import java.util.List; - - -public class ApiException extends Exception { - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; - - public ApiException() {} - - public ApiException(Throwable throwable) { - super(throwable); - } - - public ApiException(String message) { - super(message); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } - - public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(int code, String message) { - super(message); - this.code = code; - } - - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() { - return responseBody; - } -} diff --git a/src/main/java/com/xero/api/ApiResponse.java b/src/main/java/com/xero/api/ApiResponse.java deleted file mode 100644 index 534c5210..00000000 --- a/src/main/java/com/xero/api/ApiResponse.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Accounting API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.0.0 - * Contact: api@xero.com - * - * 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; - -import java.util.List; -import java.util.Map; - -/** - * API response returned by API call. - * - * @param The type of data that is deserialized from response body - */ -public class ApiResponse { - private final int statusCode; - private final Map> headers; - private final T data; - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map> headers) { - this(statusCode, headers, null); - } - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse(int statusCode, Map> headers, T data) { - this.statusCode = statusCode; - this.headers = headers; - this.data = data; - } - - public int getStatusCode() { - return statusCode; - } - - public Map> getHeaders() { - return headers; - } - - public T getData() { - return data; - } -} diff --git a/src/main/java/com/xero/api/Configuration.java b/src/main/java/com/xero/api/Configuration.java deleted file mode 100644 index 6b12e032..00000000 --- a/src/main/java/com/xero/api/Configuration.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Accounting API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.0.0 - * Contact: api@xero.com - * - * 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; - - -public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); - - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } - - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } -} diff --git a/src/main/java/com/xero/api/JSON.java b/src/main/java/com/xero/api/JSON.java deleted file mode 100644 index 4947fc09..00000000 --- a/src/main/java/com/xero/api/JSON.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.xero.api; - -import org.threeten.bp.*; -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; - -import java.text.DateFormat; - -import javax.ws.rs.ext.ContextResolver; - - -public class JSON implements ContextResolver { - private ObjectMapper mapper; - - public JSON() { - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); - mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); - mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - mapper.setDateFormat(new RFC3339DateFormat()); - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - mapper.registerModule(module); - } - - /** - * Set the date format for JSON (de)serialization with Date properties. - * @param dateFormat Date format - */ - public void setDateFormat(DateFormat dateFormat) { - mapper.setDateFormat(dateFormat); - } - - @Override - public ObjectMapper getContext(Class type) { - return mapper; - } -} diff --git a/src/main/java/com/xero/api/JSONUtils.java b/src/main/java/com/xero/api/JSONUtils.java deleted file mode 100644 index 931b9f1c..00000000 --- a/src/main/java/com/xero/api/JSONUtils.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.xero.api; - -import java.io.IOException; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public final class JSONUtils { - private JSONUtils(){} - - public static boolean isJSONValid(String jsonInString ) { - try { - final ObjectMapper mapper = new ObjectMapper(); - mapper.readTree(jsonInString); - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/src/main/java/com/xero/api/Pair.java b/src/main/java/com/xero/api/Pair.java deleted file mode 100644 index e2949056..00000000 --- a/src/main/java/com/xero/api/Pair.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Accounting API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.0.0 - * Contact: api@xero.com - * - * 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; - - -public class Pair { - private String name = ""; - private String value = ""; - - public Pair (String name, String value) { - setName(name); - setValue(value); - } - - private void setName(String name) { - if (!isValidString(name)) { - return; - } - - this.name = name; - } - - private void setValue(String value) { - if (!isValidString(value)) { - return; - } - - this.value = value; - } - - public String getName() { - return this.name; - } - - public String getValue() { - return this.value; - } - - private boolean isValidString(String arg) { - if (arg == null) { - return false; - } - - if (arg.trim().isEmpty()) { - return false; - } - - return true; - } -} diff --git a/src/main/java/com/xero/api/auth/ApiKeyAuth.java b/src/main/java/com/xero/api/auth/ApiKeyAuth.java deleted file mode 100644 index 17ed77ec..00000000 --- a/src/main/java/com/xero/api/auth/ApiKeyAuth.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Accounting API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.0.0 - * Contact: api@xero.com - * - * 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.auth; - -import com.xero.api.Pair; - -import java.util.Map; -import java.util.List; - - -public class ApiKeyAuth implements Authentication { - private final String location; - private final String paramName; - - private String apiKey; - private String apiKeyPrefix; - - public ApiKeyAuth(String location, String paramName) { - this.location = location; - this.paramName = paramName; - } - - public String getLocation() { - return location; - } - - public String getParamName() { - return paramName; - } - - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - public String getApiKeyPrefix() { - return apiKeyPrefix; - } - - public void setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if (apiKey == null) { - return; - } - String value; - if (apiKeyPrefix != null) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; - } - if ("query".equals(location)) { - queryParams.add(new Pair(paramName, value)); - } else if ("header".equals(location)) { - headerParams.put(paramName, value); - } - } -} diff --git a/src/main/java/com/xero/api/auth/Authentication.java b/src/main/java/com/xero/api/auth/Authentication.java deleted file mode 100644 index 72e83f97..00000000 --- a/src/main/java/com/xero/api/auth/Authentication.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Accounting API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.0.0 - * Contact: api@xero.com - * - * 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.auth; - -import com.xero.api.Pair; - -import java.util.Map; -import java.util.List; - -public interface Authentication { - /** - * Apply authentication settings to header and query params. - * - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - */ - void applyToParams(List queryParams, Map headerParams); -} diff --git a/src/main/java/com/xero/api/auth/HttpBasicAuth.java b/src/main/java/com/xero/api/auth/HttpBasicAuth.java deleted file mode 100644 index 6fc66e5f..00000000 --- a/src/main/java/com/xero/api/auth/HttpBasicAuth.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Accounting API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.0.0 - * Contact: api@xero.com - * - * 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.auth; - -import com.xero.api.Pair; - -import com.migcomponents.migbase64.Base64; - -import java.util.Map; -import java.util.List; - -import java.io.UnsupportedEncodingException; - - -public class HttpBasicAuth implements Authentication { - private String username; - private String password; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if (username == null && password == null) { - return; - } - String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - try { - headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/xero/api/auth/HttpBearerAuth.java b/src/main/java/com/xero/api/auth/HttpBearerAuth.java deleted file mode 100644 index 2b7ab542..00000000 --- a/src/main/java/com/xero/api/auth/HttpBearerAuth.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Accounting API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.0.0 - * Contact: api@xero.com - * - * 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.auth; - -import com.xero.api.Pair; - -import java.util.Map; -import java.util.List; - - -public class HttpBearerAuth implements Authentication { - private final String scheme; - private String bearerToken; - - public HttpBearerAuth(String scheme) { - this.scheme = scheme; - } - - /** - * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. - * - * @return The bearer token - */ - public String getBearerToken() { - return bearerToken; - } - - /** - * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. - * - * @param bearerToken The bearer token to send in the Authorization header - */ - public void setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if(bearerToken == null) { - return; - } - - headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); - } - - private static String upperCaseBearer(String scheme) { - return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; - } -} diff --git a/src/main/java/com/xero/api/auth/OAuth.java b/src/main/java/com/xero/api/auth/OAuth.java deleted file mode 100644 index f89c7a54..00000000 --- a/src/main/java/com/xero/api/auth/OAuth.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Accounting API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.0.0 - * Contact: api@xero.com - * - * 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.auth; - -import com.xero.api.Pair; - -import java.util.Map; -import java.util.List; - - -public class OAuth implements Authentication { - private String accessToken; - - public String getAccessToken() { - return accessToken; - } - - public void setAccessToken(String accessToken) { - this.accessToken = accessToken; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if (accessToken != null) { - headerParams.put("Authorization", "Bearer " + accessToken); - } - } -} diff --git a/src/main/java/com/xero/api/auth/OAuthFlow.java b/src/main/java/com/xero/api/auth/OAuthFlow.java deleted file mode 100644 index 3a52c98d..00000000 --- a/src/main/java/com/xero/api/auth/OAuthFlow.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Accounting API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.0.0 - * Contact: api@xero.com - * - * 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.auth; - -public enum OAuthFlow { - accessCode, implicit, password, application -} diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index d8cbfbf1..5f81c93b 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -1,12 +1,6 @@ package com.xero.api.client; -import com.xero.api.ApiException; import com.xero.api.ApiClient; -import com.xero.api.ApiResponse; -import com.xero.api.Configuration; -import com.xero.api.Pair; - -import javax.ws.rs.core.GenericType; import com.xero.models.accounting.Account; import com.xero.models.accounting.Accounts; @@ -57,12777 +51,21397 @@ import java.util.UUID; import com.xero.models.accounting.Users; -import java.util.ArrayList; +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.GenericUrl; +import com.google.api.client.http.HttpContent; +import com.google.api.client.http.InputStreamContent; +import com.google.api.client.http.HttpMethods; +import com.google.api.client.http.HttpResponse; +import com.google.api.client.json.Json; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.util.Collection; import java.util.HashMap; -import java.util.List; import java.util.Map; +import java.util.List; +import java.util.ArrayList; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; -public class AccountingApi { - private ApiClient apiClient; - - public AccountingApi() { - this(Configuration.getDefaultApiClient()); - } - - public AccountingApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Allows you to create a new chart of accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param account Request of type Account (required) - * @return Accounts - * @throws ApiException if fails to make API call - */ - public Accounts createAccount(String xeroTenantId, Account account) throws ApiException { - return createAccountWithHttpInfo(xeroTenantId, account).getData(); - } - - /** - * Allows you to create a new chart of accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param account Request of type Account (required) - * @return ApiResponse<Accounts> - * @throws ApiException if fails to make API call - */ - public ApiResponse createAccountWithHttpInfo(String xeroTenantId, Account account) throws ApiException { - Object localVarPostBody = account; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createAccount"); - } - - // verify the required parameter 'account' is set - if (account == null) { - throw new ApiException(400, "Missing the required parameter 'account' when calling createAccount"); - } - - // create path and map variables - String localVarPath = "/Accounts"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create Attachment on Account - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for Account object (required) - * @param fileName Name of the attachment (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws ApiException { - return createAccountAttachmentByFileNameWithHttpInfo(xeroTenantId, accountID, fileName, body).getData(); - } - - /** - * Allows you to create Attachment on Account - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for Account object (required) - * @param fileName Name of the attachment (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse createAccountAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); - } - - // verify the required parameter 'accountID' is set - if (accountID == null) { - throw new ApiException(400, "Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Accounts/{AccountID}/Attachments/{FileName}" - .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create a spend or receive money transaction - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactions (required) - * @param summarizeErrors response format that shows validation errors for each bank transaction (optional) - * @return BankTransactions - * @throws ApiException if fails to make API call - */ - public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws ApiException { - return createBankTransactionWithHttpInfo(xeroTenantId, bankTransactions, summarizeErrors).getData(); - } - - /** - * Allows you to create a spend or receive money transaction - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactions (required) - * @param summarizeErrors response format that shows validation errors for each bank transaction (optional) - * @return ApiResponse<BankTransactions> - * @throws ApiException if fails to make API call - */ - public ApiResponse createBankTransactionWithHttpInfo(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws ApiException { - Object localVarPostBody = bankTransactions; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); - } - - // verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransactions' when calling createBankTransaction"); - } - - // create path and map variables - String localVarPath = "/BankTransactions"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "SummarizeErrors", summarizeErrors)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to createa an Attachment on BankTransaction by Filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param fileName The name of the file being attached (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws ApiException { - return createBankTransactionAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransactionID, fileName, body).getData(); - } - - /** - * Allows you to createa an Attachment on BankTransaction by Filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param fileName The name of the file being attached (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse createBankTransactionAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); - } - - // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}" - .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create history record for a bank transactions - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws ApiException { - return createBankTransactionHistoryRecordWithHttpInfo(xeroTenantId, bankTransactionID, historyRecords).getData(); - } - - /** - * Allows you to create history record for a bank transactions - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createBankTransactionHistoryRecordWithHttpInfo(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); - } - - // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); - } - - // create path and map variables - String localVarPath = "/BankTransactions/{BankTransactionID}/History" - .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create a bank transfers - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransfers (required) - * @return BankTransfers - * @throws ApiException if fails to make API call - */ - public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers) throws ApiException { - return createBankTransferWithHttpInfo(xeroTenantId, bankTransfers).getData(); - } - - /** - * Allows you to create a bank transfers - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransfers (required) - * @return ApiResponse<BankTransfers> - * @throws ApiException if fails to make API call - */ - public ApiResponse createBankTransferWithHttpInfo(String xeroTenantId, BankTransfers bankTransfers) throws ApiException { - Object localVarPostBody = bankTransfers; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); - } - - // verify the required parameter 'bankTransfers' is set - if (bankTransfers == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransfers' when calling createBankTransfer"); - } - - // create path and map variables - String localVarPath = "/BankTransfers"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @param fileName The name of the file being attached to a Bank Transfer (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws ApiException { - return createBankTransferAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransferID, fileName, body).getData(); - } - - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @param fileName The name of the file being attached to a Bank Transfer (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse createBankTransferAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); - } - - // verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}" - .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws ApiException { - return createBankTransferHistoryRecordWithHttpInfo(xeroTenantId, bankTransferID, historyRecords).getData(); - } - - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createBankTransferHistoryRecordWithHttpInfo(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); - } - - // verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); - } - - // create path and map variables - String localVarPath = "/BankTransfers/{BankTransferID}/History" - .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Create one or many BatchPayments for invoices - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects (required) - * @return BatchPayments - * @throws ApiException if fails to make API call - */ - public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments) throws ApiException { - return createBatchPaymentWithHttpInfo(xeroTenantId, batchPayments).getData(); - } - - /** - * Create one or many BatchPayments for invoices - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects (required) - * @return ApiResponse<BatchPayments> - * @throws ApiException if fails to make API call - */ - public ApiResponse createBatchPaymentWithHttpInfo(String xeroTenantId, BatchPayments batchPayments) throws ApiException { - Object localVarPostBody = batchPayments; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); - } - - // verify the required parameter 'batchPayments' is set - if (batchPayments == null) { - throw new ApiException(400, "Missing the required parameter 'batchPayments' when calling createBatchPayment"); - } - - // create path and map variables - String localVarPath = "/BatchPayments"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create a history record for a Batch Payment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param batchPaymentID Unique identifier for BatchPayment (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws ApiException { - return createBatchPaymentHistoryRecordWithHttpInfo(xeroTenantId, batchPaymentID, historyRecords).getData(); - } - - /** - * Allows you to create a history record for a Batch Payment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param batchPaymentID Unique identifier for BatchPayment (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createBatchPaymentHistoryRecordWithHttpInfo(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); - } - - // verify the required parameter 'batchPaymentID' is set - if (batchPaymentID == null) { - throw new ApiException(400, "Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); - } - - // create path and map variables - String localVarPath = "/BatchPayments/{BatchPaymentID}/History" - .replaceAll("\\{" + "BatchPaymentID" + "\\}", apiClient.escapeString(batchPaymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allow for the creation of new custom payment service for specified Branding Theme - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param brandingThemeID Unique identifier for a Branding Theme (required) - * @param paymentService (required) - * @return PaymentServices - * @throws ApiException if fails to make API call - */ - public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws ApiException { - return createBrandingThemePaymentServicesWithHttpInfo(xeroTenantId, brandingThemeID, paymentService).getData(); - } - - /** - * Allow for the creation of new custom payment service for specified Branding Theme - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param brandingThemeID Unique identifier for a Branding Theme (required) - * @param paymentService (required) - * @return ApiResponse<PaymentServices> - * @throws ApiException if fails to make API call - */ - public ApiResponse createBrandingThemePaymentServicesWithHttpInfo(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws ApiException { - Object localVarPostBody = paymentService; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); - } - - // verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new ApiException(400, "Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); - } - - // verify the required parameter 'paymentService' is set - if (paymentService == null) { - throw new ApiException(400, "Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); - } - - // create path and map variables - String localVarPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices" - .replaceAll("\\{" + "BrandingThemeID" + "\\}", apiClient.escapeString(brandingThemeID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contact (required) - * @return Contacts - * @throws ApiException if fails to make API call - */ - public Contacts createContact(String xeroTenantId, Contact contact) throws ApiException { - return createContactWithHttpInfo(xeroTenantId, contact).getData(); - } - - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contact (required) - * @return ApiResponse<Contacts> - * @throws ApiException if fails to make API call - */ - public ApiResponse createContactWithHttpInfo(String xeroTenantId, Contact contact) throws ApiException { - Object localVarPostBody = contact; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createContact"); - } - - // verify the required parameter 'contact' is set - if (contact == null) { - throw new ApiException(400, "Missing the required parameter 'contact' when calling createContact"); - } - - // create path and map variables - String localVarPath = "/Contacts"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param fileName Name for the file you are attaching (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws ApiException { - return createContactAttachmentByFileNameWithHttpInfo(xeroTenantId, contactID, fileName, body).getData(); - } - - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param fileName Name for the file you are attaching (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse createContactAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); - } - - // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new ApiException(400, "Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createContactAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Contacts/{ContactID}/Attachments/{FileName}" - .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create a contact group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroups an array of contact groups with names specified (required) - * @return ContactGroups - * @throws ApiException if fails to make API call - */ - public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups) throws ApiException { - return createContactGroupWithHttpInfo(xeroTenantId, contactGroups).getData(); - } - - /** - * Allows you to create a contact group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroups an array of contact groups with names specified (required) - * @return ApiResponse<ContactGroups> - * @throws ApiException if fails to make API call - */ - public ApiResponse createContactGroupWithHttpInfo(String xeroTenantId, ContactGroups contactGroups) throws ApiException { - Object localVarPostBody = contactGroups; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createContactGroup"); - } - - // verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new ApiException(400, "Missing the required parameter 'contactGroups' when calling createContactGroup"); - } - - // create path and map variables - String localVarPath = "/ContactGroups"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to add Contacts to a Contract Group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroupID Unique identifier for a Contact Group (required) - * @param contacts an array of contacts with ContactID to be added to ContactGroup (required) - * @return Contacts - * @throws ApiException if fails to make API call - */ - public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws ApiException { - return createContactGroupContactsWithHttpInfo(xeroTenantId, contactGroupID, contacts).getData(); - } - - /** - * Allows you to add Contacts to a Contract Group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroupID Unique identifier for a Contact Group (required) - * @param contacts an array of contacts with ContactID to be added to ContactGroup (required) - * @return ApiResponse<Contacts> - * @throws ApiException if fails to make API call - */ - public ApiResponse createContactGroupContactsWithHttpInfo(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws ApiException { - Object localVarPostBody = contacts; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); - } - - // verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new ApiException(400, "Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); - } - - // verify the required parameter 'contacts' is set - if (contacts == null) { - throw new ApiException(400, "Missing the required parameter 'contacts' when calling createContactGroupContacts"); - } - - // create path and map variables - String localVarPath = "/ContactGroups/{ContactGroupID}/Contacts" - .replaceAll("\\{" + "ContactGroupID" + "\\}", apiClient.escapeString(contactGroupID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a history records of an Contact - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws ApiException { - return createContactHistoryWithHttpInfo(xeroTenantId, contactID, historyRecords).getData(); - } - - /** - * Allows you to retrieve a history records of an Contact - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createContactHistoryWithHttpInfo(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createContactHistory"); - } - - // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new ApiException(400, "Missing the required parameter 'contactID' when calling createContactHistory"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createContactHistory"); - } - - // create path and map variables - String localVarPath = "/Contacts/{ContactID}/History" - .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create a credit note - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNotes an array of Credit Notes with a single CreditNote object. (required) - * @param summarizeErrors shows validation errors for each credit note (optional) - * @return CreditNotes - * @throws ApiException if fails to make API call - */ - public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws ApiException { - return createCreditNoteWithHttpInfo(xeroTenantId, creditNotes, summarizeErrors).getData(); - } - - /** - * Allows you to create a credit note - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNotes an array of Credit Notes with a single CreditNote object. (required) - * @param summarizeErrors shows validation errors for each credit note (optional) - * @return ApiResponse<CreditNotes> - * @throws ApiException if fails to make API call - */ - public ApiResponse createCreditNoteWithHttpInfo(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws ApiException { - Object localVarPostBody = creditNotes; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createCreditNote"); - } - - // verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new ApiException(400, "Missing the required parameter 'creditNotes' when calling createCreditNote"); - } - - // create path and map variables - String localVarPath = "/CreditNotes"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "SummarizeErrors", summarizeErrors)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create Allocation on CreditNote - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param allocations an array of Allocations with single Allocation object defined. (required) - * @return Allocations - * @throws ApiException if fails to make API call - */ - public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws ApiException { - return createCreditNoteAllocationWithHttpInfo(xeroTenantId, creditNoteID, allocations).getData(); - } - - /** - * Allows you to create Allocation on CreditNote - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param allocations an array of Allocations with single Allocation object defined. (required) - * @return ApiResponse<Allocations> - * @throws ApiException if fails to make API call - */ - public ApiResponse createCreditNoteAllocationWithHttpInfo(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws ApiException { - Object localVarPostBody = allocations; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); - } - - // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); - } - - // verify the required parameter 'allocations' is set - if (allocations == null) { - throw new ApiException(400, "Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); - } - - // create path and map variables - String localVarPath = "/CreditNotes/{CreditNoteID}/Allocations" - .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create Attachments on CreditNote by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param fileName Name of the file you are attaching to Credit Note (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws ApiException { - return createCreditNoteAttachmentByFileNameWithHttpInfo(xeroTenantId, creditNoteID, fileName, body).getData(); - } - - /** - * Allows you to create Attachments on CreditNote by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param fileName Name of the file you are attaching to Credit Note (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse createCreditNoteAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); - } - - // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}" - .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a history records of an CreditNote - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws ApiException { - return createCreditNoteHistoryWithHttpInfo(xeroTenantId, creditNoteID, historyRecords).getData(); - } - - /** - * Allows you to retrieve a history records of an CreditNote - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createCreditNoteHistoryWithHttpInfo(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); - } - - // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); - } - - // create path and map variables - String localVarPath = "/CreditNotes/{CreditNoteID}/History" - .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param currencies (required) - * @return Currencies - * @throws ApiException if fails to make API call - */ - public Currencies createCurrency(String xeroTenantId, Currencies currencies) throws ApiException { - return createCurrencyWithHttpInfo(xeroTenantId, currencies).getData(); - } - - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param currencies (required) - * @return ApiResponse<Currencies> - * @throws ApiException if fails to make API call - */ - public ApiResponse createCurrencyWithHttpInfo(String xeroTenantId, Currencies currencies) throws ApiException { - Object localVarPostBody = currencies; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createCurrency"); - } - - // verify the required parameter 'currencies' is set - if (currencies == null) { - throw new ApiException(400, "Missing the required parameter 'currencies' when calling createCurrency"); - } - - // create path and map variables - String localVarPath = "/Currencies"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create new employees used in Xero payrun - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param employees (required) - * @return Employees - * @throws ApiException if fails to make API call - */ - public Employees createEmployee(String xeroTenantId, Employees employees) throws ApiException { - return createEmployeeWithHttpInfo(xeroTenantId, employees).getData(); - } - - /** - * Allows you to create new employees used in Xero payrun - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param employees (required) - * @return ApiResponse<Employees> - * @throws ApiException if fails to make API call - */ - public ApiResponse createEmployeeWithHttpInfo(String xeroTenantId, Employees employees) throws ApiException { - Object localVarPostBody = employees; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createEmployee"); - } - - // verify the required parameter 'employees' is set - if (employees == null) { - throw new ApiException(400, "Missing the required parameter 'employees' when calling createEmployee"); - } - - // create path and map variables - String localVarPath = "/Employees"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve expense claims - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param expenseClaims (required) - * @param summarizeErrors shows validation errors for each expense claim (optional) - * @return ExpenseClaims - * @throws ApiException if fails to make API call - */ - public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws ApiException { - return createExpenseClaimWithHttpInfo(xeroTenantId, expenseClaims, summarizeErrors).getData(); - } - - /** - * Allows you to retrieve expense claims - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param expenseClaims (required) - * @param summarizeErrors shows validation errors for each expense claim (optional) - * @return ApiResponse<ExpenseClaims> - * @throws ApiException if fails to make API call - */ - public ApiResponse createExpenseClaimWithHttpInfo(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws ApiException { - Object localVarPostBody = expenseClaims; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); - } - - // verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new ApiException(400, "Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); - } - - // create path and map variables - String localVarPath = "/ExpenseClaims"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "SummarizeErrors", summarizeErrors)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create a history records of an ExpenseClaim - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param expenseClaimID Unique identifier for a ExpenseClaim (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws ApiException { - return createExpenseClaimHistoryWithHttpInfo(xeroTenantId, expenseClaimID, historyRecords).getData(); - } - - /** - * Allows you to create a history records of an ExpenseClaim - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param expenseClaimID Unique identifier for a ExpenseClaim (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createExpenseClaimHistoryWithHttpInfo(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); - } - - // verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new ApiException(400, "Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); - } - - // create path and map variables - String localVarPath = "/ExpenseClaims/{ExpenseClaimID}/History" - .replaceAll("\\{" + "ExpenseClaimID" + "\\}", apiClient.escapeString(expenseClaimID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create any sales invoices or purchase bills - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoices (required) - * @param summarizeErrors shows validation errors for each invoice (optional) - * @return Invoices - * @throws ApiException if fails to make API call - */ - public Invoices createInvoice(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws ApiException { - return createInvoiceWithHttpInfo(xeroTenantId, invoices, summarizeErrors).getData(); - } - - /** - * Allows you to create any sales invoices or purchase bills - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoices (required) - * @param summarizeErrors shows validation errors for each invoice (optional) - * @return ApiResponse<Invoices> - * @throws ApiException if fails to make API call - */ - public ApiResponse createInvoiceWithHttpInfo(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws ApiException { - Object localVarPostBody = invoices; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createInvoice"); - } - - // verify the required parameter 'invoices' is set - if (invoices == null) { - throw new ApiException(400, "Missing the required parameter 'invoices' when calling createInvoice"); - } - - // create path and map variables - String localVarPath = "/Invoices"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "SummarizeErrors", summarizeErrors)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create an Attachment on invoices or purchase bills by it's filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param fileName Name of the file you are attaching (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws ApiException { - return createInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, invoiceID, fileName, body).getData(); - } - - /** - * Allows you to create an Attachment on invoices or purchase bills by it's filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param fileName Name of the file you are attaching (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse createInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}/Attachments/{FileName}" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a history records of an invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws ApiException { - return createInvoiceHistoryWithHttpInfo(xeroTenantId, invoiceID, historyRecords).getData(); - } - - /** - * Allows you to retrieve a history records of an invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createInvoiceHistoryWithHttpInfo(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}/History" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create an item - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param items (required) - * @return Items - * @throws ApiException if fails to make API call - */ - public Items createItem(String xeroTenantId, Items items) throws ApiException { - return createItemWithHttpInfo(xeroTenantId, items).getData(); - } - - /** - * Allows you to create an item - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param items (required) - * @return ApiResponse<Items> - * @throws ApiException if fails to make API call - */ - public ApiResponse createItemWithHttpInfo(String xeroTenantId, Items items) throws ApiException { - Object localVarPostBody = items; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createItem"); - } - - // verify the required parameter 'items' is set - if (items == null) { - throw new ApiException(400, "Missing the required parameter 'items' when calling createItem"); - } - - // create path and map variables - String localVarPath = "/Items"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create a history record for items - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param itemID Unique identifier for an Item (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws ApiException { - return createItemHistoryWithHttpInfo(xeroTenantId, itemID, historyRecords).getData(); - } - - /** - * Allows you to create a history record for items - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param itemID Unique identifier for an Item (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createItemHistoryWithHttpInfo(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createItemHistory"); - } - - // verify the required parameter 'itemID' is set - if (itemID == null) { - throw new ApiException(400, "Missing the required parameter 'itemID' when calling createItemHistory"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createItemHistory"); - } - - // create path and map variables - String localVarPath = "/Items/{ItemID}/History" - .replaceAll("\\{" + "ItemID" + "\\}", apiClient.escapeString(itemID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create linked transactions (billable expenses) - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param linkedTransactions (required) - * @return LinkedTransactions - * @throws ApiException if fails to make API call - */ - public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions) throws ApiException { - return createLinkedTransactionWithHttpInfo(xeroTenantId, linkedTransactions).getData(); - } - - /** - * Allows you to create linked transactions (billable expenses) - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param linkedTransactions (required) - * @return ApiResponse<LinkedTransactions> - * @throws ApiException if fails to make API call - */ - public ApiResponse createLinkedTransactionWithHttpInfo(String xeroTenantId, LinkedTransactions linkedTransactions) throws ApiException { - Object localVarPostBody = linkedTransactions; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); - } - - // verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new ApiException(400, "Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); - } - - // create path and map variables - String localVarPath = "/LinkedTransactions"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create a manual journal - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournals (required) - * @return ManualJournals - * @throws ApiException if fails to make API call - */ - public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals) throws ApiException { - return createManualJournalWithHttpInfo(xeroTenantId, manualJournals).getData(); - } - - /** - * Allows you to create a manual journal - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournals (required) - * @return ApiResponse<ManualJournals> - * @throws ApiException if fails to make API call - */ - public ApiResponse createManualJournalWithHttpInfo(String xeroTenantId, ManualJournals manualJournals) throws ApiException { - Object localVarPostBody = manualJournals; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createManualJournal"); - } - - // verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new ApiException(400, "Missing the required parameter 'manualJournals' when calling createManualJournal"); - } - - // create path and map variables - String localVarPath = "/ManualJournals"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create a specified Attachment on ManualJournal by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @param fileName The name of the file being attached to a ManualJournal (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws ApiException { - return createManualJournalAttachmentByFileNameWithHttpInfo(xeroTenantId, manualJournalID, fileName, body).getData(); - } - - /** - * Allows you to create a specified Attachment on ManualJournal by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @param fileName The name of the file being attached to a ManualJournal (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse createManualJournalAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); - } - - // verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}" - .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Allocations for overpayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param overpaymentID Unique identifier for a Overpayment (required) - * @param allocations (required) - * @return Allocations - * @throws ApiException if fails to make API call - */ - public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws ApiException { - return createOverpaymentAllocationWithHttpInfo(xeroTenantId, overpaymentID, allocations).getData(); - } - - /** - * Allows you to retrieve Allocations for overpayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param overpaymentID Unique identifier for a Overpayment (required) - * @param allocations (required) - * @return ApiResponse<Allocations> - * @throws ApiException if fails to make API call - */ - public ApiResponse createOverpaymentAllocationWithHttpInfo(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws ApiException { - Object localVarPostBody = allocations; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); - } - - // verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new ApiException(400, "Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); - } - - // verify the required parameter 'allocations' is set - if (allocations == null) { - throw new ApiException(400, "Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); - } - - // create path and map variables - String localVarPath = "/Overpayments/{OverpaymentID}/Allocations" - .replaceAll("\\{" + "OverpaymentID" + "\\}", apiClient.escapeString(overpaymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create history records of an Overpayment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param overpaymentID Unique identifier for a Overpayment (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws ApiException { - return createOverpaymentHistoryWithHttpInfo(xeroTenantId, overpaymentID, historyRecords).getData(); - } - - /** - * Allows you to create history records of an Overpayment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param overpaymentID Unique identifier for a Overpayment (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createOverpaymentHistoryWithHttpInfo(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); - } - - // verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new ApiException(400, "Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); - } - - // create path and map variables - String localVarPath = "/Overpayments/{OverpaymentID}/History" - .replaceAll("\\{" + "OverpaymentID" + "\\}", apiClient.escapeString(overpaymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create payments for invoices and credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param payments (required) - * @return Payments - * @throws ApiException if fails to make API call - */ - public Payments createPayment(String xeroTenantId, Payments payments) throws ApiException { - return createPaymentWithHttpInfo(xeroTenantId, payments).getData(); - } - - /** - * Allows you to create payments for invoices and credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param payments (required) - * @return ApiResponse<Payments> - * @throws ApiException if fails to make API call - */ - public ApiResponse createPaymentWithHttpInfo(String xeroTenantId, Payments payments) throws ApiException { - Object localVarPostBody = payments; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPayment"); - } - - // verify the required parameter 'payments' is set - if (payments == null) { - throw new ApiException(400, "Missing the required parameter 'payments' when calling createPayment"); - } - - // create path and map variables - String localVarPath = "/Payments"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create a history record for a payment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param paymentID Unique identifier for a Payment (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws ApiException { - return createPaymentHistoryWithHttpInfo(xeroTenantId, paymentID, historyRecords).getData(); - } - - /** - * Allows you to create a history record for a payment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param paymentID Unique identifier for a Payment (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createPaymentHistoryWithHttpInfo(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); - } - - // verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new ApiException(400, "Missing the required parameter 'paymentID' when calling createPaymentHistory"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createPaymentHistory"); - } - - // create path and map variables - String localVarPath = "/Payments/{PaymentID}/History" - .replaceAll("\\{" + "PaymentID" + "\\}", apiClient.escapeString(paymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create payment services - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param paymentServices (required) - * @return PaymentServices - * @throws ApiException if fails to make API call - */ - public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices) throws ApiException { - return createPaymentServiceWithHttpInfo(xeroTenantId, paymentServices).getData(); - } - - /** - * Allows you to create payment services - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param paymentServices (required) - * @return ApiResponse<PaymentServices> - * @throws ApiException if fails to make API call - */ - public ApiResponse createPaymentServiceWithHttpInfo(String xeroTenantId, PaymentServices paymentServices) throws ApiException { - Object localVarPostBody = paymentServices; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPaymentService"); - } - - // verify the required parameter 'paymentServices' is set - if (paymentServices == null) { - throw new ApiException(400, "Missing the required parameter 'paymentServices' when calling createPaymentService"); - } - - // create path and map variables - String localVarPath = "/PaymentServices"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create an Allocation for prepayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param prepaymentID (required) - * @param allocations (required) - * @return Allocations - * @throws ApiException if fails to make API call - */ - public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws ApiException { - return createPrepaymentAllocationWithHttpInfo(xeroTenantId, prepaymentID, allocations).getData(); - } - - /** - * Allows you to create an Allocation for prepayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param prepaymentID (required) - * @param allocations (required) - * @return ApiResponse<Allocations> - * @throws ApiException if fails to make API call - */ - public ApiResponse createPrepaymentAllocationWithHttpInfo(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws ApiException { - Object localVarPostBody = allocations; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); - } - - // verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new ApiException(400, "Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); - } - - // verify the required parameter 'allocations' is set - if (allocations == null) { - throw new ApiException(400, "Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); - } - - // create path and map variables - String localVarPath = "/Prepayments/{PrepaymentID}/Allocations" - .replaceAll("\\{" + "PrepaymentID" + "\\}", apiClient.escapeString(prepaymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create a history record for an Prepayment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param prepaymentID Unique identifier for a PrePayment (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws ApiException { - return createPrepaymentHistoryWithHttpInfo(xeroTenantId, prepaymentID, historyRecords).getData(); - } - - /** - * Allows you to create a history record for an Prepayment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param prepaymentID Unique identifier for a PrePayment (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createPrepaymentHistoryWithHttpInfo(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); - } - - // verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new ApiException(400, "Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); - } - - // create path and map variables - String localVarPath = "/Prepayments/{PrepaymentID}/History" - .replaceAll("\\{" + "PrepaymentID" + "\\}", apiClient.escapeString(prepaymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create purchase orders - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param purchaseOrders (required) - * @param summarizeErrors shows validation errors for each purchase order. (optional) - * @return PurchaseOrders - * @throws ApiException if fails to make API call - */ - public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws ApiException { - return createPurchaseOrderWithHttpInfo(xeroTenantId, purchaseOrders, summarizeErrors).getData(); - } - - /** - * Allows you to create purchase orders - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param purchaseOrders (required) - * @param summarizeErrors shows validation errors for each purchase order. (optional) - * @return ApiResponse<PurchaseOrders> - * @throws ApiException if fails to make API call - */ - public ApiResponse createPurchaseOrderWithHttpInfo(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws ApiException { - Object localVarPostBody = purchaseOrders; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); - } - - // verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new ApiException(400, "Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); - } - - // create path and map variables - String localVarPath = "/PurchaseOrders"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "SummarizeErrors", summarizeErrors)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create HistoryRecord for purchase orders - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws ApiException { - return createPurchaseOrderHistoryWithHttpInfo(xeroTenantId, purchaseOrderID, historyRecords).getData(); - } - - /** - * Allows you to create HistoryRecord for purchase orders - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createPurchaseOrderHistoryWithHttpInfo(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); - } - - // verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new ApiException(400, "Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); - } - - // create path and map variables - String localVarPath = "/PurchaseOrders/{PurchaseOrderID}/History" - .replaceAll("\\{" + "PurchaseOrderID" + "\\}", apiClient.escapeString(purchaseOrderID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create draft expense claim receipts for any user - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receipts (required) - * @return Receipts - * @throws ApiException if fails to make API call - */ - public Receipts createReceipt(String xeroTenantId, Receipts receipts) throws ApiException { - return createReceiptWithHttpInfo(xeroTenantId, receipts).getData(); - } +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; - /** - * Allows you to create draft expense claim receipts for any user - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receipts (required) - * @return ApiResponse<Receipts> - * @throws ApiException if fails to make API call - */ - public ApiResponse createReceiptWithHttpInfo(String xeroTenantId, Receipts receipts) throws ApiException { - Object localVarPostBody = receipts; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createReceipt"); - } - - // verify the required parameter 'receipts' is set - if (receipts == null) { - throw new ApiException(400, "Missing the required parameter 'receipts' when calling createReceipt"); - } - - // create path and map variables - String localVarPath = "/Receipts"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create Attachment on expense claim receipts by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param fileName The name of the file being attached to the Receipt (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws ApiException { - return createReceiptAttachmentByFileNameWithHttpInfo(xeroTenantId, receiptID, fileName, body).getData(); - } +import java.io.ByteArrayInputStream; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.regex.Pattern; - /** - * Allows you to create Attachment on expense claim receipts by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param fileName The name of the file being attached to the Receipt (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse createReceiptAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); - } - - // verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new ApiException(400, "Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Receipts/{ReceiptID}/Attachments/{FileName}" - .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a history records of an Receipt - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws ApiException { - return createReceiptHistoryWithHttpInfo(xeroTenantId, receiptID, historyRecords).getData(); - } +import javax.ws.rs.core.UriBuilder; - /** - * Allows you to retrieve a history records of an Receipt - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createReceiptHistoryWithHttpInfo(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); - } - - // verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new ApiException(400, "Missing the required parameter 'receiptID' when calling createReceiptHistory"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createReceiptHistory"); - } - - // create path and map variables - String localVarPath = "/Receipts/{ReceiptID}/History" - .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create attachment on repeating invoices by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @param fileName The name of the file being attached to a Repeating Invoice (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws ApiException { - return createRepeatingInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, repeatingInvoiceID, fileName, body).getData(); - } - /** - * Allows you to create attachment on repeating invoices by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @param fileName The name of the file being attached to a Repeating Invoice (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse createRepeatingInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}" - .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create history for a repeating invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @param historyRecords (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws ApiException { - return createRepeatingInvoiceHistoryWithHttpInfo(xeroTenantId, repeatingInvoiceID, historyRecords).getData(); - } +public class AccountingApi { + private ApiClient apiClient; - /** - * Allows you to create history for a repeating invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @param historyRecords (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse createRepeatingInvoiceHistoryWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws ApiException { - Object localVarPostBody = historyRecords; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); - } - - // verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); - } - - // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new ApiException(400, "Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); - } - - // create path and map variables - String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History" - .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create Tax Rates - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param taxRates (required) - * @return TaxRates - * @throws ApiException if fails to make API call - */ - public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates) throws ApiException { - return createTaxRateWithHttpInfo(xeroTenantId, taxRates).getData(); - } + public AccountingApi() { + this(new ApiClient()); + } - /** - * Allows you to create Tax Rates - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param taxRates (required) - * @return ApiResponse<TaxRates> - * @throws ApiException if fails to make API call - */ - public ApiResponse createTaxRateWithHttpInfo(String xeroTenantId, TaxRates taxRates) throws ApiException { - Object localVarPostBody = taxRates; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createTaxRate"); - } - - // verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new ApiException(400, "Missing the required parameter 'taxRates' when calling createTaxRate"); - } - - // create path and map variables - String localVarPath = "/TaxRates"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create tracking categories - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategory (required) - * @return TrackingCategories - * @throws ApiException if fails to make API call - */ - public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory) throws ApiException { - return createTrackingCategoryWithHttpInfo(xeroTenantId, trackingCategory).getData(); - } + public AccountingApi(ApiClient apiClient) { + this.apiClient = apiClient; + } - /** - * Allows you to create tracking categories - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategory (required) - * @return ApiResponse<TrackingCategories> - * @throws ApiException if fails to make API call - */ - public ApiResponse createTrackingCategoryWithHttpInfo(String xeroTenantId, TrackingCategory trackingCategory) throws ApiException { - Object localVarPostBody = trackingCategory; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); - } - - // verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new ApiException(400, "Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); - } - - // create path and map variables - String localVarPath = "/TrackingCategories"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to create options for a specified tracking category - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategoryID Unique identifier for a TrackingCategory (required) - * @param trackingOption (required) - * @return TrackingOptions - * @throws ApiException if fails to make API call - */ - public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws ApiException { - return createTrackingOptionsWithHttpInfo(xeroTenantId, trackingCategoryID, trackingOption).getData(); - } + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Allows you to create a new chart of accounts + *

200 - Success - created new Account and return response of type Accounts array with new Account + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param account Request of type Account + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts createAccount(String xeroTenantId, Account account) throws IOException { + HttpResponse response = createAccountForHttpResponse(xeroTenantId, account); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } /** - * Allows you to create options for a specified tracking category - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategoryID Unique identifier for a TrackingCategory (required) - * @param trackingOption (required) - * @return ApiResponse<TrackingOptions> - * @throws ApiException if fails to make API call - */ - public ApiResponse createTrackingOptionsWithHttpInfo(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws ApiException { - Object localVarPostBody = trackingOption; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); - } - - // verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new ApiException(400, "Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); - } - - // verify the required parameter 'trackingOption' is set - if (trackingOption == null) { - throw new ApiException(400, "Missing the required parameter 'trackingOption' when calling createTrackingOptions"); - } - - // create path and map variables - String localVarPath = "/TrackingCategories/{TrackingCategoryID}/Options" - .replaceAll("\\{" + "TrackingCategoryID" + "\\}", apiClient.escapeString(trackingCategoryID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to delete a chart of accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for retrieving single object (required) - * @return Accounts - * @throws ApiException if fails to make API call - */ - public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws ApiException { - return deleteAccountWithHttpInfo(xeroTenantId, accountID).getData(); - } + * Allows you to create a new chart of accounts + *

200 - Success - created new Account and return response of type Accounts array with new Account + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param account Request of type Account + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts createAccount(String xeroTenantId, Account account, Map params) throws IOException { + HttpResponse response = createAccountForHttpResponse(xeroTenantId, account, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account account) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); + }// verify the required parameter 'account' is set + if (account == null) { + throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(account); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createAccountForHttpResponse(String xeroTenantId, java.io.InputStream account, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); + }// verify the required parameter 'account' is set + if (account == null) { + throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = account == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, account); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account account, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); + }// verify the required parameter 'account' is set + if (account == null) { + throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(account); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create Attachment on Account + *

200 - Success - return response of type Attachments array of Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param fileName Name of the attachment + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create Attachment on Account + *

200 - Success - return response of type Attachments array of Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param fileName Name of the attachment + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with new BankTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactions The bankTransactions parameter + * @param summarizeErrors response format that shows validation errors for each bank transaction + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + HttpResponse response = createBankTransactionForHttpResponse(xeroTenantId, bankTransactions, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with new BankTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactions The bankTransactions parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Map params) throws IOException { + HttpResponse response = createBankTransactionForHttpResponse(xeroTenantId, bankTransactions, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, java.io.InputStream bankTransactions, Boolean summarizeErrors, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = bankTransactions == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, BankTransactions bankTransactions, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to createa an Attachment on BankTransaction by Filename + *

200 - Success - return response of Attachments array of Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param fileName The name of the file being attached + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to createa an Attachment on BankTransaction by Filename + *

200 - Success - return response of Attachments array of Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param fileName The name of the file being attached + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create history record for a bank transactions + *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(xeroTenantId, bankTransactionID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create history record for a bank transactions + *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(xeroTenantId, bankTransactionID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a bank transfers + *

200 - Success - return response of BankTransfers array of one BankTransfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransfers The bankTransfers parameter + * @return BankTransfers + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers) throws IOException { + HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a bank transfers + *

200 - Success - return response of BankTransfers array of one BankTransfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransfers The bankTransfers parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransfers + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers, Map params) throws IOException { + HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankTransfers bankTransfers) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); + }// verify the required parameter 'bankTransfers' is set + if (bankTransfers == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, java.io.InputStream bankTransfers, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); + }// verify the required parameter 'bankTransfers' is set + if (bankTransfers == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = bankTransfers == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransfers); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankTransfers bankTransfers, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); + }// verify the required parameter 'bankTransfers' is set + if (bankTransfers == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param fileName The name of the file being attached to a Bank Transfer + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param fileName The name of the file being attached to a Bank Transfer + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + *

200 - Success - return response HistoryRecords array with the newly created HistoryRecord for a Bank Transfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBankTransferHistoryRecordForHttpResponse(xeroTenantId, bankTransferID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + *

200 - Success - return response HistoryRecords array with the newly created HistoryRecord for a Bank Transfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createBankTransferHistoryRecordForHttpResponse(xeroTenantId, bankTransferID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Create one or many BatchPayments for invoices + *

200 - Success - return response of type BatchPayments array of BatchPayment objects + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects + * @return BatchPayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments) throws IOException { + HttpResponse response = createBatchPaymentForHttpResponse(xeroTenantId, batchPayments); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Create one or many BatchPayments for invoices + *

200 - Success - return response of type BatchPayments array of BatchPayment objects + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BatchPayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments, Map params) throws IOException { + HttpResponse response = createBatchPaymentForHttpResponse(xeroTenantId, batchPayments, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, BatchPayments batchPayments) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); + }// verify the required parameter 'batchPayments' is set + if (batchPayments == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, java.io.InputStream batchPayments, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); + }// verify the required parameter 'batchPayments' is set + if (batchPayments == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = batchPayments == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, batchPayments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, BatchPayments batchPayments, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); + }// verify the required parameter 'batchPayments' is set + if (batchPayments == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a history record for a Batch Payment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param batchPaymentID Unique identifier for BatchPayment + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(xeroTenantId, batchPaymentID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a history record for a Batch Payment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param batchPaymentID Unique identifier for BatchPayment + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(xeroTenantId, batchPaymentID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BatchPaymentID", batchPaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BatchPaymentID", batchPaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BatchPaymentID", batchPaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allow for the creation of new custom payment service for specified Branding Theme + *

200 - Success - return response of type PaymentServices array with newly created PaymentService + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param brandingThemeID Unique identifier for a Branding Theme + * @param paymentService The paymentService parameter + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { + HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, paymentService); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allow for the creation of new custom payment service for specified Branding Theme + *

200 - Success - return response of type PaymentServices array with newly created PaymentService + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param brandingThemeID Unique identifier for a Branding Theme + * @param paymentService The paymentService parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService, Map params) throws IOException { + HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, paymentService, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'paymentService' is set + if (paymentService == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, java.io.InputStream paymentService, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'paymentService' is set + if (paymentService == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = paymentService == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentService); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'paymentService' is set + if (paymentService == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + *

200 - Success - return response of type Contacts array with newly created Contact + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param contact The contact parameter + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts createContact(String xeroTenantId, Contact contact) throws IOException { + HttpResponse response = createContactForHttpResponse(xeroTenantId, contact); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + *

200 - Success - return response of type Contacts array with newly created Contact + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param contact The contact parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts createContact(String xeroTenantId, Contact contact, Map params) throws IOException { + HttpResponse response = createContactForHttpResponse(xeroTenantId, contact, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact contact) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); + }// verify the required parameter 'contact' is set + if (contact == null) { + throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contact); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactForHttpResponse(String xeroTenantId, java.io.InputStream contact, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); + }// verify the required parameter 'contact' is set + if (contact == null) { + throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = contact == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contact); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact contact, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); + }// verify the required parameter 'contact' is set + if (contact == null) { + throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contact); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + *

200 - Success - return response of type Attachments array with an newly created Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param fileName Name for the file you are attaching + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + *

200 - Success - return response of type Attachments array with an newly created Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param fileName Name for the file you are attaching + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a contact group + *

200 - Success - return response of type Contact Groups array of newly created Contact Group + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroups an array of contact groups with names specified + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups) throws IOException { + HttpResponse response = createContactGroupForHttpResponse(xeroTenantId, contactGroups); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a contact group + *

200 - Success - return response of type Contact Groups array of newly created Contact Group + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroups an array of contact groups with names specified + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups, Map params) throws IOException { + HttpResponse response = createContactGroupForHttpResponse(xeroTenantId, contactGroups, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, ContactGroups contactGroups) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, java.io.InputStream contactGroups, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = contactGroups == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, ContactGroups contactGroups, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to add Contacts to a Contract Group + *

200 - Success - return response of type Contacts array of added Contacts + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param contacts an array of contacts with ContactID to be added to ContactGroup + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { + HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to add Contacts to a Contract Group + *

200 - Success - return response of type Contacts array of added Contacts + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param contacts an array of contacts with ContactID to be added to ContactGroup + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts, Map params) throws IOException { + HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, java.io.InputStream contacts, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = contacts == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Contacts contacts, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an Contact + *

200 - Success - return response of type History Records array of newly created History Record for a specific Contact + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createContactHistoryForHttpResponse(xeroTenantId, contactID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an Contact + *

200 - Success - return response of type History Records array of newly created History Record for a specific Contact + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createContactHistoryForHttpResponse(xeroTenantId, contactID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a credit note + *

200 - Success - return response of type Credit Notes array of newly created CreditNote + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNotes an array of Credit Notes with a single CreditNote object. + * @param summarizeErrors shows validation errors for each credit note + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + HttpResponse response = createCreditNoteForHttpResponse(xeroTenantId, creditNotes, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a credit note + *

200 - Success - return response of type Credit Notes array of newly created CreditNote + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNotes an array of Credit Notes with a single CreditNote object. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Map params) throws IOException { + HttpResponse response = createCreditNoteForHttpResponse(xeroTenantId, creditNotes, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, java.io.InputStream creditNotes, Boolean summarizeErrors, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = creditNotes == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditNotes creditNotes, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create Allocation on CreditNote + *

200 - Success - return response of type Allocations array with newly created Allocation for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param allocations an array of Allocations with single Allocation object defined. + * @return Allocations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { + HttpResponse response = createCreditNoteAllocationForHttpResponse(xeroTenantId, creditNoteID, allocations); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create Allocation on CreditNote + *

200 - Success - return response of type Allocations array with newly created Allocation for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param allocations an array of Allocations with single Allocation object defined. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Allocations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations, Map params) throws IOException { + HttpResponse response = createCreditNoteAllocationForHttpResponse(xeroTenantId, creditNoteID, allocations, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream allocations, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = allocations == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, Allocations allocations, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create Attachments on CreditNote by file name + *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param fileName Name of the file you are attaching to Credit Note + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create Attachments on CreditNote by file name + *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param fileName Name of the file you are attaching to Credit Note + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an CreditNote + *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an CreditNote + *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency + * @param xeroTenantId Xero identifier for Tenant + * @param currencies The currencies parameter + * @return Currencies + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Currencies createCurrency(String xeroTenantId, Currencies currencies) throws IOException { + HttpResponse response = createCurrencyForHttpResponse(xeroTenantId, currencies); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency + * @param xeroTenantId Xero identifier for Tenant + * @param currencies The currencies parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Currencies + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Currencies createCurrency(String xeroTenantId, Currencies currencies, Map params) throws IOException { + HttpResponse response = createCurrencyForHttpResponse(xeroTenantId, currencies, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencies currencies) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); + }// verify the required parameter 'currencies' is set + if (currencies == null) { + throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, java.io.InputStream currencies, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); + }// verify the required parameter 'currencies' is set + if (currencies == null) { + throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = currencies == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, currencies); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencies currencies, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); + }// verify the required parameter 'currencies' is set + if (currencies == null) { + throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create new employees used in Xero payrun + *

200 - Success - return response of type Employees array with new Employee + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param employees The employees parameter + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees createEmployee(String xeroTenantId, Employees employees) throws IOException { + HttpResponse response = createEmployeeForHttpResponse(xeroTenantId, employees); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create new employees used in Xero payrun + *

200 - Success - return response of type Employees array with new Employee + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param employees The employees parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees createEmployee(String xeroTenantId, Employees employees, Map params) throws IOException { + HttpResponse response = createEmployeeForHttpResponse(xeroTenantId, employees, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees employees) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, java.io.InputStream employees, String mediaType) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = employees == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees employees, Map params) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve expense claims + *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaims The expenseClaims parameter + * @param summarizeErrors shows validation errors for each expense claim + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve expense claims + *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaims The expenseClaims parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Map params) throws IOException { + HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, java.io.InputStream expenseClaims, Boolean summarizeErrors, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = expenseClaims == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, ExpenseClaims expenseClaims, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a history records of an ExpenseClaim + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a history records of an ExpenseClaim + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create any sales invoices or purchase bills + *

200 - Success - return response of type Invoices array with newly created Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoices The invoices parameter + * @param summarizeErrors shows validation errors for each invoice + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices createInvoice(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + HttpResponse response = createInvoiceForHttpResponse(xeroTenantId, invoices, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create any sales invoices or purchase bills + *

200 - Success - return response of type Invoices array with newly created Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoices The invoices parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices createInvoice(String xeroTenantId, Invoices invoices, Map params) throws IOException { + HttpResponse response = createInvoiceForHttpResponse(xeroTenantId, invoices, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, java.io.InputStream invoices, Boolean summarizeErrors, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = invoices == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices invoices, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create an Attachment on invoices or purchase bills by it's filename + *

200 - Success - return response of type Attachments array with newly created Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param fileName Name of the file you are attaching + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create an Attachment on invoices or purchase bills by it's filename + *

200 - Success - return response of type Attachments array with newly created Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param fileName Name of the file you are attaching + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an invoice + *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an invoice + *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create an item + *

200 - Success - return response of type Items array with newly created Item + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param items The items parameter + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items createItem(String xeroTenantId, Items items) throws IOException { + HttpResponse response = createItemForHttpResponse(xeroTenantId, items); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create an item + *

200 - Success - return response of type Items array with newly created Item + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param items The items parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items createItem(String xeroTenantId, Items items, Map params) throws IOException { + HttpResponse response = createItemForHttpResponse(xeroTenantId, items, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(items); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createItemForHttpResponse(String xeroTenantId, java.io.InputStream items, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = items == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(items); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a history record for items + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createItemHistoryForHttpResponse(xeroTenantId, itemID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a history record for items + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createItemHistoryForHttpResponse(xeroTenantId, itemID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactions The linkedTransactions parameter + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { + HttpResponse response = createLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactions); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactions The linkedTransactions parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions, Map params) throws IOException { + HttpResponse response = createLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactions, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, java.io.InputStream linkedTransactions, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = linkedTransactions == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, LinkedTransactions linkedTransactions, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a manual journal + *

200 - Success - return response of type ManualJournals array with newly created ManualJournal + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournals The manualJournals parameter + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals) throws IOException { + HttpResponse response = createManualJournalForHttpResponse(xeroTenantId, manualJournals); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a manual journal + *

200 - Success - return response of type ManualJournals array with newly created ManualJournal + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournals The manualJournals parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals, Map params) throws IOException { + HttpResponse response = createManualJournalForHttpResponse(xeroTenantId, manualJournals, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, ManualJournals manualJournals) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, java.io.InputStream manualJournals, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = manualJournals == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, ManualJournals manualJournals, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a specified Attachment on ManualJournal by file name + *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param fileName The name of the file being attached to a ManualJournal + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a specified Attachment on ManualJournal by file name + *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param fileName The name of the file being attached to a ManualJournal + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Allocations for overpayments + *

200 - Success - return response of type Allocations array with all Allocation for Overpayments + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @param allocations The allocations parameter + * @return Allocations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { + HttpResponse response = createOverpaymentAllocationForHttpResponse(xeroTenantId, overpaymentID, allocations); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Allocations for overpayments + *

200 - Success - return response of type Allocations array with all Allocation for Overpayments + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @param allocations The allocations parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Allocations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations, Map params) throws IOException { + HttpResponse response = createOverpaymentAllocationForHttpResponse(xeroTenantId, overpaymentID, allocations, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, java.io.InputStream allocations, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = allocations == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, Allocations allocations, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create history records of an Overpayment + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Overpayments + *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create history records of an Overpayment + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Overpayments + *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create payments for invoices and credit notes + *

200 - Success - return response of type Payments array for newly created Payment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param payments The payments parameter + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments createPayment(String xeroTenantId, Payments payments) throws IOException { + HttpResponse response = createPaymentForHttpResponse(xeroTenantId, payments); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create payments for invoices and credit notes + *

200 - Success - return response of type Payments array for newly created Payment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param payments The payments parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments createPayment(String xeroTenantId, Payments payments, Map params) throws IOException { + HttpResponse response = createPaymentForHttpResponse(xeroTenantId, payments, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments payments) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPaymentForHttpResponse(String xeroTenantId, java.io.InputStream payments, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = payments == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments payments, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a history record for a payment + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments + *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Payments + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPaymentHistoryForHttpResponse(xeroTenantId, paymentID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a history record for a payment + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments + *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Payments + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createPaymentHistoryForHttpResponse(xeroTenantId, paymentID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create payment services + *

200 - Success - return response of type PaymentServices array for newly created PaymentService + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param paymentServices The paymentServices parameter + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices) throws IOException { + HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create payment services + *

200 - Success - return response of type PaymentServices array for newly created PaymentService + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param paymentServices The paymentServices parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices, Map params) throws IOException { + HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, PaymentServices paymentServices) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); + }// verify the required parameter 'paymentServices' is set + if (paymentServices == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, java.io.InputStream paymentServices, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); + }// verify the required parameter 'paymentServices' is set + if (paymentServices == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = paymentServices == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentServices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, PaymentServices paymentServices, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); + }// verify the required parameter 'paymentServices' is set + if (paymentServices == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create an Allocation for prepayments + *

200 - Success - return response of type Allocations array of Allocation for all Prepayment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID The prepaymentID parameter + * @param allocations The allocations parameter + * @return Allocations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { + HttpResponse response = createPrepaymentAllocationForHttpResponse(xeroTenantId, prepaymentID, allocations); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create an Allocation for prepayments + *

200 - Success - return response of type Allocations array of Allocation for all Prepayment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID The prepaymentID parameter + * @param allocations The allocations parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Allocations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations, Map params) throws IOException { + HttpResponse response = createPrepaymentAllocationForHttpResponse(xeroTenantId, prepaymentID, allocations, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, java.io.InputStream allocations, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = allocations == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, Allocations allocations, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); + }// verify the required parameter 'allocations' is set + if (allocations == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create a history record for an Prepayment + *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PrePayment + *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID Unique identifier for a PrePayment + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create a history record for an Prepayment + *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PrePayment + *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID Unique identifier for a PrePayment + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create purchase orders + *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrders The purchaseOrders parameter + * @param summarizeErrors shows validation errors for each purchase order. + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + HttpResponse response = createPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrders, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create purchase orders + *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrders The purchaseOrders parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Map params) throws IOException { + HttpResponse response = createPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrders, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, java.io.InputStream purchaseOrders, Boolean summarizeErrors, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = purchaseOrders == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, PurchaseOrders purchaseOrders, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create HistoryRecord for purchase orders + *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PurchaseOrder + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create HistoryRecord for purchase orders + *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PurchaseOrder + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create draft expense claim receipts for any user + *

200 - Success - return response of type Receipts array for newly created Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receipts The receipts parameter + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts createReceipt(String xeroTenantId, Receipts receipts) throws IOException { + HttpResponse response = createReceiptForHttpResponse(xeroTenantId, receipts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create draft expense claim receipts for any user + *

200 - Success - return response of type Receipts array for newly created Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receipts The receipts parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts createReceipt(String xeroTenantId, Receipts receipts, Map params) throws IOException { + HttpResponse response = createReceiptForHttpResponse(xeroTenantId, receipts, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts receipts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createReceiptForHttpResponse(String xeroTenantId, java.io.InputStream receipts, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = receipts == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts receipts, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create Attachment on expense claim receipts by file name + *

200 - Success - return response of type Attachments array with newly created Attachment for a specified Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param fileName The name of the file being attached to the Receipt + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create Attachment on expense claim receipts by file name + *

200 - Success - return response of type Attachments array with newly created Attachment for a specified Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param fileName The name of the file being attached to the Receipt + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an Receipt + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts + *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createReceiptHistoryForHttpResponse(xeroTenantId, receiptID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an Receipt + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts + *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createReceiptHistoryForHttpResponse(xeroTenantId, receiptID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create attachment on repeating invoices by file name + *

200 - Success - return response of type Attachments array with updated Attachment for a specified Repeating Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param fileName The name of the file being attached to a Repeating Invoice + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create attachment on repeating invoices by file name + *

200 - Success - return response of type Attachments array with updated Attachment for a specified Repeating Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param fileName The name of the file being attached to a Repeating Invoice + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create history for a repeating invoice + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create history for a repeating invoice + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param historyRecords The historyRecords parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords, Map params) throws IOException { + HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, java.io.InputStream historyRecords, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = historyRecords == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create Tax Rates + *

200 - Success - return response of type TaxRates array newly created TaxRate + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param taxRates The taxRates parameter + * @return TaxRates + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { + HttpResponse response = createTaxRateForHttpResponse(xeroTenantId, taxRates); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create Tax Rates + *

200 - Success - return response of type TaxRates array newly created TaxRate + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param taxRates The taxRates parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TaxRates + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { + HttpResponse response = createTaxRateForHttpResponse(xeroTenantId, taxRates, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, java.io.InputStream taxRates, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = taxRates == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create tracking categories + *

200 - Success - return response of type TrackingCategories array of newly created TrackingCategory + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategory The trackingCategory parameter + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory) throws IOException { + HttpResponse response = createTrackingCategoryForHttpResponse(xeroTenantId, trackingCategory); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create tracking categories + *

200 - Success - return response of type TrackingCategories array of newly created TrackingCategory + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategory The trackingCategory parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory, Map params) throws IOException { + HttpResponse response = createTrackingCategoryForHttpResponse(xeroTenantId, trackingCategory, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, TrackingCategory trackingCategory) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, java.io.InputStream trackingCategory, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = trackingCategory == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, TrackingCategory trackingCategory, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to create options for a specified tracking category + *

200 - Success - return response of type TrackingOptions array of options for a specified category + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param trackingOption The trackingOption parameter + * @return TrackingOptions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { + HttpResponse response = createTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOption); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to create options for a specified tracking category + *

200 - Success - return response of type TrackingOptions array of options for a specified category + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param trackingOption The trackingOption parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TrackingOptions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption, Map params) throws IOException { + HttpResponse response = createTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOption, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); + }// verify the required parameter 'trackingOption' is set + if (trackingOption == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, java.io.InputStream trackingOption, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); + }// verify the required parameter 'trackingOption' is set + if (trackingOption == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = trackingOption == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingOption); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); + }// verify the required parameter 'trackingOption' is set + if (trackingOption == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + + /** + * Allows you to delete a chart of accounts + *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for retrieving single object + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to delete a chart of accounts + *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for retrieving single object + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts deleteAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { + HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + + /** + * Allows you to delete a specific Contact from a Contract Group + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param contactID Unique identifier for a Contact + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { + deleteContactGroupContactForHttpResponse(xeroTenantId, contactGroupID, contactID); + } + + /** + * Allows you to delete a specific Contact from a Contract Group + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param contactID Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID, Map params) throws IOException { + deleteContactGroupContactForHttpResponse(xeroTenantId, contactGroupID, contactID, params); + } + + public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId, UUID contactGroupID, UUID contactID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + + /** + * Allows you to delete all Contacts from a Contract Group + *

200 - Success - return response 204 no content + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID) throws IOException { + deleteContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID); + } + + /** + * Allows you to delete all Contacts from a Contract Group + *

200 - Success - return response 204 no content + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { + deleteContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, params); + } + + public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + + /** + * Allows you to delete a specified item + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteItem(String xeroTenantId, UUID itemID) throws IOException { + deleteItemForHttpResponse(xeroTenantId, itemID); + } + + /** + * Allows you to delete a specified item + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteItem(String xeroTenantId, UUID itemID, Map params) throws IOException { + deleteItemForHttpResponse(xeroTenantId, itemID, params); + } + + public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + + /** + * Allows you to delete a specified linked transactions (billable expenses) + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { + deleteLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); + } + + /** + * Allows you to delete a specified linked transactions (billable expenses) + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { + deleteLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, params); + } + + public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + + /** + * Allows you to update a specified payment for invoices and credit notes + *

200 - Success - return response of type Payments array for updated Payment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @param payments The payments parameter + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { + HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update a specified payment for invoices and credit notes + *

200 - Success - return response of type Payments array for updated Payment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @param payments The payments parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments, Map params) throws IOException { + HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, java.io.InputStream payments, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = payments == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, Payments payments, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to delete tracking categories + *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { + HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to delete tracking categories + *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + + /** + * Allows you to delete a specified option for a specified tracking category + *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param trackingOptionID Unique identifier for a Tracking Option + * @return TrackingOptions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { + HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to delete a specified option for a specified tracking category + *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param trackingOptionID Unique identifier for a Tracking Option + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TrackingOptions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, Map params) throws IOException { + HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); + }// verify the required parameter 'trackingOptionID' is set + if (trackingOptionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + uriVariables.put("TrackingOptionID", trackingOptionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); + }// verify the required parameter 'trackingOptionID' is set + if (trackingOptionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + uriVariables.put("TrackingOptionID", trackingOptionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + } + + + /** + * Allows you to email a copy of invoice to related Contact + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param requestEmpty The requestEmpty parameter + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { + emailInvoiceForHttpResponse(xeroTenantId, invoiceID, requestEmpty); + } + + /** + * Allows you to email a copy of invoice to related Contact + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param requestEmpty The requestEmpty parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty, Map params) throws IOException { + emailInvoiceForHttpResponse(xeroTenantId, invoiceID, requestEmpty, params); + } + + public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); + }// verify the required parameter 'requestEmpty' is set + if (requestEmpty == null) { + throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream requestEmpty, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); + }// verify the required parameter 'requestEmpty' is set + if (requestEmpty == null) { + throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = requestEmpty == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, requestEmpty); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); + }// verify the required parameter 'requestEmpty' is set + if (requestEmpty == null) { + throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a single chart of accounts + *

200 - Success - return response of type Accounts array with one Account + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for retrieving single object + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts getAccount(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a single chart of accounts + *

200 - Success - return response of type Accounts array with one Account + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for retrieving single object + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts getAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { + HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachment on Account by Filename + *

200 - Success - return response of attachment for Account as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param fileName Name of the attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { + HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachment on Account by Filename + *

200 - Success - return response of attachment for Account as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param fileName Name of the attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve specific Attachment on Account + *

200 - Success - return response of attachment for Account as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param attachmentID Unique identifier for Attachment object + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve specific Attachment on Account + *

200 - Success - return response of attachment for Account as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param attachmentID Unique identifier for Attachment object + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getAccountAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getAccountAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments for accounts + *

200 - Success - return response of type Attachments array of Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments for accounts + *

200 - Success - return response of type Attachments array of Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getAccountAttachments(String xeroTenantId, UUID accountID, Map params) throws IOException { + HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve the full chart of accounts + *

200 - Success - return response of type Accounts array with 0 to n Account + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getAccountsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve the full chart of accounts + *

200 - Success - return response of type Accounts array with 0 to n Account + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts getAccounts(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getAccountsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAccountsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getAccountsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a single spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with a specific BankTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a single spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with a specific BankTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on BankTransaction by Filename + *

200 - Success - return response of attachment for BankTransaction as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param fileName The name of the file being attached + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { + HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on BankTransaction by Filename + *

200 - Success - return response of attachment for BankTransaction as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param fileName The name of the file being attached + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on a specific BankTransaction + *

200 - Success - return response of attachment for BankTransaction as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param attachmentID Xero generated unique identifier for an attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on a specific BankTransaction + *

200 - Success - return response of attachment for BankTransaction as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param attachmentID Xero generated unique identifier for an attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve any attachments to bank transactions + *

200 - Success - return response of type Attachments array with 0 to n Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any attachments to bank transactions + *

200 - Success - return response of type Attachments array with 0 to n Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve any spend or receive money transactions + *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 bank transactions will be returned in a single API call with line items shown for each bank transaction + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any spend or receive money transactions + *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions getBankTransactions(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve history from a bank transactions + *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve history from a bank transactions + *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve any bank transfers + *

200 - Success - return response of BankTransfers array with one BankTransfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @return BankTransfers + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any bank transfers + *

200 - Success - return response of BankTransfers array with one BankTransfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransfers + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on BankTransfer by file name + *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param fileName The name of the file being attached to a Bank Transfer + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { + HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on BankTransfer by file name + *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param fileName The name of the file being attached to a Bank Transfer + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on BankTransfer + *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on BankTransfer + *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments from bank transfers + *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments from bank transfers + *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve history from a bank transfers + *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve history from a bank transfers + *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve all bank transfers + *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return BankTransfers + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve all bank transfers + *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransfers + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransfers getBankTransfers(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve history from a Batch Payment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + * @param xeroTenantId Xero identifier for Tenant + * @param batchPaymentID Unique identifier for BatchPayment + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID) throws IOException { + HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve history from a Batch Payment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + * @param xeroTenantId Xero identifier for Tenant + * @param batchPaymentID Unique identifier for BatchPayment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID, Map params) throws IOException { + HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, UUID batchPaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); + }// verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BatchPaymentID", batchPaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, UUID batchPaymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); + }// verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BatchPaymentID", batchPaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Retrieve either one or many BatchPayments for invoices + *

200 - Success - return response of type BatchPayments array of BatchPayment objects + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return BatchPayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Retrieve either one or many BatchPayments for invoices + *

200 - Success - return response of type BatchPayments array of BatchPayment objects + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BatchPayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BatchPayments getBatchPayments(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specific BrandingThemes + *

200 - Success - return response of type BrandingThemes with one BrandingTheme + * @param xeroTenantId Xero identifier for Tenant + * @param brandingThemeID Unique identifier for a Branding Theme + * @return BrandingThemes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID) throws IOException { + HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specific BrandingThemes + *

200 - Success - return response of type BrandingThemes with one BrandingTheme + * @param xeroTenantId Xero identifier for Tenant + * @param brandingThemeID Unique identifier for a Branding Theme + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BrandingThemes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID brandingThemeID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve the Payment services for a Branding Theme + *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService + * @param xeroTenantId Xero identifier for Tenant + * @param brandingThemeID Unique identifier for a Branding Theme + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID) throws IOException { + HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve the Payment services for a Branding Theme + *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService + * @param xeroTenantId Xero identifier for Tenant + * @param brandingThemeID Unique identifier for a Branding Theme + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve all the BrandingThemes + *

200 - Success - return response of type BrandingThemes + * @param xeroTenantId Xero identifier for Tenant + * @return BrandingThemes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BrandingThemes getBrandingThemes(String xeroTenantId) throws IOException { + HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve all the BrandingThemes + *

200 - Success - return response of type BrandingThemes + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BrandingThemes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BrandingThemes getBrandingThemes(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Contacts array with a unique Contact + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts getContact(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Contacts array with a unique Contact + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts getContact(String xeroTenantId, UUID contactID, Map params) throws IOException { + HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on Contacts by file name + *

200 - Success - return response of attachment for Contact as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param fileName Name for the file you are attaching + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { + HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on Contacts by file name + *

200 - Success - return response of attachment for Contact as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param fileName Name for the file you are attaching + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on Contacts + *

200 - Success - return response of attachment for Contact as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on Contacts + *

200 - Success - return response of attachment for Contact as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getContactAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getContactAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Attachments array with 0 to N Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getContactAttachments(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Attachments array with 0 to N Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getContactAttachments(String xeroTenantId, UUID contactID, Map params) throws IOException { + HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve CISSettings for a contact in a Xero organisation + *

200 - Success - return response of type CISSettings for a specific Contact + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @return CISSettings + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve CISSettings for a contact in a Xero organisation + *

200 - Success - return response of type CISSettings for a specific Contact + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return CISSettings + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID, Map params) throws IOException { + HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/CISSettings"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/CISSettings"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a unique Contract Group by ID + *

200 - Success - return response of type Contact Groups array with a specific Contact Group + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) throws IOException { + HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a unique Contract Group by ID + *

200 - Success - return response of type Contact Groups array with a specific Contact Group + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { + HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroup"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroup"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve the ContactID and Name of all the contacts in a contact group + *

200 - Success - return response of type Contact Groups array of Contact Group + * @param xeroTenantId Xero identifier for Tenant + * @param where Filter by an any element + * @param order Order by an any element + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups getContactGroups(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve the ContactID and Name of all the contacts in a contact group + *

200 - Success - return response of type Contact Groups array of Contact Group + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups getContactGroups(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an Contact + *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an Contact + *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID, Map params) throws IOException { + HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactHistory"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactHistory"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Contacts array with 0 to N Contact + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. + * @param page e.g. page=1 - Up to 100 contacts will be returned in a single API call. + * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + HttpResponse response = getContactsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, page, includeArchived); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Contacts array with 0 to N Contact + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts getContacts(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getContactsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (ids != null) { + String key = "IDs"; + Object value = ids; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (includeArchived != null) { + String key = "includeArchived"; + Object value = includeArchived; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getContactsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specific credit note + *

200 - Success - return response of type Credit Notes array with a unique CreditNote + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specific credit note + *

200 - Success - return response of type Credit Notes array with a unique CreditNote + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNote"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNote"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Credit Note as PDF files + *

200 - Success - return response of binary data from the Attachment to a Credit Note + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { + HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Credit Note as PDF files + *

200 - Success - return response of binary data from the Attachment to a Credit Note + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType, Map params) throws IOException { + HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/pdf"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID creditNoteID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/pdf"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on CreditNote by file name + *

200 - Success - return response of attachment for Credit Note as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param fileName Name of the file you are attaching to Credit Note + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { + HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on CreditNote by file name + *

200 - Success - return response of attachment for Credit Note as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param fileName Name of the file you are attaching to Credit Note + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on CreditNote + *

200 - Success - return response of attachment for Credit Note as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on CreditNote + *

200 - Success - return response of attachment for Credit Note as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments for credit notes + *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments for credit notes + *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an CreditNote + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an CreditNote + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve any credit notes + *

200 - Success - return response of type Credit Notes array of CreditNote + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any credit notes + *

200 - Success - return response of type Credit Notes array of CreditNote + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes getCreditNotes(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve currencies for your organisation + *

200 - Success - return response of type Currencies array with all Currencies + * @param xeroTenantId Xero identifier for Tenant + * @param where Filter by an any element + * @param order Order by an any element + * @return Currencies + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Currencies getCurrencies(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve currencies for your organisation + *

200 - Success - return response of type Currencies array with all Currencies + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Currencies + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Currencies getCurrencies(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specific employee used in Xero payrun + *

200 - Success - return response of type Employees array with specified Employee + * @param xeroTenantId Xero identifier for Tenant + * @param employeeID Unique identifier for a Employee + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees getEmployee(String xeroTenantId, UUID employeeID) throws IOException { + HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specific employee used in Xero payrun + *

200 - Success - return response of type Employees array with specified Employee + * @param xeroTenantId Xero identifier for Tenant + * @param employeeID Unique identifier for a Employee + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees getEmployee(String xeroTenantId, UUID employeeID, Map params) throws IOException { + HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getEmployeeForHttpResponse(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"); + } + // 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Map params) 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"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("EmployeeID", employeeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve employees used in Xero payrun + *

200 - Success - return response of type Employees array with all Employee + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve employees used in Xero payrun + *

200 - Success - return response of type Employees array with all Employee + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees getEmployees(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified expense claim + *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID) throws IOException { + HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified expense claim + *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an ExpenseClaim + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID) throws IOException { + HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an ExpenseClaim + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve expense claims + *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve expense claims + *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims getExpenseClaims(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified sales invoice or purchase bill + *

200 - Success - return response of type Invoices array with specified Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices getInvoice(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified sales invoice or purchase bill + *

200 - Success - return response of type Invoices array with specified Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices getInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve invoices or purchase bills as PDF files + *

200 - Success - return response of byte array pdf version of specified Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { + HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve invoices or purchase bills as PDF files + *

200 - Success - return response of byte array pdf version of specified Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType, Map params) throws IOException { + HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/pdf"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID invoiceID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/pdf"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachment on invoices or purchase bills by it's filename + *

200 - Success - return response of attachment for Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param fileName Name of the file you are attaching + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { + HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachment on invoices or purchase bills by it's filename + *

200 - Success - return response of attachment for Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param fileName Name of the file you are attaching + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID + *

200 - Success - return response of attachment for Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param attachmentID Unique identifier for an Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID + *

200 - Success - return response of attachment for Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param attachmentID Unique identifier for an Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on invoices or purchase bills + *

200 - Success - return response of type Attachments array of Attachments for specified Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on invoices or purchase bills + *

200 - Success - return response of type Attachments array of Attachments for specified Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an invoice + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an invoice + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve invoice reminder settings + *

200 - Success - return response of Invoice Reminders + * @param xeroTenantId Xero identifier for Tenant + * @return InvoiceReminders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws IOException { + HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve invoice reminder settings + *

200 - Success - return response of Invoice Reminders + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return InvoiceReminders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public InvoiceReminders getInvoiceReminders(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/InvoiceReminders/Settings"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/InvoiceReminders/Settings"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve any sales invoices or purchase bills + *

200 - Success - return response of type Invoices array with all Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param ids Filter by a comma-separated list of InvoicesIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. + * @param invoiceNumbers Filter by a comma-separated list of InvoiceNumbers. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. + * @param contactIDs Filter by a comma-separated list of ContactIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. + * @param statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. + * @param page e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice + * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response + * @param createdByMyApp When set to true you'll only retrieve Invoices created by your app + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any sales invoices or purchase bills + *

200 - Success - return response of type Invoices array with all Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices getInvoices(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (ids != null) { + String key = "IDs"; + Object value = ids; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (invoiceNumbers != null) { + String key = "InvoiceNumbers"; + Object value = invoiceNumbers; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (contactIDs != null) { + String key = "ContactIDs"; + Object value = contactIDs; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (statuses != null) { + String key = "Statuses"; + Object value = statuses; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (includeArchived != null) { + String key = "includeArchived"; + Object value = includeArchived; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (createdByMyApp != null) { + String key = "createdByMyApp"; + Object value = createdByMyApp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified item + *

200 - Success - return response of type Items array with specified Item + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items getItem(String xeroTenantId, UUID itemID) throws IOException { + HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified item + *

200 - Success - return response of type Items array with specified Item + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items getItem(String xeroTenantId, UUID itemID, Map params) throws IOException { + HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve history for items + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws IOException { + HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve history for items + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID, Map params) throws IOException { + HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItemHistory"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItemHistory"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve any items + *

200 - Success - return response of type Items array with all Item + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpResponse response = getItemsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any items + *

200 - Success - return response of type Items array with all Item + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items getItems(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getItemsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getItemsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getItemsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified journals. + *

200 - Success - return response of type Journals array with specified Journal + * @param xeroTenantId Xero identifier for Tenant + * @param journalID Unique identifier for a Journal + * @return Journals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Journals getJournal(String xeroTenantId, UUID journalID) throws IOException { + HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified journals. + *

200 - Success - return response of type Journals array with specified Journal + * @param xeroTenantId Xero identifier for Tenant + * @param journalID Unique identifier for a Journal + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Journals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Journals getJournal(String xeroTenantId, UUID journalID, Map params) throws IOException { + HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournal"); + }// verify the required parameter 'journalID' is set + if (journalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("JournalID", journalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals/{JournalID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournal"); + }// verify the required parameter 'journalID' is set + if (journalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("JournalID", journalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals/{JournalID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve any journals. + *

200 - Success - return response of type Journals array with all Journals + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned + * @param paymentsOnly Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. + * @return Journals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { + HttpResponse response = getJournalsForHttpResponse(xeroTenantId, ifModifiedSince, offset, paymentsOnly); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any journals. + *

200 - Success - return response of type Journals array with all Journals + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Journals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Journals getJournals(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getJournalsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getJournalsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals"); + if (offset != null) { + String key = "offset"; + Object value = offset; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getJournalsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { + HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { + HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Retrieve linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. + * @param linkedTransactionID The Xero identifier for an Linked Transaction + * @param sourceTransactionID Filter by the SourceTransactionID. Get all the linked transactions created from a particular ACCPAY invoice + * @param contactID Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. + * @param status Filter by the combination of ContactID and Status. Get all the linked transactions that have been assigned to a particular customer and have a particular status e.g. GET /LinkedTransactions?ContactID=4bb34b03-3378-4bb2-a0ed-6345abf3224e&Status=APPROVED. + * @param targetTransactionID Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { + HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Retrieve linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions getLinkedTransactions(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + if (page != null) { + String key = "page"; + Object value = page; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (linkedTransactionID != null) { + String key = "LinkedTransactionID"; + Object value = linkedTransactionID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (sourceTransactionID != null) { + String key = "SourceTransactionID"; + Object value = sourceTransactionID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (contactID != null) { + String key = "ContactID"; + Object value = contactID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (targetTransactionID != null) { + String key = "TargetTransactionID"; + Object value = targetTransactionID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified manual journals + *

200 - Success - return response of type ManualJournals array with a specified ManualJournals + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID) throws IOException { + HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified manual journals + *

200 - Success - return response of type ManualJournals array with a specified ManualJournals + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { + HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournal"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournal"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve specified Attachment on ManualJournal by file name + *

200 - Success - return response of attachment for Manual Journal as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param fileName The name of the file being attached to a ManualJournal + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { + HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve specified Attachment on ManualJournal by file name + *

200 - Success - return response of attachment for Manual Journal as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param fileName The name of the file being attached to a ManualJournal + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve specified Attachment on ManualJournals + *

200 - Success - return response of attachment for Manual Journal as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve specified Attachment on ManualJournals + *

200 - Success - return response of attachment for Manual Journal as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachment for manual journals + *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID) throws IOException { + HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachment for manual journals + *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { + HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenantId, UUID manualJournalID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve any manual journals + *

200 - Success - return response of type ManualJournals array with a all ManualJournals + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any manual journals + *

200 - Success - return response of type ManualJournals array with a all ManualJournals + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals getManualJournals(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a URL to an online invoice + *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @return OnlineInvoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a URL to an online invoice + *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return OnlineInvoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/OnlineInvoice"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/OnlineInvoice"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. + *

200 - Success - return response of type Organisation array with specified Organisation + * @param xeroTenantId Xero identifier for Tenant + * @param organisationID The organisationID parameter + * @return CISOrgSetting + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID) throws IOException { + HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. + *

200 - Success - return response of type Organisation array with specified Organisation + * @param xeroTenantId Xero identifier for Tenant + * @param organisationID The organisationID parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return CISOrgSetting + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID, Map params) throws IOException { + HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantId, UUID organisationID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); + }// verify the required parameter 'organisationID' is set + if (organisationID == null) { + throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OrganisationID", organisationID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation/{OrganisationID}/CISSettings"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantId, UUID organisationID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); + }// verify the required parameter 'organisationID' is set + if (organisationID == null) { + throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OrganisationID", organisationID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation/{OrganisationID}/CISSettings"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Organisation details + *

200 - Success - return response of type Organisation array with all Organisation + * @param xeroTenantId Xero identifier for Tenant + * @return Organisations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Organisations getOrganisations(String xeroTenantId) throws IOException { + HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Organisation details + *

200 - Success - return response of type Organisation array with all Organisation + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Organisations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Organisations getOrganisations(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified overpayments + *

200 - Success - return response of type Overpayments array with specified Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @return Overpayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID) throws IOException { + HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified overpayments + *

200 - Success - return response of type Overpayments array with specified Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Overpayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { + HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID overpaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayment"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayment"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an Overpayment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID) throws IOException { + HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an Overpayment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { + HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve overpayments + *

200 - Success - return response of type Overpayments array with all Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return Overpayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve overpayments + *

200 - Success - return response of type Overpayments array with all Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Overpayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Overpayments getOverpayments(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified payment for invoices and credit notes + *

200 - Success - return response of type Payments array for specified Payment + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments getPayment(String xeroTenantId, UUID paymentID) throws IOException { + HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified payment for invoices and credit notes + *

200 - Success - return response of type Payments array for specified Payment + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments getPayment(String xeroTenantId, UUID paymentID, Map params) throws IOException { + HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve history records of a payment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) throws IOException { + HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve history records of a payment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID, Map params) throws IOException { + HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve payment services + *

200 - Success - return response of type PaymentServices array for all PaymentService + * @param xeroTenantId Xero identifier for Tenant + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices getPaymentServices(String xeroTenantId) throws IOException { + HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve payment services + *

200 - Success - return response of type PaymentServices array for all PaymentService + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices getPaymentServices(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve payments for invoices and credit notes + *

200 - Success - return response of type Payments array for all Payments + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments getPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve payments for invoices and credit notes + *

200 - Success - return response of type Payments array for all Payments + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments getPayments(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified prepayments + *

200 - Success - return response of type Prepayments array for a specified Prepayment + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID Unique identifier for a PrePayment + * @return Prepayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID) throws IOException { + HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified prepayments + *

200 - Success - return response of type Prepayments array for a specified Prepayment + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID Unique identifier for a PrePayment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Prepayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { + HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayment"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayment"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an Prepayment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID Unique identifier for a PrePayment + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID) throws IOException { + HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an Prepayment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID Unique identifier for a PrePayment + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { + HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve prepayments + *

200 - Success - return response of type Prepayments array for all Prepayment + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return Prepayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve prepayments + *

200 - Success - return response of type Prepayments array for all Prepayment + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Prepayments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Prepayments getPrepayments(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified purchase orders + *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID) throws IOException { + HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified purchase orders + *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { + HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve history for PurchaseOrder + *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID) throws IOException { + HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve history for PurchaseOrder + *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { + HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve purchase orders + *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param status Filter by purchase order status + * @param dateFrom Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 + * @param dateTo Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 + * @param order Order by an any element + * @param page To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned. + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { + HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve purchase orders + *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders getPurchaseOrders(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + if (status != null) { + String key = "Status"; + Object value = status; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (dateFrom != null) { + String key = "DateFrom"; + Object value = dateFrom; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (dateTo != null) { + String key = "DateTo"; + Object value = dateTo; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified draft expense claim receipts + *

200 - Success - return response of type Receipts array for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts getReceipt(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified draft expense claim receipts + *

200 - Success - return response of type Receipts array for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts getReceipt(String xeroTenantId, UUID receiptID, Map params) throws IOException { + HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipt"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipt"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on expense claim receipts by file name + *

200 - Success - return response of attachment for Receipt as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param fileName The name of the file being attached to the Receipt + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { + HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on expense claim receipts by file name + *

200 - Success - return response of attachment for Receipt as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param fileName The name of the file being attached to the Receipt + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on expense claim receipts by ID + *

200 - Success - return response of attachment for Receipt as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on expense claim receipts by ID + *

200 - Success - return response of attachment for Receipt as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getReceiptAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getReceiptAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments for expense claim receipts + *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments for expense claim receipts + *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID, Map params) throws IOException { + HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a history records of an Receipt + *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a history records of an Receipt + *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID, Map params) throws IOException { + HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve draft expense claim receipts for any user + *

200 - Success - return response of type Receipts array for all Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve draft expense claim receipts for any user + *

200 - Success - return response of type Receipts array for all Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts getReceipts(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified repeating invoice + *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @return RepeatingInvoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified repeating invoice + *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return RepeatingInvoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve specified attachment on repeating invoices by file name + *

200 - Success - return response of attachment for Repeating Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param fileName The name of the file being attached to a Repeating Invoice + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve specified attachment on repeating invoices by file name + *

200 - Success - return response of attachment for Repeating Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param fileName The name of the file being attached to a Repeating Invoice + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType, Map params) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified Attachments on repeating invoices + *

200 - Success - return response of attachment for Repeating Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified Attachments on repeating invoices + *

200 - Success - return response of attachment for Repeating Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public File getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType, Map params) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("AttachmentID", attachmentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Attachments on repeating invoice + *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Attachments on repeating invoice + *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve history for a repeating invoice + *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve history for a repeating invoice + *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve any repeating invoices + *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param where Filter by an any element + * @param order Order by an any element + * @return RepeatingInvoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve any repeating invoices + *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return RepeatingInvoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for AgedPayablesByContact + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param contactId Unique identifier for a Contact + * @param date The date of the Aged Payables By Contact report + * @param fromDate The from date of the Aged Payables By Contact report + * @param toDate The to date of the Aged Payables By Contact report + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for AgedPayablesByContact + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param contactId Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { + HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); + }// verify the required parameter 'contactId' is set + if (contactId == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedPayablesByContact"); + if (contactId != null) { + String key = "contactId"; + Object value = contactId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (fromDate != null) { + String key = "fromDate"; + Object value = fromDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (toDate != null) { + String key = "toDate"; + Object value = toDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTenantId, UUID contactId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); + }// verify the required parameter 'contactId' is set + if (contactId == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedPayablesByContact"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'contactId' to the map of query params + allParams.put("contactId", contactId); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for AgedReceivablesByContact + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param contactId Unique identifier for a Contact + * @param date The date of the Aged Receivables By Contact report + * @param fromDate The from date of the Aged Receivables By Contact report + * @param toDate The to date of the Aged Receivables By Contact report + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for AgedReceivablesByContact + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param contactId Unique identifier for a Contact + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { + HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); + }// verify the required parameter 'contactId' is set + if (contactId == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedReceivablesByContact"); + if (contactId != null) { + String key = "contactId"; + Object value = contactId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (fromDate != null) { + String key = "fromDate"; + Object value = fromDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (toDate != null) { + String key = "toDate"; + Object value = toDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xeroTenantId, UUID contactId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); + }// verify the required parameter 'contactId' is set + if (contactId == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedReceivablesByContact"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'contactId' to the map of query params + allParams.put("contactId", contactId); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for BAS only valid for AU orgs + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param reportID Unique identifier for a Report + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) throws IOException { + HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for BAS only valid for AU orgs + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param reportID Unique identifier for a Report + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID, Map params) throws IOException { + HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String reportID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); + }// verify the required parameter 'reportID' is set + if (reportID == null) { + throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReportID", reportID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/{ReportID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String reportID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); + }// verify the required parameter 'reportID' is set + if (reportID == null) { + throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReportID", reportID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/{ReportID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for BAS only valid for AU orgs + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws IOException { + HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for BAS only valid for AU orgs + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBASorGSTList(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for BalanceSheet + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param date The date of the Balance Sheet report + * @param periods The number of periods for the Balance Sheet report + * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) + * @param trackingOptionID1 The tracking option 1 for the Balance Sheet report + * @param trackingOptionID2 The tracking option 2 for the Balance Sheet report + * @param standardLayout The standard layout boolean for the Balance Sheet report + * @param paymentsOnly return a cash basis for the Balance Sheet report + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for BalanceSheet + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBalanceSheet(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BalanceSheet"); + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (periods != null) { + String key = "periods"; + Object value = periods; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingOptionID1 != null) { + String key = "trackingOptionID1"; + Object value = trackingOptionID1; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingOptionID2 != null) { + String key = "trackingOptionID2"; + Object value = trackingOptionID2; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (standardLayout != null) { + String key = "standardLayout"; + Object value = standardLayout; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BalanceSheet"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for BankSummary + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param date The date for the Bank Summary report e.g. 2018-03-31 + * @param period The number of periods to compare (integer between 1 and 12) + * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, date, period, timeframe); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for BankSummary + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBankSummary(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BankSummary"); + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (period != null) { + String key = "period"; + Object value = period; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BankSummary"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for Budget Summary + *

200 - success- return a Report with Rows object + * @param xeroTenantId Xero identifier for Tenant + * @param date The date for the Bank Summary report e.g. 2018-03-31 + * @param period The number of periods to compare (integer between 1 and 12) + * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, date, period, timeframe); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for Budget Summary + *

200 - success- return a Report with Rows object + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBudgetSummary(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BudgetSummary"); + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (period != null) { + String key = "period"; + Object value = period; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BudgetSummary"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for ExecutiveSummary + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param date The date for the Bank Summary report e.g. 2018-03-31 + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate date) throws IOException { + HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, date); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for ExecutiveSummary + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportExecutiveSummary(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId, LocalDate date) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ExecutiveSummary"); + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ExecutiveSummary"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for ProfitAndLoss + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param fromDate The from date for the ProfitAndLoss report e.g. 2018-03-31 + * @param toDate The to date for the ProfitAndLoss report e.g. 2018-03-31 + * @param periods The number of periods to compare (integer between 1 and 12) + * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) + * @param trackingCategoryID The trackingCategory 1 for the ProfitAndLoss report + * @param trackingCategoryID2 The trackingCategory 2 for the ProfitAndLoss report + * @param trackingOptionID The tracking option 1 for the ProfitAndLoss report + * @param trackingOptionID2 The tracking option 2 for the ProfitAndLoss report + * @param standardLayout Return the standard layout for the ProfitAndLoss report + * @param paymentsOnly Return cash only basis for the ProfitAndLoss report + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for ProfitAndLoss + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportProfitAndLoss(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ProfitAndLoss"); + if (fromDate != null) { + String key = "fromDate"; + Object value = fromDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (toDate != null) { + String key = "toDate"; + Object value = toDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (periods != null) { + String key = "periods"; + Object value = periods; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingCategoryID != null) { + String key = "trackingCategoryID"; + Object value = trackingCategoryID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingCategoryID2 != null) { + String key = "trackingCategoryID2"; + Object value = trackingCategoryID2; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingOptionID != null) { + String key = "trackingOptionID"; + Object value = trackingOptionID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingOptionID2 != null) { + String key = "trackingOptionID2"; + Object value = trackingOptionID2; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (standardLayout != null) { + String key = "standardLayout"; + Object value = standardLayout; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ProfitAndLoss"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for TenNinetyNine + *

200 - Success - return response of type Reports + * @param xeroTenantId Xero identifier for Tenant + * @param reportYear The year of the 1099 report + * @return Reports + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) throws IOException { + HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, reportYear); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for TenNinetyNine + *

200 - Success - return response of type Reports + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Reports + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Reports getReportTenNinetyNine(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, String reportYear) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TenNinetyNine"); + if (reportYear != null) { + String key = "reportYear"; + Object value = reportYear; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TenNinetyNine"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve report for TrialBalance + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param date The date for the Trial Balance report e.g. 2018-03-31 + * @param paymentsOnly Return cash only basis for the Trial Balance report + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, date, paymentsOnly); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve report for TrialBalance + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportTrialBalance(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TrialBalance"); + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TrialBalance"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve Tax Rates + *

200 - Success - return response of type TaxRates array with TaxRates + * @param xeroTenantId Xero identifier for Tenant + * @param where Filter by an any element + * @param order Order by an any element + * @param taxType Filter by tax type + * @return TaxRates + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TaxRates getTaxRates(String xeroTenantId, String where, String order, String taxType) throws IOException { + HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, where, order, taxType); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve Tax Rates + *

200 - Success - return response of type TaxRates array with TaxRates + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TaxRates + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TaxRates getTaxRates(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, String where, String order, String taxType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (taxType != null) { + String key = "TaxType"; + Object value = taxType; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve tracking categories and options + *

200 - Success - return response of type TrackingCategories array of TrackingCategory + * @param xeroTenantId Xero identifier for Tenant + * @param where Filter by an any element + * @param order Order by an any element + * @param includeArchived e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories getTrackingCategories(String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { + HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, where, order, includeArchived); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve tracking categories and options + *

200 - Success - return response of type TrackingCategories array of TrackingCategory + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories getTrackingCategories(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (includeArchived != null) { + String key = "includeArchived"; + Object value = includeArchived; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve tracking categories and options for specified category + *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { + HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve tracking categories and options for specified category + *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified user + *

200 - Success - return response of type Users array of specified User + * @param xeroTenantId Xero identifier for Tenant + * @param userID Unique identifier for a User + * @return Users + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Users getUser(String xeroTenantId, UUID userID) throws IOException { + HttpResponse response = getUserForHttpResponse(xeroTenantId, userID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified user + *

200 - Success - return response of type Users array of specified User + * @param xeroTenantId Xero identifier for Tenant + * @param userID Unique identifier for a User + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Users + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Users getUser(String xeroTenantId, UUID userID, Map params) throws IOException { + HttpResponse response = getUserForHttpResponse(xeroTenantId, userID, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUser"); + }// verify the required parameter 'userID' is set + if (userID == null) { + throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("UserID", userID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users/{UserID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUser"); + }// verify the required parameter 'userID' is set + if (userID == null) { + throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("UserID", userID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users/{UserID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve users + *

200 - Success - return response of type Users array of all User + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return Users + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getUsersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve users + *

200 - Success - return response of type Users array of all User + * @param xeroTenantId Xero identifier for Tenant + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Users + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Users getUsers(String xeroTenantId, Map params) throws IOException { + HttpResponse response = getUsersForHttpResponse(xeroTenantId, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getUsersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users"); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + public HttpResponse getUsersForHttpResponse(String xeroTenantId, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + } + + + /** + * Allows you to update a chart of accounts + *

200 - Success - update existing Account and return response of type Accounts array with updated Account + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for retrieving single object + * @param accounts Request of type Accounts array with one Account + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { + HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update a chart of accounts + *

200 - Success - update existing Account and return response of type Accounts array with updated Account + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for retrieving single object + * @param accounts Request of type Accounts array with one Account + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts, Map params) throws IOException { + HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); + }// verify the required parameter 'accounts' is set + if (accounts == null) { + throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, java.io.InputStream accounts, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); + }// verify the required parameter 'accounts' is set + if (accounts == null) { + throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = accounts == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, accounts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, Accounts accounts, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); + }// verify the required parameter 'accounts' is set + if (accounts == null) { + throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update Attachment on Account by Filename + *

200 - Success - return response of type Attachments array of Attachment + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param fileName Name of the attachment + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update Attachment on Account by Filename + *

200 - Success - return response of type Attachments array of Attachment + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param fileName Name of the attachment + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update a single spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with updated BankTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param bankTransactions The bankTransactions parameter + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { + HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update a single spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with updated BankTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param bankTransactions The bankTransactions parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions, Map params) throws IOException { + HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, java.io.InputStream bankTransactions, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = bankTransactions == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update an Attachment on BankTransaction by Filename + *

200 - Success - return response of Attachments array of Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param fileName The name of the file being attached + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update an Attachment on BankTransaction by Filename + *

200 - Success - return response of Attachments array of Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param fileName The name of the file being attached + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param fileName The name of the file being attached to a Bank Transfer + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param fileName The name of the file being attached to a Bank Transfer + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + *

200 - Success - return response of type Contacts array with an updated Contact + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param contacts an array of Contacts containing single Contact object with properties to update + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { + HttpResponse response = updateContactForHttpResponse(xeroTenantId, contactID, contacts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + *

200 - Success - return response of type Contacts array with an updated Contact + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param contacts an array of Contacts containing single Contact object with properties to update + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts, Map params) throws IOException { + HttpResponse response = updateContactForHttpResponse(xeroTenantId, contactID, contacts, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, java.io.InputStream contacts, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = contacts == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, Contacts contacts, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + *

200 - Success - return response of type Attachments array with an updated Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param fileName Name for the file you are attaching + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + *

200 - Success - return response of type Attachments array with an updated Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param fileName Name for the file you are attaching + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update a Contract Group + *

200 - Success - return response of type Contact Groups array of updated Contact Group + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param contactGroups an array of Contact groups with Name of specific group to update + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { + HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update a Contract Group + *

200 - Success - return response of type Contact Groups array of updated Contact Group + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param contactGroups an array of Contact groups with Name of specific group to update + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups, Map params) throws IOException { + HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, java.io.InputStream contactGroups, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = contactGroups == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); + }// verify the required parameter 'contactGroups' is set + if (contactGroups == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update a specific credit note + *

200 - Success - return response of type Credit Notes array with updated CreditNote + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param creditNotes an array of Credit Notes containing credit note details to update + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { + HttpResponse response = updateCreditNoteForHttpResponse(xeroTenantId, creditNoteID, creditNotes); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update a specific credit note + *

200 - Success - return response of type Credit Notes array with updated CreditNote + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param creditNotes an array of Credit Notes containing credit note details to update + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes, Map params) throws IOException { + HttpResponse response = updateCreditNoteForHttpResponse(xeroTenantId, creditNoteID, creditNotes, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream creditNotes, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = creditNotes == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update Attachments on CreditNote by file name + *

200 - Success - return response of type Attachments array with updated Attachment for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param fileName Name of the file you are attaching to Credit Note + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update Attachments on CreditNote by file name + *

200 - Success - return response of type Attachments array with updated Attachment for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param fileName Name of the file you are attaching to Credit Note + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update a specific employee used in Xero payrun + *

200 - Success - return response of type Employees array with updated Employee + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param employeeID Unique identifier for a Employee + * @param employees The employees parameter + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees) throws IOException { + HttpResponse response = updateEmployeeForHttpResponse(xeroTenantId, employeeID, employees); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update a specific employee used in Xero payrun + *

200 - Success - return response of type Employees array with updated Employee + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param employeeID Unique identifier for a Employee + * @param employees The employees parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees, Map params) throws IOException { + HttpResponse response = updateEmployeeForHttpResponse(xeroTenantId, employeeID, employees, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Employees employees) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); + } + // 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, java.io.InputStream employees, String mediaType) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); + } + // 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); + + HttpContent content = employees == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Employees employees, Map params) 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 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("EmployeeID", employeeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update specified expense claims + *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param expenseClaims The expenseClaims parameter + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { + HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update specified expense claims + *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param expenseClaims The expenseClaims parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims, Map params) throws IOException { + HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, java.io.InputStream expenseClaims, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = expenseClaims == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update a specified sales invoices or purchase bills + *

200 - Success - return response of type Invoices array with updated Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param invoices The invoices parameter + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { + HttpResponse response = updateInvoiceForHttpResponse(xeroTenantId, invoiceID, invoices); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update a specified sales invoices or purchase bills + *

200 - Success - return response of type Invoices array with updated Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param invoices The invoices parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices, Map params) throws IOException { + HttpResponse response = updateInvoiceForHttpResponse(xeroTenantId, invoiceID, invoices, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream invoices, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = invoices == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Invoices invoices, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update Attachment on invoices or purchase bills by it's filename + *

200 - Success - return response of type Attachments array with updated Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param fileName Name of the file you are attaching + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update Attachment on invoices or purchase bills by it's filename + *

200 - Success - return response of type Attachments array with updated Attachment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param fileName Name of the file you are attaching + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to udpate a specified item + *

200 - Success - return response of type Items array with updated Item + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @param items The items parameter + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items updateItem(String xeroTenantId, UUID itemID, Items items) throws IOException { + HttpResponse response = updateItemForHttpResponse(xeroTenantId, itemID, items); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to udpate a specified item + *

200 - Success - return response of type Items array with updated Item + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @param items The items parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items updateItem(String xeroTenantId, UUID itemID, Items items, Map params) throws IOException { + HttpResponse response = updateItemForHttpResponse(xeroTenantId, itemID, items, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, Items items) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(items); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, java.io.InputStream items, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = items == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, Items items, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(items); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update a specified linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with updated LinkedTransaction + *

400 - Success - return response of type LinkedTransactions array with updated LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @param linkedTransactions The linkedTransactions parameter + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { + HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update a specified linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with updated LinkedTransaction + *

400 - Success - return response of type LinkedTransactions array with updated LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @param linkedTransactions The linkedTransactions parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions, Map params) throws IOException { + HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, java.io.InputStream linkedTransactions, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = linkedTransactions == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update a specified manual journal + *

200 - Success - return response of type ManualJournals array with an updated ManualJournal + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param manualJournals The manualJournals parameter + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { + HttpResponse response = updateManualJournalForHttpResponse(xeroTenantId, manualJournalID, manualJournals); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update a specified manual journal + *

200 - Success - return response of type ManualJournals array with an updated ManualJournal + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param manualJournals The manualJournals parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals, Map params) throws IOException { + HttpResponse response = updateManualJournalForHttpResponse(xeroTenantId, manualJournalID, manualJournals, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, java.io.InputStream manualJournals, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = manualJournals == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update a specified Attachment on ManualJournal by file name + *

200 - Success - return response of type Attachments array with an update Attachment for a ManualJournals + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param fileName The name of the file being attached to a ManualJournal + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update a specified Attachment on ManualJournal by file name + *

200 - Success - return response of type Attachments array with an update Attachment for a ManualJournals + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param fileName The name of the file being attached to a ManualJournal + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update a specified purchase order + *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @param purchaseOrders The purchaseOrders parameter + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { + HttpResponse response = updatePurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, purchaseOrders); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update a specified purchase order + *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @param purchaseOrders The purchaseOrders parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders, Map params) throws IOException { + HttpResponse response = updatePurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, purchaseOrders, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, java.io.InputStream purchaseOrders, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = purchaseOrders == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to retrieve a specified draft expense claim receipts + *

200 - Success - return response of type Receipts array for updated Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param receipts The receipts parameter + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { + HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to retrieve a specified draft expense claim receipts + *

200 - Success - return response of type Receipts array for updated Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param receipts The receipts parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts, Map params) throws IOException { + HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, java.io.InputStream receipts, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = receipts == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Receipts receipts, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); + }// verify the required parameter 'receipts' is set + if (receipts == null) { + throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update Attachment on expense claim receipts by file name + *

200 - Success - return response of type Attachments array with updated Attachment for a specified Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param fileName The name of the file being attached to the Receipt + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update Attachment on expense claim receipts by file name + *

200 - Success - return response of type Attachments array with updated Attachment for a specified Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param fileName The name of the file being attached to the Receipt + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update specified attachment on repeating invoices by file name + *

200 - Success - return response of type Attachments array with specified Attachment for a specified Repeating Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param fileName The name of the file being attached to a Repeating Invoice + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update specified attachment on repeating invoices by file name + *

200 - Success - return response of type Attachments array with specified Attachment for a specified Repeating Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param fileName The name of the file being attached to a Repeating Invoice + * @param body Byte array of file in body of request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { + HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update Tax Rates + *

200 - Success - return response of type TaxRates array updated TaxRate + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param taxRates The taxRates parameter + * @return TaxRates + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { + HttpResponse response = updateTaxRateForHttpResponse(xeroTenantId, taxRates); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update Tax Rates + *

200 - Success - return response of type TaxRates array updated TaxRate + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param taxRates The taxRates parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TaxRates + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { + HttpResponse response = updateTaxRateForHttpResponse(xeroTenantId, taxRates, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, java.io.InputStream taxRates, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = taxRates == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); + }// verify the required parameter 'taxRates' is set + if (taxRates == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + + /** + * Allows you to update tracking categories + *

200 - Success - return response of type TrackingCategories array of updated TrackingCategory + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param trackingCategory The trackingCategory parameter + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { + HttpResponse response = updateTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, trackingCategory); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Allows you to update tracking categories + *

200 - Success - return response of type TrackingCategories array of updated TrackingCategory + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param trackingCategory The trackingCategory parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory, Map params) throws IOException { + HttpResponse response = updateTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, trackingCategory, params); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, java.io.InputStream trackingCategory, String mediaType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = trackingCategory == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } + + public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory, Map params) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set + if (trackingCategory == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + } - /** - * Allows you to delete a chart of accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for retrieving single object (required) - * @return ApiResponse<Accounts> - * @throws ApiException if fails to make API call - */ - public ApiResponse deleteAccountWithHttpInfo(String xeroTenantId, UUID accountID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteAccount"); - } - - // verify the required parameter 'accountID' is set - if (accountID == null) { - throw new ApiException(400, "Missing the required parameter 'accountID' when calling deleteAccount"); - } - - // create path and map variables - String localVarPath = "/Accounts/{AccountID}" - .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to delete a specific Contact from a Contract Group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroupID Unique identifier for a Contact Group (required) - * @param contactID Unique identifier for a Contact (required) - * @throws ApiException if fails to make API call - */ - public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID) throws ApiException { - - deleteContactGroupContactWithHttpInfo(xeroTenantId, contactGroupID, contactID); - } - - /** - * Allows you to delete a specific Contact from a Contract Group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroupID Unique identifier for a Contact Group (required) - * @param contactID Unique identifier for a Contact (required) - * @throws ApiException if fails to make API call - */ - public ApiResponse deleteContactGroupContactWithHttpInfo(String xeroTenantId, UUID contactGroupID, UUID contactID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); - } - - // verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new ApiException(400, "Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); - } - - // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new ApiException(400, "Missing the required parameter 'contactID' when calling deleteContactGroupContact"); - } - - // create path and map variables - String localVarPath = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}" - .replaceAll("\\{" + "ContactGroupID" + "\\}", apiClient.escapeString(contactGroupID.toString())) - .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Allows you to delete all Contacts from a Contract Group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroupID Unique identifier for a Contact Group (required) - * @throws ApiException if fails to make API call - */ - public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID) throws ApiException { - - deleteContactGroupContactsWithHttpInfo(xeroTenantId, contactGroupID); - } - - /** - * Allows you to delete all Contacts from a Contract Group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroupID Unique identifier for a Contact Group (required) - * @throws ApiException if fails to make API call - */ - public ApiResponse deleteContactGroupContactsWithHttpInfo(String xeroTenantId, UUID contactGroupID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); - } - - // verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new ApiException(400, "Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); - } - - // create path and map variables - String localVarPath = "/ContactGroups/{ContactGroupID}/Contacts" - .replaceAll("\\{" + "ContactGroupID" + "\\}", apiClient.escapeString(contactGroupID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Allows you to delete a specified item - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param itemID Unique identifier for an Item (required) - * @throws ApiException if fails to make API call - */ - public void deleteItem(String xeroTenantId, UUID itemID) throws ApiException { - - deleteItemWithHttpInfo(xeroTenantId, itemID); - } - - /** - * Allows you to delete a specified item - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param itemID Unique identifier for an Item (required) - * @throws ApiException if fails to make API call - */ - public ApiResponse deleteItemWithHttpInfo(String xeroTenantId, UUID itemID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteItem"); - } - - // verify the required parameter 'itemID' is set - if (itemID == null) { - throw new ApiException(400, "Missing the required parameter 'itemID' when calling deleteItem"); - } - - // create path and map variables - String localVarPath = "/Items/{ItemID}" - .replaceAll("\\{" + "ItemID" + "\\}", apiClient.escapeString(itemID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Allows you to delete a specified linked transactions (billable expenses) - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) - * @throws ApiException if fails to make API call - */ - public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws ApiException { - - deleteLinkedTransactionWithHttpInfo(xeroTenantId, linkedTransactionID); - } - - /** - * Allows you to delete a specified linked transactions (billable expenses) - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) - * @throws ApiException if fails to make API call - */ - public ApiResponse deleteLinkedTransactionWithHttpInfo(String xeroTenantId, UUID linkedTransactionID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); - } - - // verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); - } - - // create path and map variables - String localVarPath = "/LinkedTransactions/{LinkedTransactionID}" - .replaceAll("\\{" + "LinkedTransactionID" + "\\}", apiClient.escapeString(linkedTransactionID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Allows you to update a specified payment for invoices and credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param paymentID Unique identifier for a Payment (required) - * @param payments (required) - * @return Payments - * @throws ApiException if fails to make API call - */ - public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments) throws ApiException { - return deletePaymentWithHttpInfo(xeroTenantId, paymentID, payments).getData(); - } - /** - * Allows you to update a specified payment for invoices and credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param paymentID Unique identifier for a Payment (required) - * @param payments (required) - * @return ApiResponse<Payments> - * @throws ApiException if fails to make API call - */ - public ApiResponse deletePaymentWithHttpInfo(String xeroTenantId, UUID paymentID, Payments payments) throws ApiException { - Object localVarPostBody = payments; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deletePayment"); - } - - // verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new ApiException(400, "Missing the required parameter 'paymentID' when calling deletePayment"); - } - - // verify the required parameter 'payments' is set - if (payments == null) { - throw new ApiException(400, "Missing the required parameter 'payments' when calling deletePayment"); - } - - // create path and map variables - String localVarPath = "/Payments/{PaymentID}" - .replaceAll("\\{" + "PaymentID" + "\\}", apiClient.escapeString(paymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to delete tracking categories - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategoryID Unique identifier for a TrackingCategory (required) - * @return TrackingCategories - * @throws ApiException if fails to make API call - */ - public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws ApiException { - return deleteTrackingCategoryWithHttpInfo(xeroTenantId, trackingCategoryID).getData(); - } - - /** - * Allows you to delete tracking categories - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategoryID Unique identifier for a TrackingCategory (required) - * @return ApiResponse<TrackingCategories> - * @throws ApiException if fails to make API call - */ - public ApiResponse deleteTrackingCategoryWithHttpInfo(String xeroTenantId, UUID trackingCategoryID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); - } - - // verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new ApiException(400, "Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); - } - - // create path and map variables - String localVarPath = "/TrackingCategories/{TrackingCategoryID}" - .replaceAll("\\{" + "TrackingCategoryID" + "\\}", apiClient.escapeString(trackingCategoryID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to delete a specified option for a specified tracking category - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategoryID Unique identifier for a TrackingCategory (required) - * @param trackingOptionID Unique identifier for a Tracking Option (required) - * @return TrackingOptions - * @throws ApiException if fails to make API call - */ - public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws ApiException { - return deleteTrackingOptionsWithHttpInfo(xeroTenantId, trackingCategoryID, trackingOptionID).getData(); - } - - /** - * Allows you to delete a specified option for a specified tracking category - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategoryID Unique identifier for a TrackingCategory (required) - * @param trackingOptionID Unique identifier for a Tracking Option (required) - * @return ApiResponse<TrackingOptions> - * @throws ApiException if fails to make API call - */ - public ApiResponse deleteTrackingOptionsWithHttpInfo(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); - } - - // verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new ApiException(400, "Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); - } - - // verify the required parameter 'trackingOptionID' is set - if (trackingOptionID == null) { - throw new ApiException(400, "Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); - } - - // create path and map variables - String localVarPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}" - .replaceAll("\\{" + "TrackingCategoryID" + "\\}", apiClient.escapeString(trackingCategoryID.toString())) - .replaceAll("\\{" + "TrackingOptionID" + "\\}", apiClient.escapeString(trackingOptionID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to email a copy of invoice to related Contact - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param requestEmpty (required) - * @throws ApiException if fails to make API call - */ - public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws ApiException { - - emailInvoiceWithHttpInfo(xeroTenantId, invoiceID, requestEmpty); - } - - /** - * Allows you to email a copy of invoice to related Contact - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param requestEmpty (required) - * @throws ApiException if fails to make API call - */ - public ApiResponse emailInvoiceWithHttpInfo(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws ApiException { - Object localVarPostBody = requestEmpty; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling emailInvoice"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling emailInvoice"); - } - - // verify the required parameter 'requestEmpty' is set - if (requestEmpty == null) { - throw new ApiException(400, "Missing the required parameter 'requestEmpty' when calling emailInvoice"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}/Email" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * Allows you to retrieve a single chart of accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for retrieving single object (required) - * @return Accounts - * @throws ApiException if fails to make API call - */ - public Accounts getAccount(String xeroTenantId, UUID accountID) throws ApiException { - return getAccountWithHttpInfo(xeroTenantId, accountID).getData(); - } - - /** - * Allows you to retrieve a single chart of accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for retrieving single object (required) - * @return ApiResponse<Accounts> - * @throws ApiException if fails to make API call - */ - public ApiResponse getAccountWithHttpInfo(String xeroTenantId, UUID accountID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getAccount"); - } - - // verify the required parameter 'accountID' is set - if (accountID == null) { - throw new ApiException(400, "Missing the required parameter 'accountID' when calling getAccount"); - } - - // create path and map variables - String localVarPath = "/Accounts/{AccountID}" - .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachment on Account by Filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for Account object (required) - * @param fileName Name of the attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType) throws ApiException { - return getAccountAttachmentByFileNameWithHttpInfo(xeroTenantId, accountID, fileName, contentType).getData(); - } - - /** - * Allows you to retrieve Attachment on Account by Filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for Account object (required) - * @param fileName Name of the attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getAccountAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID accountID, String fileName, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); - } - - // verify the required parameter 'accountID' is set - if (accountID == null) { - throw new ApiException(400, "Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling getAccountAttachmentByFileName"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Accounts/{AccountID}/Attachments/{FileName}" - .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve specific Attachment on Account - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for Account object (required) - * @param attachmentID Unique identifier for Attachment object (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws ApiException { - return getAccountAttachmentByIdWithHttpInfo(xeroTenantId, accountID, attachmentID, contentType).getData(); - } - - /** - * Allows you to retrieve specific Attachment on Account - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for Account object (required) - * @param attachmentID Unique identifier for Attachment object (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getAccountAttachmentByIdWithHttpInfo(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); - } - - // verify the required parameter 'accountID' is set - if (accountID == null) { - throw new ApiException(400, "Missing the required parameter 'accountID' when calling getAccountAttachmentById"); - } - - // verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getAccountAttachmentById"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getAccountAttachmentById"); - } - - // create path and map variables - String localVarPath = "/Accounts/{AccountID}/Attachments/{AttachmentID}" - .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())) - .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments for accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for Account object (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) throws ApiException { - return getAccountAttachmentsWithHttpInfo(xeroTenantId, accountID).getData(); - } - - /** - * Allows you to retrieve Attachments for accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for Account object (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getAccountAttachmentsWithHttpInfo(String xeroTenantId, UUID accountID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); - } - - // verify the required parameter 'accountID' is set - if (accountID == null) { - throw new ApiException(400, "Missing the required parameter 'accountID' when calling getAccountAttachments"); - } - - // create path and map variables - String localVarPath = "/Accounts/{AccountID}/Attachments" - .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve the full chart of accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return Accounts - * @throws ApiException if fails to make API call - */ - public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - return getAccountsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); - } - - /** - * Allows you to retrieve the full chart of accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ApiResponse<Accounts> - * @throws ApiException if fails to make API call - */ - public ApiResponse getAccountsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getAccounts"); - } - - // create path and map variables - String localVarPath = "/Accounts"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "OAuth2" }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a single spend or receive money transaction - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @return BankTransactions - * @throws ApiException if fails to make API call - */ - public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID) throws ApiException { - return getBankTransactionWithHttpInfo(xeroTenantId, bankTransactionID).getData(); - } - - /** - * Allows you to retrieve a single spend or receive money transaction - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @return ApiResponse<BankTransactions> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransactionWithHttpInfo(String xeroTenantId, UUID bankTransactionID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); - } - - // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); - } - - // create path and map variables - String localVarPath = "/BankTransactions/{BankTransactionID}" - .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on BankTransaction by Filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param fileName The name of the file being attached (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws ApiException { - return getBankTransactionAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransactionID, fileName, contentType).getData(); - } - - /** - * Allows you to retrieve Attachments on BankTransaction by Filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param fileName The name of the file being attached (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransactionAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); - } - - // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling getBankTransactionAttachmentByFileName"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}" - .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on a specific BankTransaction - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param attachmentID Xero generated unique identifier for an attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws ApiException { - return getBankTransactionAttachmentByIdWithHttpInfo(xeroTenantId, bankTransactionID, attachmentID, contentType).getData(); - } - - /** - * Allows you to retrieve Attachments on a specific BankTransaction - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param attachmentID Xero generated unique identifier for an attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransactionAttachmentByIdWithHttpInfo(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); - } - - // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); - } - - // verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getBankTransactionAttachmentById"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); - } - - // create path and map variables - String localVarPath = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}" - .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())) - .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve any attachments to bank transactions - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID) throws ApiException { - return getBankTransactionAttachmentsWithHttpInfo(xeroTenantId, bankTransactionID).getData(); - } - - /** - * Allows you to retrieve any attachments to bank transactions - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransactionAttachmentsWithHttpInfo(String xeroTenantId, UUID bankTransactionID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); - } - - // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); - } - - // create path and map variables - String localVarPath = "/BankTransactions/{BankTransactionID}/Attachments" - .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve any spend or receive money transactions - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param page e.g. page=1 – Up to 100 bank transactions will be returned in a single API call with line items shown for each bank transaction (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return BankTransactions - * @throws ApiException if fails to make API call - */ - public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { - return getBankTransactionsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, page, unitdp).getData(); - } - - /** - * Allows you to retrieve any spend or receive money transactions - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param page e.g. page=1 – Up to 100 bank transactions will be returned in a single API call with line items shown for each bank transaction (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return ApiResponse<BankTransactions> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransactionsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); - } - - // create path and map variables - String localVarPath = "/BankTransactions"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve history from a bank transactions - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID) throws ApiException { - return getBankTransactionsHistoryWithHttpInfo(xeroTenantId, bankTransactionID).getData(); - } - - /** - * Allows you to retrieve history from a bank transactions - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransactionsHistoryWithHttpInfo(String xeroTenantId, UUID bankTransactionID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); - } - - // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); - } - - // create path and map variables - String localVarPath = "/BankTransactions/{BankTransactionID}/History" - .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve any bank transfers - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @return BankTransfers - * @throws ApiException if fails to make API call - */ - public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) throws ApiException { - return getBankTransferWithHttpInfo(xeroTenantId, bankTransferID).getData(); - } - - /** - * Allows you to retrieve any bank transfers - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @return ApiResponse<BankTransfers> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransferWithHttpInfo(String xeroTenantId, UUID bankTransferID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); - } - - // verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling getBankTransfer"); - } - - // create path and map variables - String localVarPath = "/BankTransfers/{BankTransferID}" - .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on BankTransfer by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @param fileName The name of the file being attached to a Bank Transfer (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws ApiException { - return getBankTransferAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransferID, fileName, contentType).getData(); - } - - /** - * Allows you to retrieve Attachments on BankTransfer by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @param fileName The name of the file being attached to a Bank Transfer (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransferAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); - } - - // verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling getBankTransferAttachmentByFileName"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}" - .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on BankTransfer - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws ApiException { - return getBankTransferAttachmentByIdWithHttpInfo(xeroTenantId, bankTransferID, attachmentID, contentType).getData(); - } - - /** - * Allows you to retrieve Attachments on BankTransfer - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransferAttachmentByIdWithHttpInfo(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); - } - - // verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); - } - - // verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getBankTransferAttachmentById"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); - } - - // create path and map variables - String localVarPath = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}" - .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())) - .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments from bank transfers - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID) throws ApiException { - return getBankTransferAttachmentsWithHttpInfo(xeroTenantId, bankTransferID).getData(); - } - - /** - * Allows you to retrieve Attachments from bank transfers - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransferAttachmentsWithHttpInfo(String xeroTenantId, UUID bankTransferID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); - } - - // verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); - } - - // create path and map variables - String localVarPath = "/BankTransfers/{BankTransferID}/Attachments" - .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve history from a bank transfers - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID) throws ApiException { - return getBankTransferHistoryWithHttpInfo(xeroTenantId, bankTransferID).getData(); - } - - /** - * Allows you to retrieve history from a bank transfers - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransferHistoryWithHttpInfo(String xeroTenantId, UUID bankTransferID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); - } - - // verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); - } - - // create path and map variables - String localVarPath = "/BankTransfers/{BankTransferID}/History" - .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve all bank transfers - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return BankTransfers - * @throws ApiException if fails to make API call - */ - public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - return getBankTransfersWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); - } - - /** - * Allows you to retrieve all bank transfers - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ApiResponse<BankTransfers> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBankTransfersWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); - } - - // create path and map variables - String localVarPath = "/BankTransfers"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve history from a Batch Payment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param batchPaymentID Unique identifier for BatchPayment (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID) throws ApiException { - return getBatchPaymentHistoryWithHttpInfo(xeroTenantId, batchPaymentID).getData(); - } - - /** - * Allows you to retrieve history from a Batch Payment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param batchPaymentID Unique identifier for BatchPayment (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBatchPaymentHistoryWithHttpInfo(String xeroTenantId, UUID batchPaymentID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); - } - - // verify the required parameter 'batchPaymentID' is set - if (batchPaymentID == null) { - throw new ApiException(400, "Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); - } - - // create path and map variables - String localVarPath = "/BatchPayments/{BatchPaymentID}/History" - .replaceAll("\\{" + "BatchPaymentID" + "\\}", apiClient.escapeString(batchPaymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Retrieve either one or many BatchPayments for invoices - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return BatchPayments - * @throws ApiException if fails to make API call - */ - public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - return getBatchPaymentsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); - } - - /** - * Retrieve either one or many BatchPayments for invoices - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ApiResponse<BatchPayments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBatchPaymentsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); - } - - // create path and map variables - String localVarPath = "/BatchPayments"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specific BrandingThemes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param brandingThemeID Unique identifier for a Branding Theme (required) - * @return BrandingThemes - * @throws ApiException if fails to make API call - */ - public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID) throws ApiException { - return getBrandingThemeWithHttpInfo(xeroTenantId, brandingThemeID).getData(); - } - - /** - * Allows you to retrieve a specific BrandingThemes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param brandingThemeID Unique identifier for a Branding Theme (required) - * @return ApiResponse<BrandingThemes> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBrandingThemeWithHttpInfo(String xeroTenantId, UUID brandingThemeID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); - } - - // verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new ApiException(400, "Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); - } - - // create path and map variables - String localVarPath = "/BrandingThemes/{BrandingThemeID}" - .replaceAll("\\{" + "BrandingThemeID" + "\\}", apiClient.escapeString(brandingThemeID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve the Payment services for a Branding Theme - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param brandingThemeID Unique identifier for a Branding Theme (required) - * @return PaymentServices - * @throws ApiException if fails to make API call - */ - public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID) throws ApiException { - return getBrandingThemePaymentServicesWithHttpInfo(xeroTenantId, brandingThemeID).getData(); - } - - /** - * Allows you to retrieve the Payment services for a Branding Theme - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param brandingThemeID Unique identifier for a Branding Theme (required) - * @return ApiResponse<PaymentServices> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBrandingThemePaymentServicesWithHttpInfo(String xeroTenantId, UUID brandingThemeID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); - } - - // verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new ApiException(400, "Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); - } - - // create path and map variables - String localVarPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices" - .replaceAll("\\{" + "BrandingThemeID" + "\\}", apiClient.escapeString(brandingThemeID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve all the BrandingThemes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @return BrandingThemes - * @throws ApiException if fails to make API call - */ - public BrandingThemes getBrandingThemes(String xeroTenantId) throws ApiException { - return getBrandingThemesWithHttpInfo(xeroTenantId).getData(); - } - - /** - * Allows you to retrieve all the BrandingThemes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @return ApiResponse<BrandingThemes> - * @throws ApiException if fails to make API call - */ - public ApiResponse getBrandingThemesWithHttpInfo(String xeroTenantId) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); - } - - // create path and map variables - String localVarPath = "/BrandingThemes"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @return Contacts - * @throws ApiException if fails to make API call - */ - public Contacts getContact(String xeroTenantId, UUID contactID) throws ApiException { - return getContactWithHttpInfo(xeroTenantId, contactID).getData(); - } - - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @return ApiResponse<Contacts> - * @throws ApiException if fails to make API call - */ - public ApiResponse getContactWithHttpInfo(String xeroTenantId, UUID contactID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContact"); - } - - // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContact"); - } - - // create path and map variables - String localVarPath = "/Contacts/{ContactID}" - .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on Contacts by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param fileName Name for the file you are attaching (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType) throws ApiException { - return getContactAttachmentByFileNameWithHttpInfo(xeroTenantId, contactID, fileName, contentType).getData(); - } - - /** - * Allows you to retrieve Attachments on Contacts by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param fileName Name for the file you are attaching (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getContactAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID contactID, String fileName, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); - } - - // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling getContactAttachmentByFileName"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Contacts/{ContactID}/Attachments/{FileName}" - .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on Contacts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param attachmentID Unique identifier for a Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws ApiException { - return getContactAttachmentByIdWithHttpInfo(xeroTenantId, contactID, attachmentID, contentType).getData(); - } - - /** - * Allows you to retrieve Attachments on Contacts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param attachmentID Unique identifier for a Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getContactAttachmentByIdWithHttpInfo(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); - } - - // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContactAttachmentById"); - } - - // verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getContactAttachmentById"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getContactAttachmentById"); - } - - // create path and map variables - String localVarPath = "/Contacts/{ContactID}/Attachments/{AttachmentID}" - .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())) - .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments getContactAttachments(String xeroTenantId, UUID contactID) throws ApiException { - return getContactAttachmentsWithHttpInfo(xeroTenantId, contactID).getData(); - } - - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getContactAttachmentsWithHttpInfo(String xeroTenantId, UUID contactID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); - } - - // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContactAttachments"); - } - - // create path and map variables - String localVarPath = "/Contacts/{ContactID}/Attachments" - .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve CISSettings for a contact in a Xero organisation - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @return CISSettings - * @throws ApiException if fails to make API call - */ - public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) throws ApiException { - return getContactCISSettingsWithHttpInfo(xeroTenantId, contactID).getData(); - } - - /** - * Allows you to retrieve CISSettings for a contact in a Xero organisation - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @return ApiResponse<CISSettings> - * @throws ApiException if fails to make API call - */ - public ApiResponse getContactCISSettingsWithHttpInfo(String xeroTenantId, UUID contactID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); - } - - // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContactCISSettings"); - } - - // create path and map variables - String localVarPath = "/Contacts/{ContactID}/CISSettings" - .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a unique Contract Group by ID - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroupID Unique identifier for a Contact Group (required) - * @return ContactGroups - * @throws ApiException if fails to make API call - */ - public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) throws ApiException { - return getContactGroupWithHttpInfo(xeroTenantId, contactGroupID).getData(); - } - - /** - * Allows you to retrieve a unique Contract Group by ID - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroupID Unique identifier for a Contact Group (required) - * @return ApiResponse<ContactGroups> - * @throws ApiException if fails to make API call - */ - public ApiResponse getContactGroupWithHttpInfo(String xeroTenantId, UUID contactGroupID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactGroup"); - } - - // verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new ApiException(400, "Missing the required parameter 'contactGroupID' when calling getContactGroup"); - } - - // create path and map variables - String localVarPath = "/ContactGroups/{ContactGroupID}" - .replaceAll("\\{" + "ContactGroupID" + "\\}", apiClient.escapeString(contactGroupID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve the ContactID and Name of all the contacts in a contact group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ContactGroups - * @throws ApiException if fails to make API call - */ - public ContactGroups getContactGroups(String xeroTenantId, String where, String order) throws ApiException { - return getContactGroupsWithHttpInfo(xeroTenantId, where, order).getData(); - } - - /** - * Allows you to retrieve the ContactID and Name of all the contacts in a contact group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ApiResponse<ContactGroups> - * @throws ApiException if fails to make API call - */ - public ApiResponse getContactGroupsWithHttpInfo(String xeroTenantId, String where, String order) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactGroups"); - } - - // create path and map variables - String localVarPath = "/ContactGroups"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a history records of an Contact - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID) throws ApiException { - return getContactHistoryWithHttpInfo(xeroTenantId, contactID).getData(); - } - - /** - * Allows you to retrieve a history records of an Contact - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getContactHistoryWithHttpInfo(String xeroTenantId, UUID contactID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContactHistory"); - } - - // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new ApiException(400, "Missing the required parameter 'contactID' when calling getContactHistory"); - } - - // create path and map variables - String localVarPath = "/Contacts/{ContactID}/History" - .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional) - * @param page e.g. page=1 - Up to 100 contacts will be returned in a single API call. (optional) - * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional) - * @return Contacts - * @throws ApiException if fails to make API call - */ - public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws ApiException { - return getContactsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, ids, page, includeArchived).getData(); - } - - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional) - * @param page e.g. page=1 - Up to 100 contacts will be returned in a single API call. (optional) - * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional) - * @return ApiResponse<Contacts> - * @throws ApiException if fails to make API call - */ - public ApiResponse getContactsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getContacts"); - } - - // create path and map variables - String localVarPath = "/Contacts"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "IDs", ids)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "includeArchived", includeArchived)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specific credit note - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @return CreditNotes - * @throws ApiException if fails to make API call - */ - public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID) throws ApiException { - return getCreditNoteWithHttpInfo(xeroTenantId, creditNoteID).getData(); - } - - /** - * Allows you to retrieve a specific credit note - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @return ApiResponse<CreditNotes> - * @throws ApiException if fails to make API call - */ - public ApiResponse getCreditNoteWithHttpInfo(String xeroTenantId, UUID creditNoteID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNote"); - } - - // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNote"); - } - - // create path and map variables - String localVarPath = "/CreditNotes/{CreditNoteID}" - .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Credit Note as PDF files - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType) throws ApiException { - return getCreditNoteAsPdfWithHttpInfo(xeroTenantId, creditNoteID, contentType).getData(); - } - - /** - * Allows you to retrieve Credit Note as PDF files - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getCreditNoteAsPdfWithHttpInfo(String xeroTenantId, UUID creditNoteID, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); - } - - // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); - } - - // create path and map variables - String localVarPath = "/CreditNotes/{CreditNoteID}/pdf" - .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on CreditNote by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param fileName Name of the file you are attaching to Credit Note (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws ApiException { - return getCreditNoteAttachmentByFileNameWithHttpInfo(xeroTenantId, creditNoteID, fileName, contentType).getData(); - } - - /** - * Allows you to retrieve Attachments on CreditNote by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param fileName Name of the file you are attaching to Credit Note (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getCreditNoteAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); - } - - // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling getCreditNoteAttachmentByFileName"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}" - .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on CreditNote - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param attachmentID Unique identifier for a Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws ApiException { - return getCreditNoteAttachmentByIdWithHttpInfo(xeroTenantId, creditNoteID, attachmentID, contentType).getData(); - } - - /** - * Allows you to retrieve Attachments on CreditNote - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param attachmentID Unique identifier for a Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getCreditNoteAttachmentByIdWithHttpInfo(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); - } - - // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); - } - - // verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getCreditNoteAttachmentById"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); - } - - // create path and map variables - String localVarPath = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}" - .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())) - .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments for credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID) throws ApiException { - return getCreditNoteAttachmentsWithHttpInfo(xeroTenantId, creditNoteID).getData(); - } - - /** - * Allows you to retrieve Attachments for credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getCreditNoteAttachmentsWithHttpInfo(String xeroTenantId, UUID creditNoteID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); - } - - // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); - } - - // create path and map variables - String localVarPath = "/CreditNotes/{CreditNoteID}/Attachments" - .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a history records of an CreditNote - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID) throws ApiException { - return getCreditNoteHistoryWithHttpInfo(xeroTenantId, creditNoteID).getData(); - } - - /** - * Allows you to retrieve a history records of an CreditNote - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getCreditNoteHistoryWithHttpInfo(String xeroTenantId, UUID creditNoteID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); - } - - // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); - } - - // create path and map variables - String localVarPath = "/CreditNotes/{CreditNoteID}/History" - .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve any credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param page e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional) - * @return CreditNotes - * @throws ApiException if fails to make API call - */ - public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws ApiException { - return getCreditNotesWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, page).getData(); - } - - /** - * Allows you to retrieve any credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param page e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional) - * @return ApiResponse<CreditNotes> - * @throws ApiException if fails to make API call - */ - public ApiResponse getCreditNotesWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); - } - - // create path and map variables - String localVarPath = "/CreditNotes"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve currencies for your organisation - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return Currencies - * @throws ApiException if fails to make API call - */ - public Currencies getCurrencies(String xeroTenantId, String where, String order) throws ApiException { - return getCurrenciesWithHttpInfo(xeroTenantId, where, order).getData(); - } - - /** - * Allows you to retrieve currencies for your organisation - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ApiResponse<Currencies> - * @throws ApiException if fails to make API call - */ - public ApiResponse getCurrenciesWithHttpInfo(String xeroTenantId, String where, String order) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getCurrencies"); - } - - // create path and map variables - String localVarPath = "/Currencies"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specific employee used in Xero payrun - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param employeeID Unique identifier for a Employee (required) - * @return Employees - * @throws ApiException if fails to make API call - */ - public Employees getEmployee(String xeroTenantId, UUID employeeID) throws ApiException { - return getEmployeeWithHttpInfo(xeroTenantId, employeeID).getData(); - } - - /** - * Allows you to retrieve a specific employee used in Xero payrun - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param employeeID Unique identifier for a Employee (required) - * @return ApiResponse<Employees> - * @throws ApiException if fails to make API call - */ - public ApiResponse getEmployeeWithHttpInfo(String xeroTenantId, UUID employeeID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getEmployee"); - } - - // verify the required parameter 'employeeID' is set - if (employeeID == null) { - throw new ApiException(400, "Missing the required parameter 'employeeID' when calling getEmployee"); - } - - // create path and map variables - String localVarPath = "/Employees/{EmployeeID}" - .replaceAll("\\{" + "EmployeeID" + "\\}", apiClient.escapeString(employeeID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve employees used in Xero payrun - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return Employees - * @throws ApiException if fails to make API call - */ - public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - return getEmployeesWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); - } - - /** - * Allows you to retrieve employees used in Xero payrun - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ApiResponse<Employees> - * @throws ApiException if fails to make API call - */ - public ApiResponse getEmployeesWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getEmployees"); - } - - // create path and map variables - String localVarPath = "/Employees"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified expense claim - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param expenseClaimID Unique identifier for a ExpenseClaim (required) - * @return ExpenseClaims - * @throws ApiException if fails to make API call - */ - public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID) throws ApiException { - return getExpenseClaimWithHttpInfo(xeroTenantId, expenseClaimID).getData(); - } - - /** - * Allows you to retrieve a specified expense claim - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param expenseClaimID Unique identifier for a ExpenseClaim (required) - * @return ApiResponse<ExpenseClaims> - * @throws ApiException if fails to make API call - */ - public ApiResponse getExpenseClaimWithHttpInfo(String xeroTenantId, UUID expenseClaimID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); - } - - // verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new ApiException(400, "Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); - } - - // create path and map variables - String localVarPath = "/ExpenseClaims/{ExpenseClaimID}" - .replaceAll("\\{" + "ExpenseClaimID" + "\\}", apiClient.escapeString(expenseClaimID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a history records of an ExpenseClaim - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param expenseClaimID Unique identifier for a ExpenseClaim (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID) throws ApiException { - return getExpenseClaimHistoryWithHttpInfo(xeroTenantId, expenseClaimID).getData(); - } - - /** - * Allows you to retrieve a history records of an ExpenseClaim - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param expenseClaimID Unique identifier for a ExpenseClaim (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getExpenseClaimHistoryWithHttpInfo(String xeroTenantId, UUID expenseClaimID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); - } - - // verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new ApiException(400, "Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); - } - - // create path and map variables - String localVarPath = "/ExpenseClaims/{ExpenseClaimID}/History" - .replaceAll("\\{" + "ExpenseClaimID" + "\\}", apiClient.escapeString(expenseClaimID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve expense claims - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ExpenseClaims - * @throws ApiException if fails to make API call - */ - public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - return getExpenseClaimsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); - } - - /** - * Allows you to retrieve expense claims - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ApiResponse<ExpenseClaims> - * @throws ApiException if fails to make API call - */ - public ApiResponse getExpenseClaimsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); - } - - // create path and map variables - String localVarPath = "/ExpenseClaims"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified sales invoice or purchase bill - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @return Invoices - * @throws ApiException if fails to make API call - */ - public Invoices getInvoice(String xeroTenantId, UUID invoiceID) throws ApiException { - return getInvoiceWithHttpInfo(xeroTenantId, invoiceID).getData(); - } - - /** - * Allows you to retrieve a specified sales invoice or purchase bill - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @return ApiResponse<Invoices> - * @throws ApiException if fails to make API call - */ - public ApiResponse getInvoiceWithHttpInfo(String xeroTenantId, UUID invoiceID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoice"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoice"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve invoices or purchase bills as PDF files - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType) throws ApiException { - return getInvoiceAsPdfWithHttpInfo(xeroTenantId, invoiceID, contentType).getData(); - } - - /** - * Allows you to retrieve invoices or purchase bills as PDF files - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getInvoiceAsPdfWithHttpInfo(String xeroTenantId, UUID invoiceID, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}/pdf" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachment on invoices or purchase bills by it's filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param fileName Name of the file you are attaching (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws ApiException { - return getInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, invoiceID, fileName, contentType).getData(); - } - - /** - * Allows you to retrieve Attachment on invoices or purchase bills by it's filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param fileName Name of the file you are attaching (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling getInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}/Attachments/{FileName}" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param attachmentID Unique identifier for an Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws ApiException { - return getInvoiceAttachmentByIdWithHttpInfo(xeroTenantId, invoiceID, attachmentID, contentType).getData(); - } - - /** - * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param attachmentID Unique identifier for an Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getInvoiceAttachmentByIdWithHttpInfo(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); - } - - // verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getInvoiceAttachmentById"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())) - .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on invoices or purchase bills - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) throws ApiException { - return getInvoiceAttachmentsWithHttpInfo(xeroTenantId, invoiceID).getData(); - } - - /** - * Allows you to retrieve Attachments on invoices or purchase bills - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getInvoiceAttachmentsWithHttpInfo(String xeroTenantId, UUID invoiceID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}/Attachments" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a history records of an invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) throws ApiException { - return getInvoiceHistoryWithHttpInfo(xeroTenantId, invoiceID).getData(); - } - - /** - * Allows you to retrieve a history records of an invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getInvoiceHistoryWithHttpInfo(String xeroTenantId, UUID invoiceID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}/History" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve invoice reminder settings - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @return InvoiceReminders - * @throws ApiException if fails to make API call - */ - public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws ApiException { - return getInvoiceRemindersWithHttpInfo(xeroTenantId).getData(); - } - - /** - * Allows you to retrieve invoice reminder settings - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @return ApiResponse<InvoiceReminders> - * @throws ApiException if fails to make API call - */ - public ApiResponse getInvoiceRemindersWithHttpInfo(String xeroTenantId) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); - } - - // create path and map variables - String localVarPath = "/InvoiceReminders/Settings"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve any sales invoices or purchase bills - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param ids Filter by a comma-separated list of InvoicesIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) - * @param invoiceNumbers Filter by a comma-separated list of InvoiceNumbers. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) - * @param contactIDs Filter by a comma-separated list of ContactIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) - * @param statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) - * @param page e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional) - * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional) - * @param createdByMyApp When set to true you'll only retrieve Invoices created by your app (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return Invoices - * @throws ApiException if fails to make API call - */ - public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws ApiException { - return getInvoicesWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp).getData(); - } - - /** - * Allows you to retrieve any sales invoices or purchase bills - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param ids Filter by a comma-separated list of InvoicesIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) - * @param invoiceNumbers Filter by a comma-separated list of InvoiceNumbers. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) - * @param contactIDs Filter by a comma-separated list of ContactIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) - * @param statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) - * @param page e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional) - * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional) - * @param createdByMyApp When set to true you'll only retrieve Invoices created by your app (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return ApiResponse<Invoices> - * @throws ApiException if fails to make API call - */ - public ApiResponse getInvoicesWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getInvoices"); - } - - // create path and map variables - String localVarPath = "/Invoices"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "IDs", ids)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "InvoiceNumbers", invoiceNumbers)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "ContactIDs", contactIDs)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "Statuses", statuses)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "includeArchived", includeArchived)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "createdByMyApp", createdByMyApp)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified item - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param itemID Unique identifier for an Item (required) - * @return Items - * @throws ApiException if fails to make API call - */ - public Items getItem(String xeroTenantId, UUID itemID) throws ApiException { - return getItemWithHttpInfo(xeroTenantId, itemID).getData(); - } - - /** - * Allows you to retrieve a specified item - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param itemID Unique identifier for an Item (required) - * @return ApiResponse<Items> - * @throws ApiException if fails to make API call - */ - public ApiResponse getItemWithHttpInfo(String xeroTenantId, UUID itemID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getItem"); - } - - // verify the required parameter 'itemID' is set - if (itemID == null) { - throw new ApiException(400, "Missing the required parameter 'itemID' when calling getItem"); - } - - // create path and map variables - String localVarPath = "/Items/{ItemID}" - .replaceAll("\\{" + "ItemID" + "\\}", apiClient.escapeString(itemID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve history for items - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param itemID Unique identifier for an Item (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws ApiException { - return getItemHistoryWithHttpInfo(xeroTenantId, itemID).getData(); - } - - /** - * Allows you to retrieve history for items - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param itemID Unique identifier for an Item (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getItemHistoryWithHttpInfo(String xeroTenantId, UUID itemID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getItemHistory"); - } - - // verify the required parameter 'itemID' is set - if (itemID == null) { - throw new ApiException(400, "Missing the required parameter 'itemID' when calling getItemHistory"); - } - - // create path and map variables - String localVarPath = "/Items/{ItemID}/History" - .replaceAll("\\{" + "ItemID" + "\\}", apiClient.escapeString(itemID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve any items - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return Items - * @throws ApiException if fails to make API call - */ - public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws ApiException { - return getItemsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, unitdp).getData(); - } - - /** - * Allows you to retrieve any items - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return ApiResponse<Items> - * @throws ApiException if fails to make API call - */ - public ApiResponse getItemsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getItems"); - } - - // create path and map variables - String localVarPath = "/Items"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified journals. - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param journalID Unique identifier for a Journal (required) - * @return Journals - * @throws ApiException if fails to make API call - */ - public Journals getJournal(String xeroTenantId, UUID journalID) throws ApiException { - return getJournalWithHttpInfo(xeroTenantId, journalID).getData(); - } - - /** - * Allows you to retrieve a specified journals. - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param journalID Unique identifier for a Journal (required) - * @return ApiResponse<Journals> - * @throws ApiException if fails to make API call - */ - public ApiResponse getJournalWithHttpInfo(String xeroTenantId, UUID journalID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getJournal"); - } - - // verify the required parameter 'journalID' is set - if (journalID == null) { - throw new ApiException(400, "Missing the required parameter 'journalID' when calling getJournal"); - } - - // create path and map variables - String localVarPath = "/Journals/{JournalID}" - .replaceAll("\\{" + "JournalID" + "\\}", apiClient.escapeString(journalID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve any journals. - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional) - * @param paymentsOnly Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional) - * @return Journals - * @throws ApiException if fails to make API call - */ - public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws ApiException { - return getJournalsWithHttpInfo(xeroTenantId, ifModifiedSince, offset, paymentsOnly).getData(); - } - - /** - * Allows you to retrieve any journals. - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional) - * @param paymentsOnly Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional) - * @return ApiResponse<Journals> - * @throws ApiException if fails to make API call - */ - public ApiResponse getJournalsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getJournals"); - } - - // create path and map variables - String localVarPath = "/Journals"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "paymentsOnly", paymentsOnly)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified linked transactions (billable expenses) - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) - * @return LinkedTransactions - * @throws ApiException if fails to make API call - */ - public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws ApiException { - return getLinkedTransactionWithHttpInfo(xeroTenantId, linkedTransactionID).getData(); - } - - /** - * Allows you to retrieve a specified linked transactions (billable expenses) - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) - * @return ApiResponse<LinkedTransactions> - * @throws ApiException if fails to make API call - */ - public ApiResponse getLinkedTransactionWithHttpInfo(String xeroTenantId, UUID linkedTransactionID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); - } - - // verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); - } - - // create path and map variables - String localVarPath = "/LinkedTransactions/{LinkedTransactionID}" - .replaceAll("\\{" + "LinkedTransactionID" + "\\}", apiClient.escapeString(linkedTransactionID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Retrieve linked transactions (billable expenses) - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. (optional) - * @param linkedTransactionID The Xero identifier for an Linked Transaction (optional) - * @param sourceTransactionID Filter by the SourceTransactionID. Get all the linked transactions created from a particular ACCPAY invoice (optional) - * @param contactID Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional) - * @param status Filter by the combination of ContactID and Status. Get all the linked transactions that have been assigned to a particular customer and have a particular status e.g. GET /LinkedTransactions?ContactID=4bb34b03-3378-4bb2-a0ed-6345abf3224e&Status=APPROVED. (optional) - * @param targetTransactionID Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional) - * @return LinkedTransactions - * @throws ApiException if fails to make API call - */ - public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws ApiException { - return getLinkedTransactionsWithHttpInfo(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID).getData(); - } - - /** - * Retrieve linked transactions (billable expenses) - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. (optional) - * @param linkedTransactionID The Xero identifier for an Linked Transaction (optional) - * @param sourceTransactionID Filter by the SourceTransactionID. Get all the linked transactions created from a particular ACCPAY invoice (optional) - * @param contactID Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional) - * @param status Filter by the combination of ContactID and Status. Get all the linked transactions that have been assigned to a particular customer and have a particular status e.g. GET /LinkedTransactions?ContactID=4bb34b03-3378-4bb2-a0ed-6345abf3224e&Status=APPROVED. (optional) - * @param targetTransactionID Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional) - * @return ApiResponse<LinkedTransactions> - * @throws ApiException if fails to make API call - */ - public ApiResponse getLinkedTransactionsWithHttpInfo(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); - } - - // create path and map variables - String localVarPath = "/LinkedTransactions"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "LinkedTransactionID", linkedTransactionID)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "SourceTransactionID", sourceTransactionID)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "ContactID", contactID)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "Status", status)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "TargetTransactionID", targetTransactionID)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified manual journals - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @return ManualJournals - * @throws ApiException if fails to make API call - */ - public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID) throws ApiException { - return getManualJournalWithHttpInfo(xeroTenantId, manualJournalID).getData(); - } - - /** - * Allows you to retrieve a specified manual journals - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @return ApiResponse<ManualJournals> - * @throws ApiException if fails to make API call - */ - public ApiResponse getManualJournalWithHttpInfo(String xeroTenantId, UUID manualJournalID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getManualJournal"); - } - - // verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling getManualJournal"); - } - - // create path and map variables - String localVarPath = "/ManualJournals/{ManualJournalID}" - .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve specified Attachment on ManualJournal by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @param fileName The name of the file being attached to a ManualJournal (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws ApiException { - return getManualJournalAttachmentByFileNameWithHttpInfo(xeroTenantId, manualJournalID, fileName, contentType).getData(); - } - - /** - * Allows you to retrieve specified Attachment on ManualJournal by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @param fileName The name of the file being attached to a ManualJournal (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getManualJournalAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); - } - - // verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling getManualJournalAttachmentByFileName"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}" - .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve specified Attachment on ManualJournals - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @param attachmentID Unique identifier for a Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws ApiException { - return getManualJournalAttachmentByIdWithHttpInfo(xeroTenantId, manualJournalID, attachmentID, contentType).getData(); - } - - /** - * Allows you to retrieve specified Attachment on ManualJournals - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @param attachmentID Unique identifier for a Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getManualJournalAttachmentByIdWithHttpInfo(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); - } - - // verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); - } - - // verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getManualJournalAttachmentById"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); - } - - // create path and map variables - String localVarPath = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}" - .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())) - .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachment for manual journals - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID) throws ApiException { - return getManualJournalAttachmentsWithHttpInfo(xeroTenantId, manualJournalID).getData(); - } - - /** - * Allows you to retrieve Attachment for manual journals - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getManualJournalAttachmentsWithHttpInfo(String xeroTenantId, UUID manualJournalID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); - } - - // verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); - } - - // create path and map variables - String localVarPath = "/ManualJournals/{ManualJournalID}/Attachments" - .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve any manual journals - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param page e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional) - * @return ManualJournals - * @throws ApiException if fails to make API call - */ - public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws ApiException { - return getManualJournalsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, page).getData(); - } - - /** - * Allows you to retrieve any manual journals - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param page e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional) - * @return ApiResponse<ManualJournals> - * @throws ApiException if fails to make API call - */ - public ApiResponse getManualJournalsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getManualJournals"); - } - - // create path and map variables - String localVarPath = "/ManualJournals"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a URL to an online invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @return OnlineInvoices - * @throws ApiException if fails to make API call - */ - public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID) throws ApiException { - return getOnlineInvoiceWithHttpInfo(xeroTenantId, invoiceID).getData(); - } - - /** - * Allows you to retrieve a URL to an online invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @return ApiResponse<OnlineInvoices> - * @throws ApiException if fails to make API call - */ - public ApiResponse getOnlineInvoiceWithHttpInfo(String xeroTenantId, UUID invoiceID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}/OnlineInvoice" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param organisationID (required) - * @return CISOrgSetting - * @throws ApiException if fails to make API call - */ - public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID) throws ApiException { - return getOrganisationCISSettingsWithHttpInfo(xeroTenantId, organisationID).getData(); - } - - /** - * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param organisationID (required) - * @return ApiResponse<CISOrgSetting> - * @throws ApiException if fails to make API call - */ - public ApiResponse getOrganisationCISSettingsWithHttpInfo(String xeroTenantId, UUID organisationID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); - } - - // verify the required parameter 'organisationID' is set - if (organisationID == null) { - throw new ApiException(400, "Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); - } - - // create path and map variables - String localVarPath = "/Organisation/{OrganisationID}/CISSettings" - .replaceAll("\\{" + "OrganisationID" + "\\}", apiClient.escapeString(organisationID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Organisation details - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @return Organisations - * @throws ApiException if fails to make API call - */ - public Organisations getOrganisations(String xeroTenantId) throws ApiException { - return getOrganisationsWithHttpInfo(xeroTenantId).getData(); - } - - /** - * Allows you to retrieve Organisation details - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @return ApiResponse<Organisations> - * @throws ApiException if fails to make API call - */ - public ApiResponse getOrganisationsWithHttpInfo(String xeroTenantId) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOrganisations"); - } - - // create path and map variables - String localVarPath = "/Organisation"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "OAuth2" }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified overpayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param overpaymentID Unique identifier for a Overpayment (required) - * @return Overpayments - * @throws ApiException if fails to make API call - */ - public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID) throws ApiException { - return getOverpaymentWithHttpInfo(xeroTenantId, overpaymentID).getData(); - } - - /** - * Allows you to retrieve a specified overpayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param overpaymentID Unique identifier for a Overpayment (required) - * @return ApiResponse<Overpayments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getOverpaymentWithHttpInfo(String xeroTenantId, UUID overpaymentID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOverpayment"); - } - - // verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new ApiException(400, "Missing the required parameter 'overpaymentID' when calling getOverpayment"); - } - - // create path and map variables - String localVarPath = "/Overpayments/{OverpaymentID}" - .replaceAll("\\{" + "OverpaymentID" + "\\}", apiClient.escapeString(overpaymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a history records of an Overpayment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param overpaymentID Unique identifier for a Overpayment (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID) throws ApiException { - return getOverpaymentHistoryWithHttpInfo(xeroTenantId, overpaymentID).getData(); - } - - /** - * Allows you to retrieve a history records of an Overpayment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param overpaymentID Unique identifier for a Overpayment (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getOverpaymentHistoryWithHttpInfo(String xeroTenantId, UUID overpaymentID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); - } - - // verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new ApiException(400, "Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); - } - - // create path and map variables - String localVarPath = "/Overpayments/{OverpaymentID}/History" - .replaceAll("\\{" + "OverpaymentID" + "\\}", apiClient.escapeString(overpaymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve overpayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param page e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return Overpayments - * @throws ApiException if fails to make API call - */ - public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { - return getOverpaymentsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, page, unitdp).getData(); - } - - /** - * Allows you to retrieve overpayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param page e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return ApiResponse<Overpayments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getOverpaymentsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getOverpayments"); - } - - // create path and map variables - String localVarPath = "/Overpayments"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified payment for invoices and credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param paymentID Unique identifier for a Payment (required) - * @return Payments - * @throws ApiException if fails to make API call - */ - public Payments getPayment(String xeroTenantId, UUID paymentID) throws ApiException { - return getPaymentWithHttpInfo(xeroTenantId, paymentID).getData(); - } - - /** - * Allows you to retrieve a specified payment for invoices and credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param paymentID Unique identifier for a Payment (required) - * @return ApiResponse<Payments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getPaymentWithHttpInfo(String xeroTenantId, UUID paymentID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPayment"); - } - - // verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new ApiException(400, "Missing the required parameter 'paymentID' when calling getPayment"); - } - - // create path and map variables - String localVarPath = "/Payments/{PaymentID}" - .replaceAll("\\{" + "PaymentID" + "\\}", apiClient.escapeString(paymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve history records of a payment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param paymentID Unique identifier for a Payment (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) throws ApiException { - return getPaymentHistoryWithHttpInfo(xeroTenantId, paymentID).getData(); - } - - /** - * Allows you to retrieve history records of a payment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param paymentID Unique identifier for a Payment (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getPaymentHistoryWithHttpInfo(String xeroTenantId, UUID paymentID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); - } - - // verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new ApiException(400, "Missing the required parameter 'paymentID' when calling getPaymentHistory"); - } - - // create path and map variables - String localVarPath = "/Payments/{PaymentID}/History" - .replaceAll("\\{" + "PaymentID" + "\\}", apiClient.escapeString(paymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve payment services - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @return PaymentServices - * @throws ApiException if fails to make API call - */ - public PaymentServices getPaymentServices(String xeroTenantId) throws ApiException { - return getPaymentServicesWithHttpInfo(xeroTenantId).getData(); - } - - /** - * Allows you to retrieve payment services - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @return ApiResponse<PaymentServices> - * @throws ApiException if fails to make API call - */ - public ApiResponse getPaymentServicesWithHttpInfo(String xeroTenantId) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); - } - - // create path and map variables - String localVarPath = "/PaymentServices"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve payments for invoices and credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return Payments - * @throws ApiException if fails to make API call - */ - public Payments getPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - return getPaymentsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); - } - - /** - * Allows you to retrieve payments for invoices and credit notes - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ApiResponse<Payments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getPaymentsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPayments"); - } - - // create path and map variables - String localVarPath = "/Payments"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified prepayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param prepaymentID Unique identifier for a PrePayment (required) - * @return Prepayments - * @throws ApiException if fails to make API call - */ - public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID) throws ApiException { - return getPrepaymentWithHttpInfo(xeroTenantId, prepaymentID).getData(); - } - - /** - * Allows you to retrieve a specified prepayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param prepaymentID Unique identifier for a PrePayment (required) - * @return ApiResponse<Prepayments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getPrepaymentWithHttpInfo(String xeroTenantId, UUID prepaymentID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPrepayment"); - } - - // verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new ApiException(400, "Missing the required parameter 'prepaymentID' when calling getPrepayment"); - } - - // create path and map variables - String localVarPath = "/Prepayments/{PrepaymentID}" - .replaceAll("\\{" + "PrepaymentID" + "\\}", apiClient.escapeString(prepaymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a history records of an Prepayment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param prepaymentID Unique identifier for a PrePayment (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID) throws ApiException { - return getPrepaymentHistoryWithHttpInfo(xeroTenantId, prepaymentID).getData(); - } - - /** - * Allows you to retrieve a history records of an Prepayment - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param prepaymentID Unique identifier for a PrePayment (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getPrepaymentHistoryWithHttpInfo(String xeroTenantId, UUID prepaymentID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); - } - - // verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new ApiException(400, "Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); - } - - // create path and map variables - String localVarPath = "/Prepayments/{PrepaymentID}/History" - .replaceAll("\\{" + "PrepaymentID" + "\\}", apiClient.escapeString(prepaymentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve prepayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param page e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return Prepayments - * @throws ApiException if fails to make API call - */ - public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { - return getPrepaymentsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, page, unitdp).getData(); - } - - /** - * Allows you to retrieve prepayments - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param page e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return ApiResponse<Prepayments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getPrepaymentsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPrepayments"); - } - - // create path and map variables - String localVarPath = "/Prepayments"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified purchase orders - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) - * @return PurchaseOrders - * @throws ApiException if fails to make API call - */ - public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID) throws ApiException { - return getPurchaseOrderWithHttpInfo(xeroTenantId, purchaseOrderID).getData(); - } - - /** - * Allows you to retrieve a specified purchase orders - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) - * @return ApiResponse<PurchaseOrders> - * @throws ApiException if fails to make API call - */ - public ApiResponse getPurchaseOrderWithHttpInfo(String xeroTenantId, UUID purchaseOrderID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); - } - - // verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new ApiException(400, "Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); - } - - // create path and map variables - String localVarPath = "/PurchaseOrders/{PurchaseOrderID}" - .replaceAll("\\{" + "PurchaseOrderID" + "\\}", apiClient.escapeString(purchaseOrderID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve history for PurchaseOrder - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID) throws ApiException { - return getPurchaseOrderHistoryWithHttpInfo(xeroTenantId, purchaseOrderID).getData(); - } - - /** - * Allows you to retrieve history for PurchaseOrder - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getPurchaseOrderHistoryWithHttpInfo(String xeroTenantId, UUID purchaseOrderID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); - } - - // verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new ApiException(400, "Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); - } - - // create path and map variables - String localVarPath = "/PurchaseOrders/{PurchaseOrderID}/History" - .replaceAll("\\{" + "PurchaseOrderID" + "\\}", apiClient.escapeString(purchaseOrderID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve purchase orders - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param status Filter by purchase order status (optional) - * @param dateFrom Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) - * @param dateTo Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) - * @param order Order by an any element (optional) - * @param page To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned. (optional) - * @return PurchaseOrders - * @throws ApiException if fails to make API call - */ - public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws ApiException { - return getPurchaseOrdersWithHttpInfo(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page).getData(); - } - - /** - * Allows you to retrieve purchase orders - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param status Filter by purchase order status (optional) - * @param dateFrom Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) - * @param dateTo Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) - * @param order Order by an any element (optional) - * @param page To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned. (optional) - * @return ApiResponse<PurchaseOrders> - * @throws ApiException if fails to make API call - */ - public ApiResponse getPurchaseOrdersWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); - } - - // create path and map variables - String localVarPath = "/PurchaseOrders"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "Status", status)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "DateFrom", dateFrom)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "DateTo", dateTo)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified draft expense claim receipts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @return Receipts - * @throws ApiException if fails to make API call - */ - public Receipts getReceipt(String xeroTenantId, UUID receiptID) throws ApiException { - return getReceiptWithHttpInfo(xeroTenantId, receiptID).getData(); - } - - /** - * Allows you to retrieve a specified draft expense claim receipts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @return ApiResponse<Receipts> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReceiptWithHttpInfo(String xeroTenantId, UUID receiptID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceipt"); - } - - // verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new ApiException(400, "Missing the required parameter 'receiptID' when calling getReceipt"); - } - - // create path and map variables - String localVarPath = "/Receipts/{ReceiptID}" - .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on expense claim receipts by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param fileName The name of the file being attached to the Receipt (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws ApiException { - return getReceiptAttachmentByFileNameWithHttpInfo(xeroTenantId, receiptID, fileName, contentType).getData(); - } - - /** - * Allows you to retrieve Attachments on expense claim receipts by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param fileName The name of the file being attached to the Receipt (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReceiptAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); - } - - // verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new ApiException(400, "Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling getReceiptAttachmentByFileName"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Receipts/{ReceiptID}/Attachments/{FileName}" - .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on expense claim receipts by ID - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param attachmentID Unique identifier for a Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws ApiException { - return getReceiptAttachmentByIdWithHttpInfo(xeroTenantId, receiptID, attachmentID, contentType).getData(); - } - - /** - * Allows you to retrieve Attachments on expense claim receipts by ID - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param attachmentID Unique identifier for a Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReceiptAttachmentByIdWithHttpInfo(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); - } - - // verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new ApiException(400, "Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); - } - - // verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getReceiptAttachmentById"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); - } - - // create path and map variables - String localVarPath = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}" - .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())) - .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments for expense claim receipts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) throws ApiException { - return getReceiptAttachmentsWithHttpInfo(xeroTenantId, receiptID).getData(); - } - - /** - * Allows you to retrieve Attachments for expense claim receipts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReceiptAttachmentsWithHttpInfo(String xeroTenantId, UUID receiptID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); - } - - // verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new ApiException(400, "Missing the required parameter 'receiptID' when calling getReceiptAttachments"); - } - - // create path and map variables - String localVarPath = "/Receipts/{ReceiptID}/Attachments" - .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a history records of an Receipt - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) throws ApiException { - return getReceiptHistoryWithHttpInfo(xeroTenantId, receiptID).getData(); - } - - /** - * Allows you to retrieve a history records of an Receipt - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReceiptHistoryWithHttpInfo(String xeroTenantId, UUID receiptID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); - } - - // verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new ApiException(400, "Missing the required parameter 'receiptID' when calling getReceiptHistory"); - } - - // create path and map variables - String localVarPath = "/Receipts/{ReceiptID}/History" - .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve draft expense claim receipts for any user - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return Receipts - * @throws ApiException if fails to make API call - */ - public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws ApiException { - return getReceiptsWithHttpInfo(xeroTenantId, ifModifiedSince, where, order, unitdp).getData(); - } - - /** - * Allows you to retrieve draft expense claim receipts for any user - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts (optional) - * @return ApiResponse<Receipts> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReceiptsWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReceipts"); - } - - // create path and map variables - String localVarPath = "/Receipts"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "unitdp", unitdp)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified repeating invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @return RepeatingInvoices - * @throws ApiException if fails to make API call - */ - public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { - return getRepeatingInvoiceWithHttpInfo(xeroTenantId, repeatingInvoiceID).getData(); - } - - /** - * Allows you to retrieve a specified repeating invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @return ApiResponse<RepeatingInvoices> - * @throws ApiException if fails to make API call - */ - public ApiResponse getRepeatingInvoiceWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); - } - - // verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); - } - - // create path and map variables - String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}" - .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve specified attachment on repeating invoices by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @param fileName The name of the file being attached to a Repeating Invoice (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws ApiException { - return getRepeatingInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, repeatingInvoiceID, fileName, contentType).getData(); - } - - /** - * Allows you to retrieve specified attachment on repeating invoices by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @param fileName The name of the file being attached to a Repeating Invoice (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getRepeatingInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling getRepeatingInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}" - .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified Attachments on repeating invoices - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @param attachmentID Unique identifier for a Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws ApiException { - return getRepeatingInvoiceAttachmentByIdWithHttpInfo(xeroTenantId, repeatingInvoiceID, attachmentID, contentType).getData(); - } - - /** - * Allows you to retrieve a specified Attachments on repeating invoices - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @param attachmentID Unique identifier for a Attachment (required) - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required) - * @return ApiResponse<File> - * @throws ApiException if fails to make API call - */ - public ApiResponse getRepeatingInvoiceAttachmentByIdWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); - } - - // verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); - } - - // verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new ApiException(400, "Missing the required parameter 'attachmentID' when calling getRepeatingInvoiceAttachmentById"); - } - - // verify the required parameter 'contentType' is set - if (contentType == null) { - throw new ApiException(400, "Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); - } - - // create path and map variables - String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}" - .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())) - .replaceAll("\\{" + "AttachmentID" + "\\}", apiClient.escapeString(attachmentID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (contentType != null) - localVarHeaderParams.put("contentType", apiClient.parameterToString(contentType)); - - - final String[] localVarAccepts = { - "application/octet-stream" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Attachments on repeating invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { - return getRepeatingInvoiceAttachmentsWithHttpInfo(xeroTenantId, repeatingInvoiceID).getData(); - } - - /** - * Allows you to retrieve Attachments on repeating invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse getRepeatingInvoiceAttachmentsWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); - } - - // verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); - } - - // create path and map variables - String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments" - .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve history for a repeating invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @return HistoryRecords - * @throws ApiException if fails to make API call - */ - public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { - return getRepeatingInvoiceHistoryWithHttpInfo(xeroTenantId, repeatingInvoiceID).getData(); - } - - /** - * Allows you to retrieve history for a repeating invoice - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @return ApiResponse<HistoryRecords> - * @throws ApiException if fails to make API call - */ - public ApiResponse getRepeatingInvoiceHistoryWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); - } - - // verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); - } - - // create path and map variables - String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History" - .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve any repeating invoices - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return RepeatingInvoices - * @throws ApiException if fails to make API call - */ - public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, String order) throws ApiException { - return getRepeatingInvoicesWithHttpInfo(xeroTenantId, where, order).getData(); - } - - /** - * Allows you to retrieve any repeating invoices - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ApiResponse<RepeatingInvoices> - * @throws ApiException if fails to make API call - */ - public ApiResponse getRepeatingInvoicesWithHttpInfo(String xeroTenantId, String where, String order) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); - } - - // create path and map variables - String localVarPath = "/RepeatingInvoices"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve report for AgedPayablesByContact - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactId Unique identifier for a Contact (required) - * @param date The date of the Aged Payables By Contact report (optional) - * @param fromDate The from date of the Aged Payables By Contact report (optional) - * @param toDate The to date of the Aged Payables By Contact report (optional) - * @return ReportWithRows - * @throws ApiException if fails to make API call - */ - public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws ApiException { - return getReportAgedPayablesByContactWithHttpInfo(xeroTenantId, contactId, date, fromDate, toDate).getData(); - } - - /** - * Allows you to retrieve report for AgedPayablesByContact - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactId Unique identifier for a Contact (required) - * @param date The date of the Aged Payables By Contact report (optional) - * @param fromDate The from date of the Aged Payables By Contact report (optional) - * @param toDate The to date of the Aged Payables By Contact report (optional) - * @return ApiResponse<ReportWithRows> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReportAgedPayablesByContactWithHttpInfo(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); - } - - // verify the required parameter 'contactId' is set - if (contactId == null) { - throw new ApiException(400, "Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); - } - - // create path and map variables - String localVarPath = "/Reports/AgedPayablesByContact"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "contactId", contactId)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "fromDate", fromDate)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "toDate", toDate)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve report for AgedReceivablesByContact - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactId Unique identifier for a Contact (required) - * @param date The date of the Aged Receivables By Contact report (optional) - * @param fromDate The from date of the Aged Receivables By Contact report (optional) - * @param toDate The to date of the Aged Receivables By Contact report (optional) - * @return ReportWithRows - * @throws ApiException if fails to make API call - */ - public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws ApiException { - return getReportAgedReceivablesByContactWithHttpInfo(xeroTenantId, contactId, date, fromDate, toDate).getData(); - } - - /** - * Allows you to retrieve report for AgedReceivablesByContact - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactId Unique identifier for a Contact (required) - * @param date The date of the Aged Receivables By Contact report (optional) - * @param fromDate The from date of the Aged Receivables By Contact report (optional) - * @param toDate The to date of the Aged Receivables By Contact report (optional) - * @return ApiResponse<ReportWithRows> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReportAgedReceivablesByContactWithHttpInfo(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); - } - - // verify the required parameter 'contactId' is set - if (contactId == null) { - throw new ApiException(400, "Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); - } - - // create path and map variables - String localVarPath = "/Reports/AgedReceivablesByContact"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "contactId", contactId)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "fromDate", fromDate)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "toDate", toDate)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve report for BAS only valid for AU orgs - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param reportID Unique identifier for a Report (required) - * @return ReportWithRows - * @throws ApiException if fails to make API call - */ - public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) throws ApiException { - return getReportBASorGSTWithHttpInfo(xeroTenantId, reportID).getData(); - } - - /** - * Allows you to retrieve report for BAS only valid for AU orgs - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param reportID Unique identifier for a Report (required) - * @return ApiResponse<ReportWithRows> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReportBASorGSTWithHttpInfo(String xeroTenantId, String reportID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); - } - - // verify the required parameter 'reportID' is set - if (reportID == null) { - throw new ApiException(400, "Missing the required parameter 'reportID' when calling getReportBASorGST"); - } - - // create path and map variables - String localVarPath = "/Reports/{ReportID}" - .replaceAll("\\{" + "ReportID" + "\\}", apiClient.escapeString(reportID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve report for BAS only valid for AU orgs - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @return ReportWithRows - * @throws ApiException if fails to make API call - */ - public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws ApiException { - return getReportBASorGSTListWithHttpInfo(xeroTenantId).getData(); - } - - /** - * Allows you to retrieve report for BAS only valid for AU orgs - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @return ApiResponse<ReportWithRows> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReportBASorGSTListWithHttpInfo(String xeroTenantId) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); - } - - // create path and map variables - String localVarPath = "/Reports"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve report for BalanceSheet - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param date The date of the Balance Sheet report (optional) - * @param periods The number of periods for the Balance Sheet report (optional) - * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional) - * @param trackingOptionID1 The tracking option 1 for the Balance Sheet report (optional) - * @param trackingOptionID2 The tracking option 2 for the Balance Sheet report (optional) - * @param standardLayout The standard layout boolean for the Balance Sheet report (optional) - * @param paymentsOnly return a cash basis for the Balance Sheet report (optional) - * @return ReportWithRows - * @throws ApiException if fails to make API call - */ - public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws ApiException { - return getReportBalanceSheetWithHttpInfo(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly).getData(); - } - - /** - * Allows you to retrieve report for BalanceSheet - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param date The date of the Balance Sheet report (optional) - * @param periods The number of periods for the Balance Sheet report (optional) - * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional) - * @param trackingOptionID1 The tracking option 1 for the Balance Sheet report (optional) - * @param trackingOptionID2 The tracking option 2 for the Balance Sheet report (optional) - * @param standardLayout The standard layout boolean for the Balance Sheet report (optional) - * @param paymentsOnly return a cash basis for the Balance Sheet report (optional) - * @return ApiResponse<ReportWithRows> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReportBalanceSheetWithHttpInfo(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); - } - - // create path and map variables - String localVarPath = "/Reports/BalanceSheet"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "periods", periods)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "timeframe", timeframe)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingOptionID1", trackingOptionID1)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingOptionID2", trackingOptionID2)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "standardLayout", standardLayout)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "paymentsOnly", paymentsOnly)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve report for BankSummary - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) - * @param period The number of periods to compare (integer between 1 and 12) (optional) - * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) (optional) - * @return ReportWithRows - * @throws ApiException if fails to make API call - */ - public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws ApiException { - return getReportBankSummaryWithHttpInfo(xeroTenantId, date, period, timeframe).getData(); - } - - /** - * Allows you to retrieve report for BankSummary - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) - * @param period The number of periods to compare (integer between 1 and 12) (optional) - * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) (optional) - * @return ApiResponse<ReportWithRows> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReportBankSummaryWithHttpInfo(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); - } - - // create path and map variables - String localVarPath = "/Reports/BankSummary"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "period", period)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "timeframe", timeframe)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve report for Budget Summary - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) - * @param period The number of periods to compare (integer between 1 and 12) (optional) - * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) (optional) - * @return ReportWithRows - * @throws ApiException if fails to make API call - */ - public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws ApiException { - return getReportBudgetSummaryWithHttpInfo(xeroTenantId, date, period, timeframe).getData(); - } - - /** - * Allows you to retrieve report for Budget Summary - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) - * @param period The number of periods to compare (integer between 1 and 12) (optional) - * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) (optional) - * @return ApiResponse<ReportWithRows> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReportBudgetSummaryWithHttpInfo(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); - } - - // create path and map variables - String localVarPath = "/Reports/BudgetSummary"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "period", period)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "timeframe", timeframe)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve report for ExecutiveSummary - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) - * @return ReportWithRows - * @throws ApiException if fails to make API call - */ - public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate date) throws ApiException { - return getReportExecutiveSummaryWithHttpInfo(xeroTenantId, date).getData(); - } - - /** - * Allows you to retrieve report for ExecutiveSummary - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param date The date for the Bank Summary report e.g. 2018-03-31 (optional) - * @return ApiResponse<ReportWithRows> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReportExecutiveSummaryWithHttpInfo(String xeroTenantId, LocalDate date) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); - } - - // create path and map variables - String localVarPath = "/Reports/ExecutiveSummary"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve report for ProfitAndLoss - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param fromDate The from date for the ProfitAndLoss report e.g. 2018-03-31 (optional) - * @param toDate The to date for the ProfitAndLoss report e.g. 2018-03-31 (optional) - * @param periods The number of periods to compare (integer between 1 and 12) (optional) - * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional) - * @param trackingCategoryID The trackingCategory 1 for the ProfitAndLoss report (optional) - * @param trackingCategoryID2 The trackingCategory 2 for the ProfitAndLoss report (optional) - * @param trackingOptionID The tracking option 1 for the ProfitAndLoss report (optional) - * @param trackingOptionID2 The tracking option 2 for the ProfitAndLoss report (optional) - * @param standardLayout Return the standard layout for the ProfitAndLoss report (optional) - * @param paymentsOnly Return cash only basis for the ProfitAndLoss report (optional) - * @return ReportWithRows - * @throws ApiException if fails to make API call - */ - public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws ApiException { - return getReportProfitAndLossWithHttpInfo(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly).getData(); - } - - /** - * Allows you to retrieve report for ProfitAndLoss - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param fromDate The from date for the ProfitAndLoss report e.g. 2018-03-31 (optional) - * @param toDate The to date for the ProfitAndLoss report e.g. 2018-03-31 (optional) - * @param periods The number of periods to compare (integer between 1 and 12) (optional) - * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional) - * @param trackingCategoryID The trackingCategory 1 for the ProfitAndLoss report (optional) - * @param trackingCategoryID2 The trackingCategory 2 for the ProfitAndLoss report (optional) - * @param trackingOptionID The tracking option 1 for the ProfitAndLoss report (optional) - * @param trackingOptionID2 The tracking option 2 for the ProfitAndLoss report (optional) - * @param standardLayout Return the standard layout for the ProfitAndLoss report (optional) - * @param paymentsOnly Return cash only basis for the ProfitAndLoss report (optional) - * @return ApiResponse<ReportWithRows> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReportProfitAndLossWithHttpInfo(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); - } - - // create path and map variables - String localVarPath = "/Reports/ProfitAndLoss"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "fromDate", fromDate)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "toDate", toDate)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "periods", periods)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "timeframe", timeframe)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingCategoryID", trackingCategoryID)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingCategoryID2", trackingCategoryID2)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingOptionID", trackingOptionID)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "trackingOptionID2", trackingOptionID2)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "standardLayout", standardLayout)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "paymentsOnly", paymentsOnly)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve report for TenNinetyNine - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param reportYear The year of the 1099 report (optional) - * @return Reports - * @throws ApiException if fails to make API call - */ - public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) throws ApiException { - return getReportTenNinetyNineWithHttpInfo(xeroTenantId, reportYear).getData(); - } - - /** - * Allows you to retrieve report for TenNinetyNine - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param reportYear The year of the 1099 report (optional) - * @return ApiResponse<Reports> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReportTenNinetyNineWithHttpInfo(String xeroTenantId, String reportYear) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); - } - - // create path and map variables - String localVarPath = "/Reports/TenNinetyNine"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "reportYear", reportYear)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve report for TrialBalance - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param date The date for the Trial Balance report e.g. 2018-03-31 (optional) - * @param paymentsOnly Return cash only basis for the Trial Balance report (optional) - * @return ReportWithRows - * @throws ApiException if fails to make API call - */ - public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws ApiException { - return getReportTrialBalanceWithHttpInfo(xeroTenantId, date, paymentsOnly).getData(); - } - - /** - * Allows you to retrieve report for TrialBalance - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param date The date for the Trial Balance report e.g. 2018-03-31 (optional) - * @param paymentsOnly Return cash only basis for the Trial Balance report (optional) - * @return ApiResponse<ReportWithRows> - * @throws ApiException if fails to make API call - */ - public ApiResponse getReportTrialBalanceWithHttpInfo(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); - } - - // create path and map variables - String localVarPath = "/Reports/TrialBalance"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "date", date)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "paymentsOnly", paymentsOnly)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve Tax Rates - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param taxType Filter by tax type (optional) - * @return TaxRates - * @throws ApiException if fails to make API call - */ - public TaxRates getTaxRates(String xeroTenantId, String where, String order, String taxType) throws ApiException { - return getTaxRatesWithHttpInfo(xeroTenantId, where, order, taxType).getData(); - } - - /** - * Allows you to retrieve Tax Rates - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param taxType Filter by tax type (optional) - * @return ApiResponse<TaxRates> - * @throws ApiException if fails to make API call - */ - public ApiResponse getTaxRatesWithHttpInfo(String xeroTenantId, String where, String order, String taxType) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getTaxRates"); - } - - // create path and map variables - String localVarPath = "/TaxRates"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "TaxType", taxType)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve tracking categories and options - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param includeArchived e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response (optional) - * @return TrackingCategories - * @throws ApiException if fails to make API call - */ - public TrackingCategories getTrackingCategories(String xeroTenantId, String where, String order, Boolean includeArchived) throws ApiException { - return getTrackingCategoriesWithHttpInfo(xeroTenantId, where, order, includeArchived).getData(); - } - - /** - * Allows you to retrieve tracking categories and options - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @param includeArchived e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response (optional) - * @return ApiResponse<TrackingCategories> - * @throws ApiException if fails to make API call - */ - public ApiResponse getTrackingCategoriesWithHttpInfo(String xeroTenantId, String where, String order, Boolean includeArchived) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); - } - - // create path and map variables - String localVarPath = "/TrackingCategories"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "includeArchived", includeArchived)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve tracking categories and options for specified category - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategoryID Unique identifier for a TrackingCategory (required) - * @return TrackingCategories - * @throws ApiException if fails to make API call - */ - public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws ApiException { - return getTrackingCategoryWithHttpInfo(xeroTenantId, trackingCategoryID).getData(); - } - - /** - * Allows you to retrieve tracking categories and options for specified category - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategoryID Unique identifier for a TrackingCategory (required) - * @return ApiResponse<TrackingCategories> - * @throws ApiException if fails to make API call - */ - public ApiResponse getTrackingCategoryWithHttpInfo(String xeroTenantId, UUID trackingCategoryID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); - } - - // verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new ApiException(400, "Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); - } - - // create path and map variables - String localVarPath = "/TrackingCategories/{TrackingCategoryID}" - .replaceAll("\\{" + "TrackingCategoryID" + "\\}", apiClient.escapeString(trackingCategoryID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified user - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param userID Unique identifier for a User (required) - * @return Users - * @throws ApiException if fails to make API call - */ - public Users getUser(String xeroTenantId, UUID userID) throws ApiException { - return getUserWithHttpInfo(xeroTenantId, userID).getData(); - } - - /** - * Allows you to retrieve a specified user - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param userID Unique identifier for a User (required) - * @return ApiResponse<Users> - * @throws ApiException if fails to make API call - */ - public ApiResponse getUserWithHttpInfo(String xeroTenantId, UUID userID) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getUser"); - } - - // verify the required parameter 'userID' is set - if (userID == null) { - throw new ApiException(400, "Missing the required parameter 'userID' when calling getUser"); - } - - // create path and map variables - String localVarPath = "/Users/{UserID}" - .replaceAll("\\{" + "UserID" + "\\}", apiClient.escapeString(userID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve users - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return Users - * @throws ApiException if fails to make API call - */ - public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - return getUsersWithHttpInfo(xeroTenantId, ifModifiedSince, where, order).getData(); - } - - /** - * Allows you to retrieve users - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param ifModifiedSince Only records created or modified since this timestamp will be returned (optional) - * @param where Filter by an any element (optional) - * @param order Order by an any element (optional) - * @return ApiResponse<Users> - * @throws ApiException if fails to make API call - */ - public ApiResponse getUsersWithHttpInfo(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws ApiException { - Object localVarPostBody = new Object(); - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling getUsers"); - } - - // create path and map variables - String localVarPath = "/Users"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "where", where)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); -if (ifModifiedSince != null) - localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update a chart of accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for retrieving single object (required) - * @param accounts Request of type Accounts array with one Account (required) - * @return Accounts - * @throws ApiException if fails to make API call - */ - public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts) throws ApiException { - return updateAccountWithHttpInfo(xeroTenantId, accountID, accounts).getData(); - } - - /** - * Allows you to update a chart of accounts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for retrieving single object (required) - * @param accounts Request of type Accounts array with one Account (required) - * @return ApiResponse<Accounts> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateAccountWithHttpInfo(String xeroTenantId, UUID accountID, Accounts accounts) throws ApiException { - Object localVarPostBody = accounts; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateAccount"); - } - - // verify the required parameter 'accountID' is set - if (accountID == null) { - throw new ApiException(400, "Missing the required parameter 'accountID' when calling updateAccount"); - } - - // verify the required parameter 'accounts' is set - if (accounts == null) { - throw new ApiException(400, "Missing the required parameter 'accounts' when calling updateAccount"); - } - - // create path and map variables - String localVarPath = "/Accounts/{AccountID}" - .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update Attachment on Account by Filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for Account object (required) - * @param fileName Name of the attachment (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws ApiException { - return updateAccountAttachmentByFileNameWithHttpInfo(xeroTenantId, accountID, fileName, body).getData(); - } - - /** - * Allows you to update Attachment on Account by Filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param accountID Unique identifier for Account object (required) - * @param fileName Name of the attachment (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateAccountAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); - } - - // verify the required parameter 'accountID' is set - if (accountID == null) { - throw new ApiException(400, "Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Accounts/{AccountID}/Attachments/{FileName}" - .replaceAll("\\{" + "AccountID" + "\\}", apiClient.escapeString(accountID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update a single spend or receive money transaction - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param bankTransactions (required) - * @return BankTransactions - * @throws ApiException if fails to make API call - */ - public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws ApiException { - return updateBankTransactionWithHttpInfo(xeroTenantId, bankTransactionID, bankTransactions).getData(); - } - - /** - * Allows you to update a single spend or receive money transaction - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param bankTransactions (required) - * @return ApiResponse<BankTransactions> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateBankTransactionWithHttpInfo(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws ApiException { - Object localVarPostBody = bankTransactions; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); - } - - // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); - } - - // verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); - } - - // create path and map variables - String localVarPath = "/BankTransactions/{BankTransactionID}" - .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update an Attachment on BankTransaction by Filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param fileName The name of the file being attached (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws ApiException { - return updateBankTransactionAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransactionID, fileName, body).getData(); - } - - /** - * Allows you to update an Attachment on BankTransaction by Filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransactionID Xero generated unique identifier for a bank transaction (required) - * @param fileName The name of the file being attached (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateBankTransactionAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); - } - - // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}" - .replaceAll("\\{" + "BankTransactionID" + "\\}", apiClient.escapeString(bankTransactionID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @param fileName The name of the file being attached to a Bank Transfer (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws ApiException { - return updateBankTransferAttachmentByFileNameWithHttpInfo(xeroTenantId, bankTransferID, fileName, body).getData(); - } - - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param bankTransferID Xero generated unique identifier for a bank transfer (required) - * @param fileName The name of the file being attached to a Bank Transfer (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateBankTransferAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); - } - - // verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new ApiException(400, "Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}" - .replaceAll("\\{" + "BankTransferID" + "\\}", apiClient.escapeString(bankTransferID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param contacts an array of Contacts containing single Contact object with properties to update (required) - * @return Contacts - * @throws ApiException if fails to make API call - */ - public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts) throws ApiException { - return updateContactWithHttpInfo(xeroTenantId, contactID, contacts).getData(); - } - - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param contacts an array of Contacts containing single Contact object with properties to update (required) - * @return ApiResponse<Contacts> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateContactWithHttpInfo(String xeroTenantId, UUID contactID, Contacts contacts) throws ApiException { - Object localVarPostBody = contacts; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateContact"); - } - - // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new ApiException(400, "Missing the required parameter 'contactID' when calling updateContact"); - } - - // verify the required parameter 'contacts' is set - if (contacts == null) { - throw new ApiException(400, "Missing the required parameter 'contacts' when calling updateContact"); - } - - // create path and map variables - String localVarPath = "/Contacts/{ContactID}" - .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param fileName Name for the file you are attaching (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws ApiException { - return updateContactAttachmentByFileNameWithHttpInfo(xeroTenantId, contactID, fileName, body).getData(); - } - - /** - * - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactID Unique identifier for a Contact (required) - * @param fileName Name for the file you are attaching (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateContactAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); - } - - // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new ApiException(400, "Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Contacts/{ContactID}/Attachments/{FileName}" - .replaceAll("\\{" + "ContactID" + "\\}", apiClient.escapeString(contactID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update a Contract Group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroupID Unique identifier for a Contact Group (required) - * @param contactGroups an array of Contact groups with Name of specific group to update (required) - * @return ContactGroups - * @throws ApiException if fails to make API call - */ - public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws ApiException { - return updateContactGroupWithHttpInfo(xeroTenantId, contactGroupID, contactGroups).getData(); - } - - /** - * Allows you to update a Contract Group - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param contactGroupID Unique identifier for a Contact Group (required) - * @param contactGroups an array of Contact groups with Name of specific group to update (required) - * @return ApiResponse<ContactGroups> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateContactGroupWithHttpInfo(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws ApiException { - Object localVarPostBody = contactGroups; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); - } - - // verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new ApiException(400, "Missing the required parameter 'contactGroupID' when calling updateContactGroup"); - } - - // verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new ApiException(400, "Missing the required parameter 'contactGroups' when calling updateContactGroup"); - } - - // create path and map variables - String localVarPath = "/ContactGroups/{ContactGroupID}" - .replaceAll("\\{" + "ContactGroupID" + "\\}", apiClient.escapeString(contactGroupID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update a specific credit note - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param creditNotes an array of Credit Notes containing credit note details to update (required) - * @return CreditNotes - * @throws ApiException if fails to make API call - */ - public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws ApiException { - return updateCreditNoteWithHttpInfo(xeroTenantId, creditNoteID, creditNotes).getData(); - } - - /** - * Allows you to update a specific credit note - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param creditNotes an array of Credit Notes containing credit note details to update (required) - * @return ApiResponse<CreditNotes> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateCreditNoteWithHttpInfo(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws ApiException { - Object localVarPostBody = creditNotes; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); - } - - // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling updateCreditNote"); - } - - // verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new ApiException(400, "Missing the required parameter 'creditNotes' when calling updateCreditNote"); - } - - // create path and map variables - String localVarPath = "/CreditNotes/{CreditNoteID}" - .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update Attachments on CreditNote by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param fileName Name of the file you are attaching to Credit Note (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws ApiException { - return updateCreditNoteAttachmentByFileNameWithHttpInfo(xeroTenantId, creditNoteID, fileName, body).getData(); - } - - /** - * Allows you to update Attachments on CreditNote by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param creditNoteID Unique identifier for a Credit Note (required) - * @param fileName Name of the file you are attaching to Credit Note (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateCreditNoteAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); - } - - // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new ApiException(400, "Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}" - .replaceAll("\\{" + "CreditNoteID" + "\\}", apiClient.escapeString(creditNoteID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update a specific employee used in Xero payrun - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param employeeID Unique identifier for a Employee (required) - * @param employees (required) - * @return Employees - * @throws ApiException if fails to make API call - */ - public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees) throws ApiException { - return updateEmployeeWithHttpInfo(xeroTenantId, employeeID, employees).getData(); - } - - /** - * Allows you to update a specific employee used in Xero payrun - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param employeeID Unique identifier for a Employee (required) - * @param employees (required) - * @return ApiResponse<Employees> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateEmployeeWithHttpInfo(String xeroTenantId, UUID employeeID, Employees employees) throws ApiException { - Object localVarPostBody = employees; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateEmployee"); - } - - // verify the required parameter 'employeeID' is set - if (employeeID == null) { - throw new ApiException(400, "Missing the required parameter 'employeeID' when calling updateEmployee"); - } - - // verify the required parameter 'employees' is set - if (employees == null) { - throw new ApiException(400, "Missing the required parameter 'employees' when calling updateEmployee"); - } - - // create path and map variables - String localVarPath = "/Employees/{EmployeeID}" - .replaceAll("\\{" + "EmployeeID" + "\\}", apiClient.escapeString(employeeID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update specified expense claims - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param expenseClaimID Unique identifier for a ExpenseClaim (required) - * @param expenseClaims (required) - * @return ExpenseClaims - * @throws ApiException if fails to make API call - */ - public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws ApiException { - return updateExpenseClaimWithHttpInfo(xeroTenantId, expenseClaimID, expenseClaims).getData(); - } - - /** - * Allows you to update specified expense claims - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param expenseClaimID Unique identifier for a ExpenseClaim (required) - * @param expenseClaims (required) - * @return ApiResponse<ExpenseClaims> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateExpenseClaimWithHttpInfo(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws ApiException { - Object localVarPostBody = expenseClaims; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); - } - - // verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new ApiException(400, "Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); - } - - // verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new ApiException(400, "Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); - } - - // create path and map variables - String localVarPath = "/ExpenseClaims/{ExpenseClaimID}" - .replaceAll("\\{" + "ExpenseClaimID" + "\\}", apiClient.escapeString(expenseClaimID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update a specified sales invoices or purchase bills - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param invoices (required) - * @return Invoices - * @throws ApiException if fails to make API call - */ - public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices) throws ApiException { - return updateInvoiceWithHttpInfo(xeroTenantId, invoiceID, invoices).getData(); - } - - /** - * Allows you to update a specified sales invoices or purchase bills - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param invoices (required) - * @return ApiResponse<Invoices> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateInvoiceWithHttpInfo(String xeroTenantId, UUID invoiceID, Invoices invoices) throws ApiException { - Object localVarPostBody = invoices; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateInvoice"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling updateInvoice"); - } - - // verify the required parameter 'invoices' is set - if (invoices == null) { - throw new ApiException(400, "Missing the required parameter 'invoices' when calling updateInvoice"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update Attachment on invoices or purchase bills by it's filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param fileName Name of the file you are attaching (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws ApiException { - return updateInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, invoiceID, fileName, body).getData(); - } - - /** - * Allows you to update Attachment on invoices or purchase bills by it's filename - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param invoiceID Unique identifier for an Invoice (required) - * @param fileName Name of the file you are attaching (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Invoices/{InvoiceID}/Attachments/{FileName}" - .replaceAll("\\{" + "InvoiceID" + "\\}", apiClient.escapeString(invoiceID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to udpate a specified item - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param itemID Unique identifier for an Item (required) - * @param items (required) - * @return Items - * @throws ApiException if fails to make API call - */ - public Items updateItem(String xeroTenantId, UUID itemID, Items items) throws ApiException { - return updateItemWithHttpInfo(xeroTenantId, itemID, items).getData(); - } - - /** - * Allows you to udpate a specified item - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param itemID Unique identifier for an Item (required) - * @param items (required) - * @return ApiResponse<Items> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateItemWithHttpInfo(String xeroTenantId, UUID itemID, Items items) throws ApiException { - Object localVarPostBody = items; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateItem"); - } - - // verify the required parameter 'itemID' is set - if (itemID == null) { - throw new ApiException(400, "Missing the required parameter 'itemID' when calling updateItem"); - } - - // verify the required parameter 'items' is set - if (items == null) { - throw new ApiException(400, "Missing the required parameter 'items' when calling updateItem"); - } - - // create path and map variables - String localVarPath = "/Items/{ItemID}" - .replaceAll("\\{" + "ItemID" + "\\}", apiClient.escapeString(itemID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update a specified linked transactions (billable expenses) - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) - * @param linkedTransactions (required) - * @return LinkedTransactions - * @throws ApiException if fails to make API call - */ - public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws ApiException { - return updateLinkedTransactionWithHttpInfo(xeroTenantId, linkedTransactionID, linkedTransactions).getData(); - } - - /** - * Allows you to update a specified linked transactions (billable expenses) - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param linkedTransactionID Unique identifier for a LinkedTransaction (required) - * @param linkedTransactions (required) - * @return ApiResponse<LinkedTransactions> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateLinkedTransactionWithHttpInfo(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws ApiException { - Object localVarPostBody = linkedTransactions; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); - } - - // verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new ApiException(400, "Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); - } - - // verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new ApiException(400, "Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); - } - - // create path and map variables - String localVarPath = "/LinkedTransactions/{LinkedTransactionID}" - .replaceAll("\\{" + "LinkedTransactionID" + "\\}", apiClient.escapeString(linkedTransactionID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update a specified manual journal - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @param manualJournals (required) - * @return ManualJournals - * @throws ApiException if fails to make API call - */ - public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws ApiException { - return updateManualJournalWithHttpInfo(xeroTenantId, manualJournalID, manualJournals).getData(); - } - - /** - * Allows you to update a specified manual journal - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @param manualJournals (required) - * @return ApiResponse<ManualJournals> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateManualJournalWithHttpInfo(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws ApiException { - Object localVarPostBody = manualJournals; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); - } - - // verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling updateManualJournal"); - } - - // verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new ApiException(400, "Missing the required parameter 'manualJournals' when calling updateManualJournal"); - } - - // create path and map variables - String localVarPath = "/ManualJournals/{ManualJournalID}" - .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update a specified Attachment on ManualJournal by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @param fileName The name of the file being attached to a ManualJournal (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws ApiException { - return updateManualJournalAttachmentByFileNameWithHttpInfo(xeroTenantId, manualJournalID, fileName, body).getData(); - } - - /** - * Allows you to update a specified Attachment on ManualJournal by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param manualJournalID Unique identifier for a ManualJournal (required) - * @param fileName The name of the file being attached to a ManualJournal (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateManualJournalAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); - } - - // verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new ApiException(400, "Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}" - .replaceAll("\\{" + "ManualJournalID" + "\\}", apiClient.escapeString(manualJournalID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update a specified purchase order - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) - * @param purchaseOrders (required) - * @return PurchaseOrders - * @throws ApiException if fails to make API call - */ - public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws ApiException { - return updatePurchaseOrderWithHttpInfo(xeroTenantId, purchaseOrderID, purchaseOrders).getData(); - } - - /** - * Allows you to update a specified purchase order - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param purchaseOrderID Unique identifier for a PurchaseOrder (required) - * @param purchaseOrders (required) - * @return ApiResponse<PurchaseOrders> - * @throws ApiException if fails to make API call - */ - public ApiResponse updatePurchaseOrderWithHttpInfo(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws ApiException { - Object localVarPostBody = purchaseOrders; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); - } - - // verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new ApiException(400, "Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); - } - - // verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new ApiException(400, "Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); - } - - // create path and map variables - String localVarPath = "/PurchaseOrders/{PurchaseOrderID}" - .replaceAll("\\{" + "PurchaseOrderID" + "\\}", apiClient.escapeString(purchaseOrderID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to retrieve a specified draft expense claim receipts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param receipts (required) - * @return Receipts - * @throws ApiException if fails to make API call - */ - public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts) throws ApiException { - return updateReceiptWithHttpInfo(xeroTenantId, receiptID, receipts).getData(); - } - - /** - * Allows you to retrieve a specified draft expense claim receipts - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param receipts (required) - * @return ApiResponse<Receipts> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateReceiptWithHttpInfo(String xeroTenantId, UUID receiptID, Receipts receipts) throws ApiException { - Object localVarPostBody = receipts; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateReceipt"); - } - - // verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new ApiException(400, "Missing the required parameter 'receiptID' when calling updateReceipt"); - } - - // verify the required parameter 'receipts' is set - if (receipts == null) { - throw new ApiException(400, "Missing the required parameter 'receipts' when calling updateReceipt"); - } - - // create path and map variables - String localVarPath = "/Receipts/{ReceiptID}" - .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update Attachment on expense claim receipts by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param fileName The name of the file being attached to the Receipt (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws ApiException { - return updateReceiptAttachmentByFileNameWithHttpInfo(xeroTenantId, receiptID, fileName, body).getData(); - } - - /** - * Allows you to update Attachment on expense claim receipts by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param receiptID Unique identifier for a Receipt (required) - * @param fileName The name of the file being attached to the Receipt (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateReceiptAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); - } - - // verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new ApiException(400, "Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/Receipts/{ReceiptID}/Attachments/{FileName}" - .replaceAll("\\{" + "ReceiptID" + "\\}", apiClient.escapeString(receiptID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update specified attachment on repeating invoices by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @param fileName The name of the file being attached to a Repeating Invoice (required) - * @param body Byte array of file in body of request (required) - * @return Attachments - * @throws ApiException if fails to make API call - */ - public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws ApiException { - return updateRepeatingInvoiceAttachmentByFileNameWithHttpInfo(xeroTenantId, repeatingInvoiceID, fileName, body).getData(); - } - - /** - * Allows you to update specified attachment on repeating invoices by file name - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice (required) - * @param fileName The name of the file being attached to a Repeating Invoice (required) - * @param body Byte array of file in body of request (required) - * @return ApiResponse<Attachments> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateRepeatingInvoiceAttachmentByFileNameWithHttpInfo(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new ApiException(400, "Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new ApiException(400, "Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); - } - - // create path and map variables - String localVarPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}" - .replaceAll("\\{" + "RepeatingInvoiceID" + "\\}", apiClient.escapeString(repeatingInvoiceID.toString())) - .replaceAll("\\{" + "FileName" + "\\}", apiClient.escapeString(fileName.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/octet-stream" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update Tax Rates - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param taxRates (required) - * @return TaxRates - * @throws ApiException if fails to make API call - */ - public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates) throws ApiException { - return updateTaxRateWithHttpInfo(xeroTenantId, taxRates).getData(); - } - - /** - * Allows you to update Tax Rates - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param taxRates (required) - * @return ApiResponse<TaxRates> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateTaxRateWithHttpInfo(String xeroTenantId, TaxRates taxRates) throws ApiException { - Object localVarPostBody = taxRates; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); - } - - // verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new ApiException(400, "Missing the required parameter 'taxRates' when calling updateTaxRate"); - } - - // create path and map variables - String localVarPath = "/TaxRates"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Allows you to update tracking categories - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategoryID Unique identifier for a TrackingCategory (required) - * @param trackingCategory (required) - * @return TrackingCategories - * @throws ApiException if fails to make API call - */ - public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws ApiException { - return updateTrackingCategoryWithHttpInfo(xeroTenantId, trackingCategoryID, trackingCategory).getData(); - } - - /** - * Allows you to update tracking categories - * - * @param xeroTenantId Xero identifier for Tenant (required) - * @param trackingCategoryID Unique identifier for a TrackingCategory (required) - * @param trackingCategory (required) - * @return ApiResponse<TrackingCategories> - * @throws ApiException if fails to make API call - */ - public ApiResponse updateTrackingCategoryWithHttpInfo(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws ApiException { - Object localVarPostBody = trackingCategory; - - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new ApiException(400, "Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); - } - - // verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new ApiException(400, "Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); - } - - // verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new ApiException(400, "Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); - } - - // create path and map variables - String localVarPath = "/TrackingCategories/{TrackingCategoryID}" - .replaceAll("\\{" + "TrackingCategoryID" + "\\}", apiClient.escapeString(trackingCategoryID.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - if (xeroTenantId != null) - localVarHeaderParams.put("Xero-Tenant-Id", apiClient.parameterToString(xeroTenantId)); - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } } diff --git a/src/main/java/com/xero/models/assets/Asset.java b/src/main/java/com/xero/models/assets/Asset.java deleted file mode 100644 index bf56005c..00000000 --- a/src/main/java/com/xero/models/assets/Asset.java +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Xero Assets API - * This the Xero Assets API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.assets; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.assets.BookDepreciationDetail; -import com.xero.models.assets.BookDepreciationSetting; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.UUID; -import org.threeten.bp.LocalDate; - -/** - * Asset - */ - -public class Asset { - @JsonProperty("assetId") - private UUID assetId = null; - - @JsonProperty("assetName") - private String assetName = null; - - @JsonProperty("assetNumber") - private String assetNumber = null; - - @JsonProperty("purchaseDate") - private LocalDate purchaseDate = null; - - @JsonProperty("purchasePrice") - private Integer purchasePrice = null; - - @JsonProperty("disposalPrice") - private Integer disposalPrice = null; - - /** - * See Asset Status Codes. - */ - public enum AssetStatusEnum { - DRAFT("Draft"), - - REGISTERED("Registered"), - - DISPOSED("Disposed"); - - private String value; - - AssetStatusEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static AssetStatusEnum fromValue(String text) { - for (AssetStatusEnum b : AssetStatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - } - - @JsonProperty("assetStatus") - private AssetStatusEnum assetStatus = null; - - @JsonProperty("warrantyExpiryDate") - private String warrantyExpiryDate = null; - - @JsonProperty("serialNumber") - private String serialNumber = null; - - @JsonProperty("bookDepreciationSetting") - private BookDepreciationSetting bookDepreciationSetting = null; - - @JsonProperty("bookDepreciationDetail") - private BookDepreciationDetail bookDepreciationDetail = null; - - @JsonProperty("canRollBack") - private Boolean canRollBack = null; - - @JsonProperty("AccountingBookValue") - private Integer accountingBookValue = null; - - public Asset assetId(UUID assetId) { - this.assetId = assetId; - return this; - } - - /** - * The Xero-generated Id for the asset - * @return assetId - **/ - @ApiModelProperty(example = "3b5b3a38-5649-495f-87a1-14a4e5918634", required = true, value = "The Xero-generated Id for the asset") - public UUID getAssetId() { - return assetId; - } - - public void setAssetId(UUID assetId) { - this.assetId = assetId; - } - - public Asset assetName(String assetName) { - this.assetName = assetName; - return this; - } - - /** - * The name of the asset - * @return assetName - **/ - @ApiModelProperty(example = "Awesome Truck 3", required = true, value = "The name of the asset") - public String getAssetName() { - return assetName; - } - - public void setAssetName(String assetName) { - this.assetName = assetName; - } - - public Asset assetNumber(String assetNumber) { - this.assetNumber = assetNumber; - return this; - } - - /** - * Must be unique. - * @return assetNumber - **/ - @ApiModelProperty(example = "FA-0013", value = "Must be unique.") - public String getAssetNumber() { - return assetNumber; - } - - public void setAssetNumber(String assetNumber) { - this.assetNumber = assetNumber; - } - - public Asset purchaseDate(LocalDate purchaseDate) { - this.purchaseDate = purchaseDate; - return this; - } - - /** - * The date the asset was purchased YYYY-MM-DD - * @return purchaseDate - **/ - @ApiModelProperty(value = "The date the asset was purchased YYYY-MM-DD") - public LocalDate getPurchaseDate() { - return purchaseDate; - } - - public void setPurchaseDate(LocalDate purchaseDate) { - this.purchaseDate = purchaseDate; - } - - public Asset purchasePrice(Integer purchasePrice) { - this.purchasePrice = purchasePrice; - return this; - } - - /** - * The purchase price of the asset - * @return purchasePrice - **/ - @ApiModelProperty(example = "1000", value = "The purchase price of the asset") - public Integer getPurchasePrice() { - return purchasePrice; - } - - public void setPurchasePrice(Integer purchasePrice) { - this.purchasePrice = purchasePrice; - } - - public Asset disposalPrice(Integer disposalPrice) { - this.disposalPrice = disposalPrice; - return this; - } - - /** - * The price the asset was disposed at - * @return disposalPrice - **/ - @ApiModelProperty(example = "0", value = "The price the asset was disposed at") - public Integer getDisposalPrice() { - return disposalPrice; - } - - public void setDisposalPrice(Integer disposalPrice) { - this.disposalPrice = disposalPrice; - } - - public Asset assetStatus(AssetStatusEnum assetStatus) { - this.assetStatus = assetStatus; - return this; - } - - /** - * See Asset Status Codes. - * @return assetStatus - **/ - @ApiModelProperty(example = "Draft", value = "See Asset Status Codes.") - public AssetStatusEnum getAssetStatus() { - return assetStatus; - } - - public void setAssetStatus(AssetStatusEnum assetStatus) { - this.assetStatus = assetStatus; - } - - public Asset warrantyExpiryDate(String warrantyExpiryDate) { - this.warrantyExpiryDate = warrantyExpiryDate; - return this; - } - - /** - * The date the asset’s warranty expires (if needed) YYYY-MM-DD - * @return warrantyExpiryDate - **/ - @ApiModelProperty(example = "ca4c6b39-4f4f-43e8-98da-5e1f350a6694", value = "The date the asset’s warranty expires (if needed) YYYY-MM-DD") - public String getWarrantyExpiryDate() { - return warrantyExpiryDate; - } - - public void setWarrantyExpiryDate(String warrantyExpiryDate) { - this.warrantyExpiryDate = warrantyExpiryDate; - } - - public Asset serialNumber(String serialNumber) { - this.serialNumber = serialNumber; - return this; - } - - /** - * The asset's serial number - * @return serialNumber - **/ - @ApiModelProperty(example = "ca4c6b39-4f4f-43e8-98da-5e1f350a6694", value = "The asset's serial number") - public String getSerialNumber() { - return serialNumber; - } - - public void setSerialNumber(String serialNumber) { - this.serialNumber = serialNumber; - } - - public Asset bookDepreciationSetting(BookDepreciationSetting bookDepreciationSetting) { - this.bookDepreciationSetting = bookDepreciationSetting; - return this; - } - - /** - * Get bookDepreciationSetting - * @return bookDepreciationSetting - **/ - @ApiModelProperty(required = true, value = "") - public BookDepreciationSetting getBookDepreciationSetting() { - return bookDepreciationSetting; - } - - public void setBookDepreciationSetting(BookDepreciationSetting bookDepreciationSetting) { - this.bookDepreciationSetting = bookDepreciationSetting; - } - - public Asset bookDepreciationDetail(BookDepreciationDetail bookDepreciationDetail) { - this.bookDepreciationDetail = bookDepreciationDetail; - return this; - } - - /** - * Get bookDepreciationDetail - * @return bookDepreciationDetail - **/ - @ApiModelProperty(value = "") - public BookDepreciationDetail getBookDepreciationDetail() { - return bookDepreciationDetail; - } - - public void setBookDepreciationDetail(BookDepreciationDetail bookDepreciationDetail) { - this.bookDepreciationDetail = bookDepreciationDetail; - } - - public Asset canRollBack(Boolean canRollBack) { - this.canRollBack = canRollBack; - return this; - } - - /** - * Boolean to indicate whether depreciation can be rolled back for this asset individually. This is true if it doesn't have 'legacy' journal entries and if there is no lock period that would prevent this asset from rolling back. - * @return canRollBack - **/ - @ApiModelProperty(value = "Boolean to indicate whether depreciation can be rolled back for this asset individually. This is true if it doesn't have 'legacy' journal entries and if there is no lock period that would prevent this asset from rolling back.") - public Boolean getCanRollBack() { - return canRollBack; - } - - public void setCanRollBack(Boolean canRollBack) { - this.canRollBack = canRollBack; - } - - public Asset accountingBookValue(Integer accountingBookValue) { - this.accountingBookValue = accountingBookValue; - return this; - } - - /** - * The accounting value of the asset - * @return accountingBookValue - **/ - @ApiModelProperty(example = "0", value = "The accounting value of the asset") - public Integer getAccountingBookValue() { - return accountingBookValue; - } - - public void setAccountingBookValue(Integer accountingBookValue) { - this.accountingBookValue = accountingBookValue; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Asset asset = (Asset) o; - return Objects.equals(this.assetId, asset.assetId) && - Objects.equals(this.assetName, asset.assetName) && - Objects.equals(this.assetNumber, asset.assetNumber) && - Objects.equals(this.purchaseDate, asset.purchaseDate) && - Objects.equals(this.purchasePrice, asset.purchasePrice) && - Objects.equals(this.disposalPrice, asset.disposalPrice) && - Objects.equals(this.assetStatus, asset.assetStatus) && - Objects.equals(this.warrantyExpiryDate, asset.warrantyExpiryDate) && - Objects.equals(this.serialNumber, asset.serialNumber) && - Objects.equals(this.bookDepreciationSetting, asset.bookDepreciationSetting) && - Objects.equals(this.bookDepreciationDetail, asset.bookDepreciationDetail) && - Objects.equals(this.canRollBack, asset.canRollBack) && - Objects.equals(this.accountingBookValue, asset.accountingBookValue); - } - - @Override - public int hashCode() { - return Objects.hash(assetId, assetName, assetNumber, purchaseDate, purchasePrice, disposalPrice, assetStatus, warrantyExpiryDate, serialNumber, bookDepreciationSetting, bookDepreciationDetail, canRollBack, accountingBookValue); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Asset {\n"); - - sb.append(" assetId: ").append(toIndentedString(assetId)).append("\n"); - sb.append(" assetName: ").append(toIndentedString(assetName)).append("\n"); - sb.append(" assetNumber: ").append(toIndentedString(assetNumber)).append("\n"); - sb.append(" purchaseDate: ").append(toIndentedString(purchaseDate)).append("\n"); - sb.append(" purchasePrice: ").append(toIndentedString(purchasePrice)).append("\n"); - sb.append(" disposalPrice: ").append(toIndentedString(disposalPrice)).append("\n"); - sb.append(" assetStatus: ").append(toIndentedString(assetStatus)).append("\n"); - sb.append(" warrantyExpiryDate: ").append(toIndentedString(warrantyExpiryDate)).append("\n"); - sb.append(" serialNumber: ").append(toIndentedString(serialNumber)).append("\n"); - sb.append(" bookDepreciationSetting: ").append(toIndentedString(bookDepreciationSetting)).append("\n"); - sb.append(" bookDepreciationDetail: ").append(toIndentedString(bookDepreciationDetail)).append("\n"); - sb.append(" canRollBack: ").append(toIndentedString(canRollBack)).append("\n"); - sb.append(" accountingBookValue: ").append(toIndentedString(accountingBookValue)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/assets/AssetType.java b/src/main/java/com/xero/models/assets/AssetType.java deleted file mode 100644 index 15ce30cc..00000000 --- a/src/main/java/com/xero/models/assets/AssetType.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Xero Assets API - * This the Xero Assets API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.assets; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.assets.BookDepreciationSetting; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.UUID; - -/** - * AssetType - */ - -public class AssetType { - @JsonProperty("assetTypeId") - private UUID assetTypeId = null; - - @JsonProperty("assetTypeName") - private String assetTypeName = null; - - @JsonProperty("fixedAssetAccountId") - private UUID fixedAssetAccountId = null; - - @JsonProperty("depreciationExpenseAccountId") - private UUID depreciationExpenseAccountId = null; - - @JsonProperty("accumulatedDepreciationAccountId") - private UUID accumulatedDepreciationAccountId = null; - - @JsonProperty("bookDepreciationSetting") - private BookDepreciationSetting bookDepreciationSetting = null; - - @JsonProperty("locks") - private Integer locks = null; - - public AssetType assetTypeId(UUID assetTypeId) { - this.assetTypeId = assetTypeId; - return this; - } - - /** - * Xero generated unique identifier for asset types - * @return assetTypeId - **/ - @ApiModelProperty(example = "5da209c5-5e19-4a43-b925-71b776c49ced", required = true, value = "Xero generated unique identifier for asset types") - public UUID getAssetTypeId() { - return assetTypeId; - } - - public void setAssetTypeId(UUID assetTypeId) { - this.assetTypeId = assetTypeId; - } - - public AssetType assetTypeName(String assetTypeName) { - this.assetTypeName = assetTypeName; - return this; - } - - /** - * The name of the asset type - * @return assetTypeName - **/ - @ApiModelProperty(example = "Computer Equipment", required = true, value = "The name of the asset type") - public String getAssetTypeName() { - return assetTypeName; - } - - public void setAssetTypeName(String assetTypeName) { - this.assetTypeName = assetTypeName; - } - - public AssetType fixedAssetAccountId(UUID fixedAssetAccountId) { - this.fixedAssetAccountId = fixedAssetAccountId; - return this; - } - - /** - * The asset account for fixed assets of this type - * @return fixedAssetAccountId - **/ - @ApiModelProperty(example = "24e260f1-bfc4-4766-ad7f-8a8ce01de879", value = "The asset account for fixed assets of this type") - public UUID getFixedAssetAccountId() { - return fixedAssetAccountId; - } - - public void setFixedAssetAccountId(UUID fixedAssetAccountId) { - this.fixedAssetAccountId = fixedAssetAccountId; - } - - public AssetType depreciationExpenseAccountId(UUID depreciationExpenseAccountId) { - this.depreciationExpenseAccountId = depreciationExpenseAccountId; - return this; - } - - /** - * The expense account for the depreciation of fixed assets of this type - * @return depreciationExpenseAccountId - **/ - @ApiModelProperty(example = "b23fc79b-d66b-44b0-a240-e138e086fcbc", value = "The expense account for the depreciation of fixed assets of this type") - public UUID getDepreciationExpenseAccountId() { - return depreciationExpenseAccountId; - } - - public void setDepreciationExpenseAccountId(UUID depreciationExpenseAccountId) { - this.depreciationExpenseAccountId = depreciationExpenseAccountId; - } - - public AssetType accumulatedDepreciationAccountId(UUID accumulatedDepreciationAccountId) { - this.accumulatedDepreciationAccountId = accumulatedDepreciationAccountId; - return this; - } - - /** - * The account for accumulated depreciation of fixed assets of this type - * @return accumulatedDepreciationAccountId - **/ - @ApiModelProperty(example = "ca4c6b39-4f4f-43e8-98da-5e1f350a6694", value = "The account for accumulated depreciation of fixed assets of this type") - public UUID getAccumulatedDepreciationAccountId() { - return accumulatedDepreciationAccountId; - } - - public void setAccumulatedDepreciationAccountId(UUID accumulatedDepreciationAccountId) { - this.accumulatedDepreciationAccountId = accumulatedDepreciationAccountId; - } - - public AssetType bookDepreciationSetting(BookDepreciationSetting bookDepreciationSetting) { - this.bookDepreciationSetting = bookDepreciationSetting; - return this; - } - - /** - * Get bookDepreciationSetting - * @return bookDepreciationSetting - **/ - @ApiModelProperty(required = true, value = "") - public BookDepreciationSetting getBookDepreciationSetting() { - return bookDepreciationSetting; - } - - public void setBookDepreciationSetting(BookDepreciationSetting bookDepreciationSetting) { - this.bookDepreciationSetting = bookDepreciationSetting; - } - - public AssetType locks(Integer locks) { - this.locks = locks; - return this; - } - - /** - * All asset types that have accumulated depreciation for any assets that use them are deemed ‘locked’ and cannot be removed. - * @return locks - **/ - @ApiModelProperty(example = "33", value = "All asset types that have accumulated depreciation for any assets that use them are deemed ‘locked’ and cannot be removed.") - public Integer getLocks() { - return locks; - } - - public void setLocks(Integer locks) { - this.locks = locks; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AssetType assetType = (AssetType) o; - return Objects.equals(this.assetTypeId, assetType.assetTypeId) && - Objects.equals(this.assetTypeName, assetType.assetTypeName) && - Objects.equals(this.fixedAssetAccountId, assetType.fixedAssetAccountId) && - Objects.equals(this.depreciationExpenseAccountId, assetType.depreciationExpenseAccountId) && - Objects.equals(this.accumulatedDepreciationAccountId, assetType.accumulatedDepreciationAccountId) && - Objects.equals(this.bookDepreciationSetting, assetType.bookDepreciationSetting) && - Objects.equals(this.locks, assetType.locks); - } - - @Override - public int hashCode() { - return Objects.hash(assetTypeId, assetTypeName, fixedAssetAccountId, depreciationExpenseAccountId, accumulatedDepreciationAccountId, bookDepreciationSetting, locks); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AssetType {\n"); - - sb.append(" assetTypeId: ").append(toIndentedString(assetTypeId)).append("\n"); - sb.append(" assetTypeName: ").append(toIndentedString(assetTypeName)).append("\n"); - sb.append(" fixedAssetAccountId: ").append(toIndentedString(fixedAssetAccountId)).append("\n"); - sb.append(" depreciationExpenseAccountId: ").append(toIndentedString(depreciationExpenseAccountId)).append("\n"); - sb.append(" accumulatedDepreciationAccountId: ").append(toIndentedString(accumulatedDepreciationAccountId)).append("\n"); - sb.append(" bookDepreciationSetting: ").append(toIndentedString(bookDepreciationSetting)).append("\n"); - sb.append(" locks: ").append(toIndentedString(locks)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/assets/Assets.java b/src/main/java/com/xero/models/assets/Assets.java deleted file mode 100644 index 4be75170..00000000 --- a/src/main/java/com/xero/models/assets/Assets.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Xero Assets API - * This the Xero Assets API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.assets; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.assets.Asset; -import com.xero.models.assets.Pagination; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; - -/** - * Assets - */ - -public class Assets { - @JsonProperty("pagination") - private Pagination pagination = null; - - @JsonProperty("items") - private List items = null; - - public Assets pagination(Pagination pagination) { - this.pagination = pagination; - return this; - } - - /** - * Get pagination - * @return pagination - **/ - @ApiModelProperty(value = "") - public Pagination getPagination() { - return pagination; - } - - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } - - public Assets items(List items) { - this.items = items; - return this; - } - - public Assets addItemsItem(Asset itemsItem) { - if (this.items == null) { - this.items = new ArrayList(); - } - this.items.add(itemsItem); - return this; - } - - /** - * Get items - * @return items - **/ - @ApiModelProperty(value = "") - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Assets assets = (Assets) o; - return Objects.equals(this.pagination, assets.pagination) && - Objects.equals(this.items, assets.items); - } - - @Override - public int hashCode() { - return Objects.hash(pagination, items); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Assets {\n"); - - sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); - sb.append(" items: ").append(toIndentedString(items)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/assets/BookDepreciationDetail.java b/src/main/java/com/xero/models/assets/BookDepreciationDetail.java deleted file mode 100644 index 894d4b22..00000000 --- a/src/main/java/com/xero/models/assets/BookDepreciationDetail.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Xero Assets API - * This the Xero Assets API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.assets; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.threeten.bp.LocalDate; - -/** - * BookDepreciationDetail - */ - -public class BookDepreciationDetail { - @JsonProperty("currentCapitalGain") - private Integer currentCapitalGain = null; - - @JsonProperty("currentGainLoss") - private Integer currentGainLoss = null; - - @JsonProperty("depreciationStartDate") - private LocalDate depreciationStartDate = null; - - @JsonProperty("costLimit") - private Integer costLimit = null; - - @JsonProperty("residualValue") - private Integer residualValue = null; - - @JsonProperty("priorAccumDepreciationAmount") - private Integer priorAccumDepreciationAmount = null; - - @JsonProperty("currentAccumDepreciationAmount") - private Integer currentAccumDepreciationAmount = null; - - public BookDepreciationDetail currentCapitalGain(Integer currentCapitalGain) { - this.currentCapitalGain = currentCapitalGain; - return this; - } - - /** - * When an asset is disposed, this will be the sell price minus the purchase price if a profit was made. - * @return currentCapitalGain - **/ - @ApiModelProperty(example = "0", value = "When an asset is disposed, this will be the sell price minus the purchase price if a profit was made.") - public Integer getCurrentCapitalGain() { - return currentCapitalGain; - } - - public void setCurrentCapitalGain(Integer currentCapitalGain) { - this.currentCapitalGain = currentCapitalGain; - } - - public BookDepreciationDetail currentGainLoss(Integer currentGainLoss) { - this.currentGainLoss = currentGainLoss; - return this; - } - - /** - * When an asset is disposed, this will be the lowest one of sell price or purchase price, minus the current book value. - * @return currentGainLoss - **/ - @ApiModelProperty(example = "0", value = "When an asset is disposed, this will be the lowest one of sell price or purchase price, minus the current book value.") - public Integer getCurrentGainLoss() { - return currentGainLoss; - } - - public void setCurrentGainLoss(Integer currentGainLoss) { - this.currentGainLoss = currentGainLoss; - } - - public BookDepreciationDetail depreciationStartDate(LocalDate depreciationStartDate) { - this.depreciationStartDate = depreciationStartDate; - return this; - } - - /** - * YYYY-MM-DD - * @return depreciationStartDate - **/ - @ApiModelProperty(value = "YYYY-MM-DD") - public LocalDate getDepreciationStartDate() { - return depreciationStartDate; - } - - public void setDepreciationStartDate(LocalDate depreciationStartDate) { - this.depreciationStartDate = depreciationStartDate; - } - - public BookDepreciationDetail costLimit(Integer costLimit) { - this.costLimit = costLimit; - return this; - } - - /** - * The value of the asset you want to depreciate, if this is less than the cost of the asset. - * @return costLimit - **/ - @ApiModelProperty(example = "100000", value = "The value of the asset you want to depreciate, if this is less than the cost of the asset.") - public Integer getCostLimit() { - return costLimit; - } - - public void setCostLimit(Integer costLimit) { - this.costLimit = costLimit; - } - - public BookDepreciationDetail residualValue(Integer residualValue) { - this.residualValue = residualValue; - return this; - } - - /** - * The value of the asset remaining when you've fully depreciated it. - * @return residualValue - **/ - @ApiModelProperty(example = "10000", value = "The value of the asset remaining when you've fully depreciated it.") - public Integer getResidualValue() { - return residualValue; - } - - public void setResidualValue(Integer residualValue) { - this.residualValue = residualValue; - } - - public BookDepreciationDetail priorAccumDepreciationAmount(Integer priorAccumDepreciationAmount) { - this.priorAccumDepreciationAmount = priorAccumDepreciationAmount; - return this; - } - - /** - * All depreciation prior to the current financial year. - * @return priorAccumDepreciationAmount - **/ - @ApiModelProperty(example = "0", value = "All depreciation prior to the current financial year.") - public Integer getPriorAccumDepreciationAmount() { - return priorAccumDepreciationAmount; - } - - public void setPriorAccumDepreciationAmount(Integer priorAccumDepreciationAmount) { - this.priorAccumDepreciationAmount = priorAccumDepreciationAmount; - } - - public BookDepreciationDetail currentAccumDepreciationAmount(Integer currentAccumDepreciationAmount) { - this.currentAccumDepreciationAmount = currentAccumDepreciationAmount; - return this; - } - - /** - * All depreciation occurring in the current financial year. - * @return currentAccumDepreciationAmount - **/ - @ApiModelProperty(example = "0", value = "All depreciation occurring in the current financial year.") - public Integer getCurrentAccumDepreciationAmount() { - return currentAccumDepreciationAmount; - } - - public void setCurrentAccumDepreciationAmount(Integer currentAccumDepreciationAmount) { - this.currentAccumDepreciationAmount = currentAccumDepreciationAmount; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BookDepreciationDetail bookDepreciationDetail = (BookDepreciationDetail) o; - return Objects.equals(this.currentCapitalGain, bookDepreciationDetail.currentCapitalGain) && - Objects.equals(this.currentGainLoss, bookDepreciationDetail.currentGainLoss) && - Objects.equals(this.depreciationStartDate, bookDepreciationDetail.depreciationStartDate) && - Objects.equals(this.costLimit, bookDepreciationDetail.costLimit) && - Objects.equals(this.residualValue, bookDepreciationDetail.residualValue) && - Objects.equals(this.priorAccumDepreciationAmount, bookDepreciationDetail.priorAccumDepreciationAmount) && - Objects.equals(this.currentAccumDepreciationAmount, bookDepreciationDetail.currentAccumDepreciationAmount); - } - - @Override - public int hashCode() { - return Objects.hash(currentCapitalGain, currentGainLoss, depreciationStartDate, costLimit, residualValue, priorAccumDepreciationAmount, currentAccumDepreciationAmount); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BookDepreciationDetail {\n"); - - sb.append(" currentCapitalGain: ").append(toIndentedString(currentCapitalGain)).append("\n"); - sb.append(" currentGainLoss: ").append(toIndentedString(currentGainLoss)).append("\n"); - sb.append(" depreciationStartDate: ").append(toIndentedString(depreciationStartDate)).append("\n"); - sb.append(" costLimit: ").append(toIndentedString(costLimit)).append("\n"); - sb.append(" residualValue: ").append(toIndentedString(residualValue)).append("\n"); - sb.append(" priorAccumDepreciationAmount: ").append(toIndentedString(priorAccumDepreciationAmount)).append("\n"); - sb.append(" currentAccumDepreciationAmount: ").append(toIndentedString(currentAccumDepreciationAmount)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/assets/BookDepreciationSetting.java b/src/main/java/com/xero/models/assets/BookDepreciationSetting.java deleted file mode 100644 index bbe31063..00000000 --- a/src/main/java/com/xero/models/assets/BookDepreciationSetting.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Xero Assets API - * This the Xero Assets API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.assets; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * BookDepreciationSetting - */ - -public class BookDepreciationSetting { - /** - * The method of depreciation applied to this asset. See Depreciation Methods - */ - public enum DepreciationMethodEnum { - NODEPRECIATION("NoDepreciation"), - - STRAIGHTLINE("StraightLine"), - - DIMINISHINGVALUE100("DiminishingValue100"), - - DIMINISHINGVALUE150("DiminishingValue150"), - - DIMINISHINGVALUE200("DiminishingValue200"), - - FULLDEPRECIATION("FullDepreciation"); - - private String value; - - DepreciationMethodEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static DepreciationMethodEnum fromValue(String text) { - for (DepreciationMethodEnum b : DepreciationMethodEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - } - - @JsonProperty("depreciationMethod") - private DepreciationMethodEnum depreciationMethod = null; - - /** - * The method of averaging applied to this asset. See Averaging Methods - */ - public enum AveragingMethodEnum { - FULLMONTH("FullMonth"), - - ACTUALDAYS("ActualDays"); - - private String value; - - AveragingMethodEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static AveragingMethodEnum fromValue(String text) { - for (AveragingMethodEnum b : AveragingMethodEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - } - - @JsonProperty("averagingMethod") - private AveragingMethodEnum averagingMethod = null; - - @JsonProperty("depreciationRate") - private Float depreciationRate = null; - - @JsonProperty("effectiveLifeYears") - private Integer effectiveLifeYears = null; - - /** - * See Depreciation Calculation Methods - */ - public enum DepreciationCalculationMethodEnum { - RATE("Rate"), - - LIFE("Life"), - - NONE("None"); - - private String value; - - DepreciationCalculationMethodEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static DepreciationCalculationMethodEnum fromValue(String text) { - for (DepreciationCalculationMethodEnum b : DepreciationCalculationMethodEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - } - - @JsonProperty("depreciationCalculationMethod") - private DepreciationCalculationMethodEnum depreciationCalculationMethod = null; - - public BookDepreciationSetting depreciationMethod(DepreciationMethodEnum depreciationMethod) { - this.depreciationMethod = depreciationMethod; - return this; - } - - /** - * The method of depreciation applied to this asset. See Depreciation Methods - * @return depreciationMethod - **/ - @ApiModelProperty(example = "StraightLine", value = "The method of depreciation applied to this asset. See Depreciation Methods") - public DepreciationMethodEnum getDepreciationMethod() { - return depreciationMethod; - } - - public void setDepreciationMethod(DepreciationMethodEnum depreciationMethod) { - this.depreciationMethod = depreciationMethod; - } - - public BookDepreciationSetting averagingMethod(AveragingMethodEnum averagingMethod) { - this.averagingMethod = averagingMethod; - return this; - } - - /** - * The method of averaging applied to this asset. See Averaging Methods - * @return averagingMethod - **/ - @ApiModelProperty(example = "ActualDays", value = "The method of averaging applied to this asset. See Averaging Methods") - public AveragingMethodEnum getAveragingMethod() { - return averagingMethod; - } - - public void setAveragingMethod(AveragingMethodEnum averagingMethod) { - this.averagingMethod = averagingMethod; - } - - public BookDepreciationSetting depreciationRate(Float depreciationRate) { - this.depreciationRate = depreciationRate; - return this; - } - - /** - * The rate of depreciation (e.g. 0.05) - * @return depreciationRate - **/ - @ApiModelProperty(example = "0.05", value = "The rate of depreciation (e.g. 0.05)") - public Float getDepreciationRate() { - return depreciationRate; - } - - public void setDepreciationRate(Float depreciationRate) { - this.depreciationRate = depreciationRate; - } - - public BookDepreciationSetting effectiveLifeYears(Integer effectiveLifeYears) { - this.effectiveLifeYears = effectiveLifeYears; - return this; - } - - /** - * Effective life of the asset in years (e.g. 5) - * @return effectiveLifeYears - **/ - @ApiModelProperty(example = "5", value = "Effective life of the asset in years (e.g. 5)") - public Integer getEffectiveLifeYears() { - return effectiveLifeYears; - } - - public void setEffectiveLifeYears(Integer effectiveLifeYears) { - this.effectiveLifeYears = effectiveLifeYears; - } - - public BookDepreciationSetting depreciationCalculationMethod(DepreciationCalculationMethodEnum depreciationCalculationMethod) { - this.depreciationCalculationMethod = depreciationCalculationMethod; - return this; - } - - /** - * See Depreciation Calculation Methods - * @return depreciationCalculationMethod - **/ - @ApiModelProperty(example = "None", value = "See Depreciation Calculation Methods") - public DepreciationCalculationMethodEnum getDepreciationCalculationMethod() { - return depreciationCalculationMethod; - } - - public void setDepreciationCalculationMethod(DepreciationCalculationMethodEnum depreciationCalculationMethod) { - this.depreciationCalculationMethod = depreciationCalculationMethod; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BookDepreciationSetting bookDepreciationSetting = (BookDepreciationSetting) o; - return Objects.equals(this.depreciationMethod, bookDepreciationSetting.depreciationMethod) && - Objects.equals(this.averagingMethod, bookDepreciationSetting.averagingMethod) && - Objects.equals(this.depreciationRate, bookDepreciationSetting.depreciationRate) && - Objects.equals(this.effectiveLifeYears, bookDepreciationSetting.effectiveLifeYears) && - Objects.equals(this.depreciationCalculationMethod, bookDepreciationSetting.depreciationCalculationMethod); - } - - @Override - public int hashCode() { - return Objects.hash(depreciationMethod, averagingMethod, depreciationRate, effectiveLifeYears, depreciationCalculationMethod); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BookDepreciationSetting {\n"); - - sb.append(" depreciationMethod: ").append(toIndentedString(depreciationMethod)).append("\n"); - sb.append(" averagingMethod: ").append(toIndentedString(averagingMethod)).append("\n"); - sb.append(" depreciationRate: ").append(toIndentedString(depreciationRate)).append("\n"); - sb.append(" effectiveLifeYears: ").append(toIndentedString(effectiveLifeYears)).append("\n"); - sb.append(" depreciationCalculationMethod: ").append(toIndentedString(depreciationCalculationMethod)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/assets/Pagination.java b/src/main/java/com/xero/models/assets/Pagination.java deleted file mode 100644 index d181e488..00000000 --- a/src/main/java/com/xero/models/assets/Pagination.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Xero Assets API - * This the Xero Assets API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.assets; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Pagination - */ - -public class Pagination { - @JsonProperty("page") - private Integer page = null; - - @JsonProperty("pageSize") - private Integer pageSize = null; - - @JsonProperty("pageCount") - private Integer pageCount = null; - - @JsonProperty("itemCount") - private Integer itemCount = null; - - public Pagination page(Integer page) { - this.page = page; - return this; - } - - /** - * Get page - * @return page - **/ - @ApiModelProperty(example = "1", value = "") - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public Pagination pageSize(Integer pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Get pageSize - * @return pageSize - **/ - @ApiModelProperty(example = "10", value = "") - public Integer getPageSize() { - return pageSize; - } - - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - } - - public Pagination pageCount(Integer pageCount) { - this.pageCount = pageCount; - return this; - } - - /** - * Get pageCount - * @return pageCount - **/ - @ApiModelProperty(example = "1", value = "") - public Integer getPageCount() { - return pageCount; - } - - public void setPageCount(Integer pageCount) { - this.pageCount = pageCount; - } - - public Pagination itemCount(Integer itemCount) { - this.itemCount = itemCount; - return this; - } - - /** - * Get itemCount - * @return itemCount - **/ - @ApiModelProperty(example = "2", value = "") - public Integer getItemCount() { - return itemCount; - } - - public void setItemCount(Integer itemCount) { - this.itemCount = itemCount; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Pagination pagination = (Pagination) o; - return Objects.equals(this.page, pagination.page) && - Objects.equals(this.pageSize, pagination.pageSize) && - Objects.equals(this.pageCount, pagination.pageCount) && - Objects.equals(this.itemCount, pagination.itemCount); - } - - @Override - public int hashCode() { - return Objects.hash(page, pageSize, pageCount, itemCount); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Pagination {\n"); - - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); - sb.append(" pageCount: ").append(toIndentedString(pageCount)).append("\n"); - sb.append(" itemCount: ").append(toIndentedString(itemCount)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/assets/Setting.java b/src/main/java/com/xero/models/assets/Setting.java deleted file mode 100644 index 3997fdea..00000000 --- a/src/main/java/com/xero/models/assets/Setting.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Xero Assets API - * This the Xero Assets API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.assets; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.UUID; -import org.threeten.bp.LocalDate; - -/** - * Setting - */ - -public class Setting { - @JsonProperty("assetNumberPrefix") - private String assetNumberPrefix = null; - - @JsonProperty("assetNumberSequence") - private String assetNumberSequence = null; - - @JsonProperty("assetStartDate") - private LocalDate assetStartDate = null; - - @JsonProperty("lastDepreciationDate") - private LocalDate lastDepreciationDate = null; - - @JsonProperty("defaultGainOnDisposalAccountId") - private UUID defaultGainOnDisposalAccountId = null; - - @JsonProperty("defaultLossOnDisposalAccountId") - private UUID defaultLossOnDisposalAccountId = null; - - @JsonProperty("defaultCapitalGainOnDisposalAccountId") - private UUID defaultCapitalGainOnDisposalAccountId = null; - - @JsonProperty("optInForTax") - private Boolean optInForTax = null; - - public Setting assetNumberPrefix(String assetNumberPrefix) { - this.assetNumberPrefix = assetNumberPrefix; - return this; - } - - /** - * The prefix used for fixed asset numbers (“FA-” by default) - * @return assetNumberPrefix - **/ - @ApiModelProperty(example = "FA-", value = "The prefix used for fixed asset numbers (“FA-” by default)") - public String getAssetNumberPrefix() { - return assetNumberPrefix; - } - - public void setAssetNumberPrefix(String assetNumberPrefix) { - this.assetNumberPrefix = assetNumberPrefix; - } - - public Setting assetNumberSequence(String assetNumberSequence) { - this.assetNumberSequence = assetNumberSequence; - return this; - } - - /** - * The next available sequence number - * @return assetNumberSequence - **/ - @ApiModelProperty(example = "0022", value = "The next available sequence number") - public String getAssetNumberSequence() { - return assetNumberSequence; - } - - public void setAssetNumberSequence(String assetNumberSequence) { - this.assetNumberSequence = assetNumberSequence; - } - - public Setting assetStartDate(LocalDate assetStartDate) { - this.assetStartDate = assetStartDate; - return this; - } - - /** - * The date depreciation calculations started on registered fixed assets in Xero - * @return assetStartDate - **/ - @ApiModelProperty(value = "The date depreciation calculations started on registered fixed assets in Xero") - public LocalDate getAssetStartDate() { - return assetStartDate; - } - - public void setAssetStartDate(LocalDate assetStartDate) { - this.assetStartDate = assetStartDate; - } - - public Setting lastDepreciationDate(LocalDate lastDepreciationDate) { - this.lastDepreciationDate = lastDepreciationDate; - return this; - } - - /** - * The last depreciation date - * @return lastDepreciationDate - **/ - @ApiModelProperty(value = "The last depreciation date") - public LocalDate getLastDepreciationDate() { - return lastDepreciationDate; - } - - public void setLastDepreciationDate(LocalDate lastDepreciationDate) { - this.lastDepreciationDate = lastDepreciationDate; - } - - public Setting defaultGainOnDisposalAccountId(UUID defaultGainOnDisposalAccountId) { - this.defaultGainOnDisposalAccountId = defaultGainOnDisposalAccountId; - return this; - } - - /** - * Default account that gains are posted to - * @return defaultGainOnDisposalAccountId - **/ - @ApiModelProperty(example = "346ddb97-739a-4274-b43b-66aa3218d17c", value = "Default account that gains are posted to") - public UUID getDefaultGainOnDisposalAccountId() { - return defaultGainOnDisposalAccountId; - } - - public void setDefaultGainOnDisposalAccountId(UUID defaultGainOnDisposalAccountId) { - this.defaultGainOnDisposalAccountId = defaultGainOnDisposalAccountId; - } - - public Setting defaultLossOnDisposalAccountId(UUID defaultLossOnDisposalAccountId) { - this.defaultLossOnDisposalAccountId = defaultLossOnDisposalAccountId; - return this; - } - - /** - * Default account that losses are posted to - * @return defaultLossOnDisposalAccountId - **/ - @ApiModelProperty(example = "1b798541-24e2-4855-9309-c023a0b576f3", value = "Default account that losses are posted to") - public UUID getDefaultLossOnDisposalAccountId() { - return defaultLossOnDisposalAccountId; - } - - public void setDefaultLossOnDisposalAccountId(UUID defaultLossOnDisposalAccountId) { - this.defaultLossOnDisposalAccountId = defaultLossOnDisposalAccountId; - } - - public Setting defaultCapitalGainOnDisposalAccountId(UUID defaultCapitalGainOnDisposalAccountId) { - this.defaultCapitalGainOnDisposalAccountId = defaultCapitalGainOnDisposalAccountId; - return this; - } - - /** - * Default account that capital gains are posted to - * @return defaultCapitalGainOnDisposalAccountId - **/ - @ApiModelProperty(example = "6d6a0bdb-e118-45d8-a023-2ad617ec1cb7", value = "Default account that capital gains are posted to") - public UUID getDefaultCapitalGainOnDisposalAccountId() { - return defaultCapitalGainOnDisposalAccountId; - } - - public void setDefaultCapitalGainOnDisposalAccountId(UUID defaultCapitalGainOnDisposalAccountId) { - this.defaultCapitalGainOnDisposalAccountId = defaultCapitalGainOnDisposalAccountId; - } - - public Setting optInForTax(Boolean optInForTax) { - this.optInForTax = optInForTax; - return this; - } - - /** - * opt in for tax calculation - * @return optInForTax - **/ - @ApiModelProperty(value = "opt in for tax calculation") - public Boolean getOptInForTax() { - return optInForTax; - } - - public void setOptInForTax(Boolean optInForTax) { - this.optInForTax = optInForTax; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Setting setting = (Setting) o; - return Objects.equals(this.assetNumberPrefix, setting.assetNumberPrefix) && - Objects.equals(this.assetNumberSequence, setting.assetNumberSequence) && - Objects.equals(this.assetStartDate, setting.assetStartDate) && - Objects.equals(this.lastDepreciationDate, setting.lastDepreciationDate) && - Objects.equals(this.defaultGainOnDisposalAccountId, setting.defaultGainOnDisposalAccountId) && - Objects.equals(this.defaultLossOnDisposalAccountId, setting.defaultLossOnDisposalAccountId) && - Objects.equals(this.defaultCapitalGainOnDisposalAccountId, setting.defaultCapitalGainOnDisposalAccountId) && - Objects.equals(this.optInForTax, setting.optInForTax); - } - - @Override - public int hashCode() { - return Objects.hash(assetNumberPrefix, assetNumberSequence, assetStartDate, lastDepreciationDate, defaultGainOnDisposalAccountId, defaultLossOnDisposalAccountId, defaultCapitalGainOnDisposalAccountId, optInForTax); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Setting {\n"); - - sb.append(" assetNumberPrefix: ").append(toIndentedString(assetNumberPrefix)).append("\n"); - sb.append(" assetNumberSequence: ").append(toIndentedString(assetNumberSequence)).append("\n"); - sb.append(" assetStartDate: ").append(toIndentedString(assetStartDate)).append("\n"); - sb.append(" lastDepreciationDate: ").append(toIndentedString(lastDepreciationDate)).append("\n"); - sb.append(" defaultGainOnDisposalAccountId: ").append(toIndentedString(defaultGainOnDisposalAccountId)).append("\n"); - sb.append(" defaultLossOnDisposalAccountId: ").append(toIndentedString(defaultLossOnDisposalAccountId)).append("\n"); - sb.append(" defaultCapitalGainOnDisposalAccountId: ").append(toIndentedString(defaultCapitalGainOnDisposalAccountId)).append("\n"); - sb.append(" optInForTax: ").append(toIndentedString(optInForTax)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java b/src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java deleted file mode 100644 index 3507c206..00000000 --- a/src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Gets or Sets CreditDebitIndicator - */ -public enum CreditDebitIndicator { - - CREDIT("CREDIT"), - - DEBIT("DEBIT"); - - private String value; - - CreditDebitIndicator(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static CreditDebitIndicator fromValue(String text) { - for (CreditDebitIndicator b : CreditDebitIndicator.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } -} - diff --git a/src/main/java/com/xero/models/bankfeeds/EndBalance.java b/src/main/java/com/xero/models/bankfeeds/EndBalance.java deleted file mode 100644 index 549a9ff5..00000000 --- a/src/main/java/com/xero/models/bankfeeds/EndBalance.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.bankfeeds.CreditDebitIndicator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * EndBalance - */ - -public class EndBalance { - @JsonProperty("amount") - private String amount = null; - - @JsonProperty("creditDebitIndicator") - private CreditDebitIndicator creditDebitIndicator = null; - - public EndBalance amount(String amount) { - this.amount = amount; - return this; - } - - /** - * Get amount - * @return amount - **/ - @ApiModelProperty(example = "10.1340", value = "") - public String getAmount() { - return amount; - } - - public void setAmount(String amount) { - this.amount = amount; - } - - public EndBalance creditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { - this.creditDebitIndicator = creditDebitIndicator; - return this; - } - - /** - * Get creditDebitIndicator - * @return creditDebitIndicator - **/ - @ApiModelProperty(value = "") - public CreditDebitIndicator getCreditDebitIndicator() { - return creditDebitIndicator; - } - - public void setCreditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { - this.creditDebitIndicator = creditDebitIndicator; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EndBalance endBalance = (EndBalance) o; - return Objects.equals(this.amount, endBalance.amount) && - Objects.equals(this.creditDebitIndicator, endBalance.creditDebitIndicator); - } - - @Override - public int hashCode() { - return Objects.hash(amount, creditDebitIndicator); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EndBalance {\n"); - - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); - sb.append(" creditDebitIndicator: ").append(toIndentedString(creditDebitIndicator)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/bankfeeds/Error.java b/src/main/java/com/xero/models/bankfeeds/Error.java deleted file mode 100644 index 0c01412d..00000000 --- a/src/main/java/com/xero/models/bankfeeds/Error.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * On error, the API consumer will receive an HTTP response with a HTTP Status Code of 4xx or 5xx and a Content-Type of application/problem+json. - */ -@ApiModel(description = "On error, the API consumer will receive an HTTP response with a HTTP Status Code of 4xx or 5xx and a Content-Type of application/problem+json.") - -public class Error { - @JsonProperty("title") - private String title = null; - - @JsonProperty("status") - private Integer status = null; - - @JsonProperty("detail") - private String detail = null; - - /** - * Gets or Sets type - */ - public enum TypeEnum { - INVALID_REQUEST("invalid-request"), - - INVALID_APPLICATION("invalid-application"), - - INVALID_FEED_CONNECTION("invalid-feed-connection"), - - DUPLICATE_STATEMENT("duplicate-statement"), - - INVALID_END_BALANCE("invalid-end-balance"), - - INVALID_START_AND_END_DATE("invalid-start-and-end-date"), - - INVALID_START_DATE("invalid-start-date"), - - INTERNAL_ERROR("internal-error"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String text) { - for (TypeEnum b : TypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - } - - @JsonProperty("type") - private TypeEnum type = null; - - public Error title(String title) { - this.title = title; - return this; - } - - /** - * Get title - * @return title - **/ - @ApiModelProperty(example = "Invalid Application", value = "") - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public Error status(Integer status) { - this.status = status; - return this; - } - - /** - * Get status - * @return status - **/ - @ApiModelProperty(example = "403", value = "") - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public Error detail(String detail) { - this.detail = detail; - return this; - } - - /** - * Get detail - * @return detail - **/ - @ApiModelProperty(example = "The application has not been configured to use these API endpoints.", value = "") - public String getDetail() { - return detail; - } - - public void setDetail(String detail) { - this.detail = detail; - } - - public Error type(TypeEnum type) { - this.type = type; - return this; - } - - /** - * Get type - * @return type - **/ - @ApiModelProperty(example = "invalid-application", value = "") - public TypeEnum getType() { - return type; - } - - public void setType(TypeEnum type) { - this.type = type; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Error error = (Error) o; - return Objects.equals(this.title, error.title) && - Objects.equals(this.status, error.status) && - Objects.equals(this.detail, error.detail) && - Objects.equals(this.type, error.type); - } - - @Override - public int hashCode() { - return Objects.hash(title, status, detail, type); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Error {\n"); - - sb.append(" title: ").append(toIndentedString(title)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/bankfeeds/FeedConnection.java b/src/main/java/com/xero/models/bankfeeds/FeedConnection.java deleted file mode 100644 index a4e75abb..00000000 --- a/src/main/java/com/xero/models/bankfeeds/FeedConnection.java +++ /dev/null @@ -1,369 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.bankfeeds.Error; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * FeedConnection - */ - -public class FeedConnection { - @JsonProperty("id") - private String id = null; - - @JsonProperty("accountToken") - private String accountToken = null; - - @JsonProperty("accountNumber") - private String accountNumber = null; - - @JsonProperty("accountName") - private String accountName = null; - - @JsonProperty("accountId") - private String accountId = null; - - /** - * Gets or Sets accountType - */ - public enum AccountTypeEnum { - BANK("BANK"), - - CREDITCARD("CREDITCARD"); - - private String value; - - AccountTypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static AccountTypeEnum fromValue(String text) { - for (AccountTypeEnum b : AccountTypeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - } - - @JsonProperty("accountType") - private AccountTypeEnum accountType = null; - - @JsonProperty("currency") - private String currency = null; - - @JsonProperty("country") - private String country = null; - - /** - * Gets or Sets status - */ - public enum StatusEnum { - PENDING("PENDING"), - - REJECTED("REJECTED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static StatusEnum fromValue(String text) { - for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - } - - @JsonProperty("status") - private StatusEnum status = null; - - @JsonProperty("error") - private Error error = null; - - public FeedConnection id(String id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - **/ - @ApiModelProperty(example = "0d3cf8d-95dc-4466-8dc0-47e6d1197e28", required = true, value = "") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public FeedConnection accountToken(String accountToken) { - this.accountToken = accountToken; - return this; - } - - /** - * Get accountToken - * @return accountToken - **/ - @ApiModelProperty(example = "10000123", value = "") - public String getAccountToken() { - return accountToken; - } - - public void setAccountToken(String accountToken) { - this.accountToken = accountToken; - } - - public FeedConnection accountNumber(String accountNumber) { - this.accountNumber = accountNumber; - return this; - } - - /** - * Get accountNumber - * @return accountNumber - **/ - @ApiModelProperty(example = "3809087654321500", value = "") - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - public FeedConnection accountName(String accountName) { - this.accountName = accountName; - return this; - } - - /** - * Get accountName - * @return accountName - **/ - @ApiModelProperty(example = "Joe's Savings Account", value = "") - public String getAccountName() { - return accountName; - } - - public void setAccountName(String accountName) { - this.accountName = accountName; - } - - public FeedConnection accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Get accountId - * @return accountId - **/ - @ApiModelProperty(example = "079a88ea-276d-41fb-a1f1-366ef3e22921", value = "") - public String getAccountId() { - return accountId; - } - - public void setAccountId(String accountId) { - this.accountId = accountId; - } - - public FeedConnection accountType(AccountTypeEnum accountType) { - this.accountType = accountType; - return this; - } - - /** - * Get accountType - * @return accountType - **/ - @ApiModelProperty(example = "BANK", value = "") - public AccountTypeEnum getAccountType() { - return accountType; - } - - public void setAccountType(AccountTypeEnum accountType) { - this.accountType = accountType; - } - - public FeedConnection currency(String currency) { - this.currency = currency; - return this; - } - - /** - * Get currency - * @return currency - **/ - @ApiModelProperty(example = "AUD", value = "") - public String getCurrency() { - return currency; - } - - public void setCurrency(String currency) { - this.currency = currency; - } - - public FeedConnection country(String country) { - this.country = country; - return this; - } - - /** - * Get country - * @return country - **/ - @ApiModelProperty(example = "GB", value = "") - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - public FeedConnection status(StatusEnum status) { - this.status = status; - return this; - } - - /** - * Get status - * @return status - **/ - @ApiModelProperty(example = "REJECTED", value = "") - public StatusEnum getStatus() { - return status; - } - - public void setStatus(StatusEnum status) { - this.status = status; - } - - public FeedConnection error(Error error) { - this.error = error; - return this; - } - - /** - * Get error - * @return error - **/ - @ApiModelProperty(value = "") - public Error getError() { - return error; - } - - public void setError(Error error) { - this.error = error; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - FeedConnection feedConnection = (FeedConnection) o; - return Objects.equals(this.id, feedConnection.id) && - Objects.equals(this.accountToken, feedConnection.accountToken) && - Objects.equals(this.accountNumber, feedConnection.accountNumber) && - Objects.equals(this.accountName, feedConnection.accountName) && - Objects.equals(this.accountId, feedConnection.accountId) && - Objects.equals(this.accountType, feedConnection.accountType) && - Objects.equals(this.currency, feedConnection.currency) && - Objects.equals(this.country, feedConnection.country) && - Objects.equals(this.status, feedConnection.status) && - Objects.equals(this.error, feedConnection.error); - } - - @Override - public int hashCode() { - return Objects.hash(id, accountToken, accountNumber, accountName, accountId, accountType, currency, country, status, error); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FeedConnection {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" accountToken: ").append(toIndentedString(accountToken)).append("\n"); - sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); - sb.append(" accountName: ").append(toIndentedString(accountName)).append("\n"); - sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); - sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); - sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); - sb.append(" country: ").append(toIndentedString(country)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" error: ").append(toIndentedString(error)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/bankfeeds/FeedConnections.java b/src/main/java/com/xero/models/bankfeeds/FeedConnections.java deleted file mode 100644 index 95c44b8b..00000000 --- a/src/main/java/com/xero/models/bankfeeds/FeedConnections.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.bankfeeds.FeedConnection; -import com.xero.models.bankfeeds.Pagination; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; - -/** - * FeedConnections - */ - -public class FeedConnections { - @JsonProperty("pagination") - private Pagination pagination = null; - - @JsonProperty("items") - private List items = null; - - public FeedConnections pagination(Pagination pagination) { - this.pagination = pagination; - return this; - } - - /** - * Get pagination - * @return pagination - **/ - @ApiModelProperty(value = "") - public Pagination getPagination() { - return pagination; - } - - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } - - public FeedConnections items(List items) { - this.items = items; - return this; - } - - public FeedConnections addItemsItem(FeedConnection itemsItem) { - if (this.items == null) { - this.items = new ArrayList(); - } - this.items.add(itemsItem); - return this; - } - - /** - * Get items - * @return items - **/ - @ApiModelProperty(value = "") - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - FeedConnections feedConnections = (FeedConnections) o; - return Objects.equals(this.pagination, feedConnections.pagination) && - Objects.equals(this.items, feedConnections.items); - } - - @Override - public int hashCode() { - return Objects.hash(pagination, items); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FeedConnections {\n"); - - sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); - sb.append(" items: ").append(toIndentedString(items)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/bankfeeds/Pagination.java b/src/main/java/com/xero/models/bankfeeds/Pagination.java deleted file mode 100644 index 6d05455a..00000000 --- a/src/main/java/com/xero/models/bankfeeds/Pagination.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Pagination - */ - -public class Pagination { - @JsonProperty("page") - private Integer page = null; - - @JsonProperty("pageSize") - private Integer pageSize = null; - - @JsonProperty("pageCount") - private Integer pageCount = null; - - @JsonProperty("itemCount") - private Integer itemCount = null; - - public Pagination page(Integer page) { - this.page = page; - return this; - } - - /** - * Get page - * @return page - **/ - @ApiModelProperty(example = "1", value = "") - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public Pagination pageSize(Integer pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Get pageSize - * @return pageSize - **/ - @ApiModelProperty(example = "10", value = "") - public Integer getPageSize() { - return pageSize; - } - - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - } - - public Pagination pageCount(Integer pageCount) { - this.pageCount = pageCount; - return this; - } - - /** - * Get pageCount - * @return pageCount - **/ - @ApiModelProperty(example = "1", value = "") - public Integer getPageCount() { - return pageCount; - } - - public void setPageCount(Integer pageCount) { - this.pageCount = pageCount; - } - - public Pagination itemCount(Integer itemCount) { - this.itemCount = itemCount; - return this; - } - - /** - * Get itemCount - * @return itemCount - **/ - @ApiModelProperty(example = "2", value = "") - public Integer getItemCount() { - return itemCount; - } - - public void setItemCount(Integer itemCount) { - this.itemCount = itemCount; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Pagination pagination = (Pagination) o; - return Objects.equals(this.page, pagination.page) && - Objects.equals(this.pageSize, pagination.pageSize) && - Objects.equals(this.pageCount, pagination.pageCount) && - Objects.equals(this.itemCount, pagination.itemCount); - } - - @Override - public int hashCode() { - return Objects.hash(page, pageSize, pageCount, itemCount); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Pagination {\n"); - - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); - sb.append(" pageCount: ").append(toIndentedString(pageCount)).append("\n"); - sb.append(" itemCount: ").append(toIndentedString(itemCount)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/bankfeeds/StartBalance.java b/src/main/java/com/xero/models/bankfeeds/StartBalance.java deleted file mode 100644 index c6ac1662..00000000 --- a/src/main/java/com/xero/models/bankfeeds/StartBalance.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.bankfeeds.CreditDebitIndicator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * StartBalance - */ - -public class StartBalance { - @JsonProperty("amount") - private String amount = null; - - @JsonProperty("creditDebitIndicator") - private CreditDebitIndicator creditDebitIndicator = null; - - public StartBalance amount(String amount) { - this.amount = amount; - return this; - } - - /** - * Get amount - * @return amount - **/ - @ApiModelProperty(example = "9.0000", value = "") - public String getAmount() { - return amount; - } - - public void setAmount(String amount) { - this.amount = amount; - } - - public StartBalance creditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { - this.creditDebitIndicator = creditDebitIndicator; - return this; - } - - /** - * Get creditDebitIndicator - * @return creditDebitIndicator - **/ - @ApiModelProperty(value = "") - public CreditDebitIndicator getCreditDebitIndicator() { - return creditDebitIndicator; - } - - public void setCreditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { - this.creditDebitIndicator = creditDebitIndicator; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - StartBalance startBalance = (StartBalance) o; - return Objects.equals(this.amount, startBalance.amount) && - Objects.equals(this.creditDebitIndicator, startBalance.creditDebitIndicator); - } - - @Override - public int hashCode() { - return Objects.hash(amount, creditDebitIndicator); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class StartBalance {\n"); - - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); - sb.append(" creditDebitIndicator: ").append(toIndentedString(creditDebitIndicator)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/bankfeeds/Statement.java b/src/main/java/com/xero/models/bankfeeds/Statement.java deleted file mode 100644 index 886a98c9..00000000 --- a/src/main/java/com/xero/models/bankfeeds/Statement.java +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.bankfeeds.EndBalance; -import com.xero.models.bankfeeds.Error; -import com.xero.models.bankfeeds.StartBalance; -import com.xero.models.bankfeeds.StatementLines; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; -import org.threeten.bp.LocalDate; - -/** - * Statement - */ - -public class Statement { - @JsonProperty("id") - private String id = null; - - @JsonProperty("feedConnectionId") - private String feedConnectionId = null; - - /** - * Gets or Sets status - */ - public enum StatusEnum { - PENDING("PENDING"), - - REJECTED("REJECTED"), - - DELIVERED("DELIVERED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static StatusEnum fromValue(String text) { - for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - } - - @JsonProperty("status") - private StatusEnum status = null; - - @JsonProperty("startDate") - private LocalDate startDate = null; - - @JsonProperty("endDate") - private LocalDate endDate = null; - - @JsonProperty("startBalance") - private StartBalance startBalance = null; - - @JsonProperty("endBalance") - private EndBalance endBalance = null; - - @JsonProperty("statementLines") - private StatementLines statementLines = null; - - @JsonProperty("errors") - private List errors = null; - - @JsonProperty("statementLineCount") - private Integer statementLineCount = null; - - public Statement id(String id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - **/ - @ApiModelProperty(example = "ba4f3127-5e46-427d-80ea-dea2fcd26afe", required = true, value = "") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Statement feedConnectionId(String feedConnectionId) { - this.feedConnectionId = feedConnectionId; - return this; - } - - /** - * Get feedConnectionId - * @return feedConnectionId - **/ - @ApiModelProperty(example = "87cb0dc8-fa32-409c-b622-19f8de8dcc83", value = "") - public String getFeedConnectionId() { - return feedConnectionId; - } - - public void setFeedConnectionId(String feedConnectionId) { - this.feedConnectionId = feedConnectionId; - } - - public Statement status(StatusEnum status) { - this.status = status; - return this; - } - - /** - * Get status - * @return status - **/ - @ApiModelProperty(example = "PENDING", value = "") - public StatusEnum getStatus() { - return status; - } - - public void setStatus(StatusEnum status) { - this.status = status; - } - - public Statement startDate(LocalDate startDate) { - this.startDate = startDate; - return this; - } - - /** - * Get startDate - * @return startDate - **/ - @ApiModelProperty(value = "") - public LocalDate getStartDate() { - return startDate; - } - - public void setStartDate(LocalDate startDate) { - this.startDate = startDate; - } - - public Statement endDate(LocalDate endDate) { - this.endDate = endDate; - return this; - } - - /** - * Get endDate - * @return endDate - **/ - @ApiModelProperty(value = "") - public LocalDate getEndDate() { - return endDate; - } - - public void setEndDate(LocalDate endDate) { - this.endDate = endDate; - } - - public Statement startBalance(StartBalance startBalance) { - this.startBalance = startBalance; - return this; - } - - /** - * Get startBalance - * @return startBalance - **/ - @ApiModelProperty(value = "") - public StartBalance getStartBalance() { - return startBalance; - } - - public void setStartBalance(StartBalance startBalance) { - this.startBalance = startBalance; - } - - public Statement endBalance(EndBalance endBalance) { - this.endBalance = endBalance; - return this; - } - - /** - * Get endBalance - * @return endBalance - **/ - @ApiModelProperty(value = "") - public EndBalance getEndBalance() { - return endBalance; - } - - public void setEndBalance(EndBalance endBalance) { - this.endBalance = endBalance; - } - - public Statement statementLines(StatementLines statementLines) { - this.statementLines = statementLines; - return this; - } - - /** - * Get statementLines - * @return statementLines - **/ - @ApiModelProperty(value = "") - public StatementLines getStatementLines() { - return statementLines; - } - - public void setStatementLines(StatementLines statementLines) { - this.statementLines = statementLines; - } - - public Statement errors(List errors) { - this.errors = errors; - return this; - } - - public Statement addErrorsItem(Error errorsItem) { - if (this.errors == null) { - this.errors = new ArrayList(); - } - this.errors.add(errorsItem); - return this; - } - - /** - * Get errors - * @return errors - **/ - @ApiModelProperty(value = "") - public List getErrors() { - return errors; - } - - public void setErrors(List errors) { - this.errors = errors; - } - - public Statement statementLineCount(Integer statementLineCount) { - this.statementLineCount = statementLineCount; - return this; - } - - /** - * Get statementLineCount - * @return statementLineCount - **/ - @ApiModelProperty(example = "1", value = "") - public Integer getStatementLineCount() { - return statementLineCount; - } - - public void setStatementLineCount(Integer statementLineCount) { - this.statementLineCount = statementLineCount; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Statement statement = (Statement) o; - return Objects.equals(this.id, statement.id) && - Objects.equals(this.feedConnectionId, statement.feedConnectionId) && - Objects.equals(this.status, statement.status) && - Objects.equals(this.startDate, statement.startDate) && - Objects.equals(this.endDate, statement.endDate) && - Objects.equals(this.startBalance, statement.startBalance) && - Objects.equals(this.endBalance, statement.endBalance) && - Objects.equals(this.statementLines, statement.statementLines) && - Objects.equals(this.errors, statement.errors) && - Objects.equals(this.statementLineCount, statement.statementLineCount); - } - - @Override - public int hashCode() { - return Objects.hash(id, feedConnectionId, status, startDate, endDate, startBalance, endBalance, statementLines, errors, statementLineCount); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Statement {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" feedConnectionId: ").append(toIndentedString(feedConnectionId)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); - sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); - sb.append(" startBalance: ").append(toIndentedString(startBalance)).append("\n"); - sb.append(" endBalance: ").append(toIndentedString(endBalance)).append("\n"); - sb.append(" statementLines: ").append(toIndentedString(statementLines)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); - sb.append(" statementLineCount: ").append(toIndentedString(statementLineCount)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/bankfeeds/StatementLine.java b/src/main/java/com/xero/models/bankfeeds/StatementLine.java deleted file mode 100644 index f16d7eec..00000000 --- a/src/main/java/com/xero/models/bankfeeds/StatementLine.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.bankfeeds.CreditDebitIndicator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.threeten.bp.LocalDate; - -/** - * StatementLine - */ - -public class StatementLine { - @JsonProperty("postedDate") - private LocalDate postedDate = null; - - @JsonProperty("description") - private String description = null; - - @JsonProperty("amount") - private String amount = null; - - @JsonProperty("creditDebitIndicator") - private CreditDebitIndicator creditDebitIndicator = null; - - @JsonProperty("transactionId") - private String transactionId = null; - - @JsonProperty("payeeName") - private String payeeName = null; - - @JsonProperty("reference") - private String reference = null; - - @JsonProperty("chequeNumber") - private String chequeNumber = null; - - public StatementLine postedDate(LocalDate postedDate) { - this.postedDate = postedDate; - return this; - } - - /** - * Get postedDate - * @return postedDate - **/ - @ApiModelProperty(value = "") - public LocalDate getPostedDate() { - return postedDate; - } - - public void setPostedDate(LocalDate postedDate) { - this.postedDate = postedDate; - } - - public StatementLine description(String description) { - this.description = description; - return this; - } - - /** - * Get description - * @return description - **/ - @ApiModelProperty(example = "Description for statement line 2", value = "") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public StatementLine amount(String amount) { - this.amount = amount; - return this; - } - - /** - * Get amount - * @return amount - **/ - @ApiModelProperty(example = "5.00", value = "") - public String getAmount() { - return amount; - } - - public void setAmount(String amount) { - this.amount = amount; - } - - public StatementLine creditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { - this.creditDebitIndicator = creditDebitIndicator; - return this; - } - - /** - * Get creditDebitIndicator - * @return creditDebitIndicator - **/ - @ApiModelProperty(value = "") - public CreditDebitIndicator getCreditDebitIndicator() { - return creditDebitIndicator; - } - - public void setCreditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { - this.creditDebitIndicator = creditDebitIndicator; - } - - public StatementLine transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Get transactionId - * @return transactionId - **/ - @ApiModelProperty(example = "transaction-id-2", value = "") - public String getTransactionId() { - return transactionId; - } - - public void setTransactionId(String transactionId) { - this.transactionId = transactionId; - } - - public StatementLine payeeName(String payeeName) { - this.payeeName = payeeName; - return this; - } - - /** - * Get payeeName - * @return payeeName - **/ - @ApiModelProperty(example = "Payee name for statement line 2", value = "") - public String getPayeeName() { - return payeeName; - } - - public void setPayeeName(String payeeName) { - this.payeeName = payeeName; - } - - public StatementLine reference(String reference) { - this.reference = reference; - return this; - } - - /** - * Get reference - * @return reference - **/ - @ApiModelProperty(example = "Reference for statement line 2", value = "") - public String getReference() { - return reference; - } - - public void setReference(String reference) { - this.reference = reference; - } - - public StatementLine chequeNumber(String chequeNumber) { - this.chequeNumber = chequeNumber; - return this; - } - - /** - * Get chequeNumber - * @return chequeNumber - **/ - @ApiModelProperty(example = "021", value = "") - public String getChequeNumber() { - return chequeNumber; - } - - public void setChequeNumber(String chequeNumber) { - this.chequeNumber = chequeNumber; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - StatementLine statementLine = (StatementLine) o; - return Objects.equals(this.postedDate, statementLine.postedDate) && - Objects.equals(this.description, statementLine.description) && - Objects.equals(this.amount, statementLine.amount) && - Objects.equals(this.creditDebitIndicator, statementLine.creditDebitIndicator) && - Objects.equals(this.transactionId, statementLine.transactionId) && - Objects.equals(this.payeeName, statementLine.payeeName) && - Objects.equals(this.reference, statementLine.reference) && - Objects.equals(this.chequeNumber, statementLine.chequeNumber); - } - - @Override - public int hashCode() { - return Objects.hash(postedDate, description, amount, creditDebitIndicator, transactionId, payeeName, reference, chequeNumber); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class StatementLine {\n"); - - sb.append(" postedDate: ").append(toIndentedString(postedDate)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); - sb.append(" creditDebitIndicator: ").append(toIndentedString(creditDebitIndicator)).append("\n"); - sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\n"); - sb.append(" payeeName: ").append(toIndentedString(payeeName)).append("\n"); - sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); - sb.append(" chequeNumber: ").append(toIndentedString(chequeNumber)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/bankfeeds/StatementLines.java b/src/main/java/com/xero/models/bankfeeds/StatementLines.java deleted file mode 100644 index bb1994df..00000000 --- a/src/main/java/com/xero/models/bankfeeds/StatementLines.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; -import com.xero.models.bankfeeds.StatementLine; -import java.util.ArrayList; -import java.util.List; - -/** - * StatementLines - */ - -public class StatementLines extends ArrayList { - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - return super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode()); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class StatementLines {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/bankfeeds/Statements.java b/src/main/java/com/xero/models/bankfeeds/Statements.java deleted file mode 100644 index 6ac1334e..00000000 --- a/src/main/java/com/xero/models/bankfeeds/Statements.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.bankfeeds.Pagination; -import com.xero.models.bankfeeds.Statement; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; - -/** - * Statements - */ - -public class Statements { - @JsonProperty("pagination") - private Pagination pagination = null; - - @JsonProperty("items") - private List items = null; - - public Statements pagination(Pagination pagination) { - this.pagination = pagination; - return this; - } - - /** - * Get pagination - * @return pagination - **/ - @ApiModelProperty(value = "") - public Pagination getPagination() { - return pagination; - } - - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } - - public Statements items(List items) { - this.items = items; - return this; - } - - public Statements addItemsItem(Statement itemsItem) { - if (this.items == null) { - this.items = new ArrayList(); - } - this.items.add(itemsItem); - return this; - } - - /** - * Get items - * @return items - **/ - @ApiModelProperty(value = "") - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Statements statements = (Statements) o; - return Objects.equals(this.pagination, statements.pagination) && - Objects.equals(this.items, statements.items); - } - - @Override - public int hashCode() { - return Objects.hash(pagination, items); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Statements {\n"); - - sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); - sb.append(" items: ").append(toIndentedString(items)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/files/Association.java b/src/main/java/com/xero/models/files/Association.java deleted file mode 100644 index 96122e63..00000000 --- a/src/main/java/com/xero/models/files/Association.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Xero Files API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.files; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.files.ObjectGroup; -import com.xero.models.files.ObjectType; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.UUID; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * Association - */ - -public class Association { - - @JsonProperty("FileId") - private UUID fileId = null; - - - @JsonProperty("ObjectId") - private UUID objectId = null; - - - @JsonProperty("ObjectGroup") - private ObjectGroup objectGroup = null; - - - @JsonProperty("ObjectType") - private ObjectType objectType = null; - - public Association fileId(UUID fileId) { - this.fileId = fileId; - return this; - } - - /** - * The unique identifier of the file - * @return fileId - **/ - @ApiModelProperty(value = "The unique identifier of the file") - public UUID getFileId() { - return fileId; - } - - public void setFileId(UUID fileId) { - this.fileId = fileId; - } - - public Association objectId(UUID objectId) { - this.objectId = objectId; - return this; - } - - /** - * The identifier of the object that the file is being associated with (e.g. InvoiceID, BankTransactionID, ContactID) - * @return objectId - **/ - @ApiModelProperty(value = "The identifier of the object that the file is being associated with (e.g. InvoiceID, BankTransactionID, ContactID)") - public UUID getObjectId() { - return objectId; - } - - public void setObjectId(UUID objectId) { - this.objectId = objectId; - } - - public Association objectGroup(ObjectGroup objectGroup) { - this.objectGroup = objectGroup; - return this; - } - - /** - * Get objectGroup - * @return objectGroup - **/ - @ApiModelProperty(value = "") - public ObjectGroup getObjectGroup() { - return objectGroup; - } - - public void setObjectGroup(ObjectGroup objectGroup) { - this.objectGroup = objectGroup; - } - - public Association objectType(ObjectType objectType) { - this.objectType = objectType; - return this; - } - - /** - * Get objectType - * @return objectType - **/ - @ApiModelProperty(value = "") - public ObjectType getObjectType() { - return objectType; - } - - public void setObjectType(ObjectType objectType) { - this.objectType = objectType; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Association association = (Association) o; - return Objects.equals(this.fileId, association.fileId) && - Objects.equals(this.objectId, association.objectId) && - Objects.equals(this.objectGroup, association.objectGroup) && - Objects.equals(this.objectType, association.objectType); - } - - @Override - public int hashCode() { - return Objects.hash(fileId, objectId, objectGroup, objectType); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Association {\n"); - - sb.append(" fileId: ").append(toIndentedString(fileId)).append("\n"); - sb.append(" objectId: ").append(toIndentedString(objectId)).append("\n"); - sb.append(" objectGroup: ").append(toIndentedString(objectGroup)).append("\n"); - sb.append(" objectType: ").append(toIndentedString(objectType)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/files/FileObject.java b/src/main/java/com/xero/models/files/FileObject.java deleted file mode 100644 index a23175ff..00000000 --- a/src/main/java/com/xero/models/files/FileObject.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Xero Files API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.files; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.files.User; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.UUID; -import org.threeten.bp.OffsetDateTime; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * FileObject - */ - -public class FileObject { - - @JsonProperty("Name") - private String name = null; - - - @JsonProperty("MimeType") - private String mimeType = null; - - - @JsonProperty("Size") - private Integer size = null; - - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) - @JsonProperty("CreatedDateUTC") - private OffsetDateTime createdDateUTC = null; - - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) - @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC = null; - - - @JsonProperty("User") - private User user = null; - - - @JsonProperty("Id") - private UUID id = null; - - - @JsonProperty("FolderId") - private UUID folderId = null; - - public FileObject name(String name) { - this.name = name; - return this; - } - - /** - * TODO - * @return name - **/ - @ApiModelProperty(example = "File2.jpg", value = "TODO") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public FileObject mimeType(String mimeType) { - this.mimeType = mimeType; - return this; - } - - /** - * TODO - * @return mimeType - **/ - @ApiModelProperty(example = "image/jpeg", value = "TODO") - public String getMimeType() { - return mimeType; - } - - public void setMimeType(String mimeType) { - this.mimeType = mimeType; - } - - public FileObject size(Integer size) { - this.size = size; - return this; - } - - /** - * TODO - * @return size - **/ - @ApiModelProperty(example = "3615", value = "TODO") - public Integer getSize() { - return size; - } - - public void setSize(Integer size) { - this.size = size; - } - - public FileObject createdDateUTC(OffsetDateTime createdDateUTC) { - this.createdDateUTC = createdDateUTC; - return this; - } - - /** - * TODO - * @return createdDateUTC - **/ - @ApiModelProperty(value = "TODO") - public OffsetDateTime getCreatedDateUTC() { - return createdDateUTC; - } - - public void setCreatedDateUTC(OffsetDateTime createdDateUTC) { - this.createdDateUTC = createdDateUTC; - } - - public FileObject updatedDateUTC(OffsetDateTime updatedDateUTC) { - this.updatedDateUTC = updatedDateUTC; - return this; - } - - /** - * TODO - * @return updatedDateUTC - **/ - @ApiModelProperty(value = "TODO") - public OffsetDateTime getUpdatedDateUTC() { - return updatedDateUTC; - } - - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { - this.updatedDateUTC = updatedDateUTC; - } - - public FileObject user(User user) { - this.user = user; - return this; - } - - /** - * Get user - * @return user - **/ - @ApiModelProperty(value = "") - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - public FileObject id(UUID id) { - this.id = id; - return this; - } - - /** - * TODO - * @return id - **/ - @ApiModelProperty(example = "d290f1ee-6c54-4b01-90e6-d701748f0851", value = "TODO") - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } - - public FileObject folderId(UUID folderId) { - this.folderId = folderId; - return this; - } - - /** - * TODO - * @return folderId - **/ - @ApiModelProperty(example = "0f8ccf21-7267-4268-9167-a1e2c40c84c8", value = "TODO") - public UUID getFolderId() { - return folderId; - } - - public void setFolderId(UUID folderId) { - this.folderId = folderId; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - FileObject fileObject = (FileObject) o; - return Objects.equals(this.name, fileObject.name) && - Objects.equals(this.mimeType, fileObject.mimeType) && - Objects.equals(this.size, fileObject.size) && - Objects.equals(this.createdDateUTC, fileObject.createdDateUTC) && - Objects.equals(this.updatedDateUTC, fileObject.updatedDateUTC) && - Objects.equals(this.user, fileObject.user) && - Objects.equals(this.id, fileObject.id) && - Objects.equals(this.folderId, fileObject.folderId); - } - - @Override - public int hashCode() { - return Objects.hash(name, mimeType, size, createdDateUTC, updatedDateUTC, user, id, folderId); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FileObject {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); - sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" createdDateUTC: ").append(toIndentedString(createdDateUTC)).append("\n"); - sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); - sb.append(" user: ").append(toIndentedString(user)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" folderId: ").append(toIndentedString(folderId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/files/FileResponse204.java b/src/main/java/com/xero/models/files/FileResponse204.java deleted file mode 100644 index 15be3400..00000000 --- a/src/main/java/com/xero/models/files/FileResponse204.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Xero Files API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.files; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * FileResponse204 - */ - -public class FileResponse204 { - - @JsonProperty("Status") - private String status = null; - - public FileResponse204 status(String status) { - this.status = status; - return this; - } - - /** - * Status response for 204 no content - * @return status - **/ - @ApiModelProperty(value = "Status response for 204 no content") - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - FileResponse204 fileResponse204 = (FileResponse204) o; - return Objects.equals(this.status, fileResponse204.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FileResponse204 {\n"); - - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/files/Files.java b/src/main/java/com/xero/models/files/Files.java deleted file mode 100644 index 6a67b11e..00000000 --- a/src/main/java/com/xero/models/files/Files.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Xero Files API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.files; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.files.FileObject; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * Files - */ - -public class Files { - - @JsonProperty("TotalCount") - private Integer totalCount = null; - - - @JsonProperty("Page") - private Integer page = null; - - - @JsonProperty("PerPage") - private Integer perPage = null; - - - @JsonProperty("Items") - private List items = null; - - public Files totalCount(Integer totalCount) { - this.totalCount = totalCount; - return this; - } - - /** - * Get totalCount - * @return totalCount - **/ - @ApiModelProperty(example = "2", value = "") - public Integer getTotalCount() { - return totalCount; - } - - public void setTotalCount(Integer totalCount) { - this.totalCount = totalCount; - } - - public Files page(Integer page) { - this.page = page; - return this; - } - - /** - * Get page - * @return page - **/ - @ApiModelProperty(example = "1", value = "") - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public Files perPage(Integer perPage) { - this.perPage = perPage; - return this; - } - - /** - * Get perPage - * @return perPage - **/ - @ApiModelProperty(example = "50", value = "") - public Integer getPerPage() { - return perPage; - } - - public void setPerPage(Integer perPage) { - this.perPage = perPage; - } - - public Files items(List items) { - this.items = items; - return this; - } - - public Files addItemsItem(FileObject itemsItem) { - if (this.items == null) { - this.items = new ArrayList(); - } - this.items.add(itemsItem); - return this; - } - - /** - * Get items - * @return items - **/ - @ApiModelProperty(value = "") - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Files files = (Files) o; - return Objects.equals(this.totalCount, files.totalCount) && - Objects.equals(this.page, files.page) && - Objects.equals(this.perPage, files.perPage) && - Objects.equals(this.items, files.items); - } - - @Override - public int hashCode() { - return Objects.hash(totalCount, page, perPage, items); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Files {\n"); - - sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" perPage: ").append(toIndentedString(perPage)).append("\n"); - sb.append(" items: ").append(toIndentedString(items)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/files/Folder.java b/src/main/java/com/xero/models/files/Folder.java deleted file mode 100644 index 534ca115..00000000 --- a/src/main/java/com/xero/models/files/Folder.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Xero Files API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.files; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.UUID; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * Folder - */ - -public class Folder { - - @JsonProperty("Name") - private String name = null; - - - @JsonProperty("FileCount") - private Integer fileCount = null; - - - @JsonProperty("Email") - private String email = null; - - - @JsonProperty("IsInbox") - private Boolean isInbox = null; - - - @JsonProperty("Id") - private UUID id = null; - - public Folder name(String name) { - this.name = name; - return this; - } - - /** - * The name of the folder - * @return name - **/ - @ApiModelProperty(example = "assets", value = "The name of the folder") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Folder fileCount(Integer fileCount) { - this.fileCount = fileCount; - return this; - } - - /** - * The number of files in the folder - * @return fileCount - **/ - @ApiModelProperty(example = "5", value = "The number of files in the folder") - public Integer getFileCount() { - return fileCount; - } - - public void setFileCount(Integer fileCount) { - this.fileCount = fileCount; - } - - public Folder email(String email) { - this.email = email; - return this; - } - - /** - * The email address used to email files to the inbox. Only the inbox will have this element. - * @return email - **/ - @ApiModelProperty(example = "foo@bar.com", value = "The email address used to email files to the inbox. Only the inbox will have this element.") - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public Folder isInbox(Boolean isInbox) { - this.isInbox = isInbox; - return this; - } - - /** - * to indicate if the folder is the Inbox. The Inbox cannot be renamed or deleted. - * @return isInbox - **/ - @ApiModelProperty(value = "to indicate if the folder is the Inbox. The Inbox cannot be renamed or deleted.") - public Boolean getIsInbox() { - return isInbox; - } - - public void setIsInbox(Boolean isInbox) { - this.isInbox = isInbox; - } - - public Folder id(UUID id) { - this.id = id; - return this; - } - - /** - * Xero unique identifier for a folder Files - * @return id - **/ - @ApiModelProperty(example = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c", value = "Xero unique identifier for a folder Files") - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Folder folder = (Folder) o; - return Objects.equals(this.name, folder.name) && - Objects.equals(this.fileCount, folder.fileCount) && - Objects.equals(this.email, folder.email) && - Objects.equals(this.isInbox, folder.isInbox) && - Objects.equals(this.id, folder.id); - } - - @Override - public int hashCode() { - return Objects.hash(name, fileCount, email, isInbox, id); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Folder {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" fileCount: ").append(toIndentedString(fileCount)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" isInbox: ").append(toIndentedString(isInbox)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/files/Folders.java b/src/main/java/com/xero/models/files/Folders.java deleted file mode 100644 index 8b38f072..00000000 --- a/src/main/java/com/xero/models/files/Folders.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Xero Files API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.files; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.files.Folder; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * Folders - */ - -public class Folders { - - @JsonProperty("Folders") - private List folders = null; - - public Folders folders(List folders) { - this.folders = folders; - return this; - } - - public Folders addFoldersItem(Folder foldersItem) { - if (this.folders == null) { - this.folders = new ArrayList(); - } - this.folders.add(foldersItem); - return this; - } - - /** - * Get folders - * @return folders - **/ - @ApiModelProperty(value = "") - public List getFolders() { - return folders; - } - - public void setFolders(List folders) { - this.folders = folders; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Folders folders = (Folders) o; - return Objects.equals(this.folders, folders.folders); - } - - @Override - public int hashCode() { - return Objects.hash(folders); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Folders {\n"); - - sb.append(" folders: ").append(toIndentedString(folders)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/files/ObjectGroup.java b/src/main/java/com/xero/models/files/ObjectGroup.java deleted file mode 100644 index 933b8f71..00000000 --- a/src/main/java/com/xero/models/files/ObjectGroup.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Xero Files API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.files; - -import java.util.Objects; -import java.util.Arrays; -import io.swagger.annotations.ApiModel; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * The Object Group that the object is in. These roughly correlate to the endpoints that can be used to retrieve the object via the core accounting API. - */ -public enum ObjectGroup { - - ACCOUNT("Account"), - - BANKTRANSACTION("BankTransaction"), - - CONTACT("Contact"), - - CREDITNOTE("CreditNote"), - - INVOICE("Invoice"), - - ITEM("Item"), - - MANUALJOURNAL("ManualJournal"), - - OVERPAYMENT("Overpayment"), - - PAYMENT("Payment"), - - PREPAYMENT("Prepayment"), - - RECEIPT("Receipt"); - - private String value; - - ObjectGroup(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static ObjectGroup fromValue(String text) { - for (ObjectGroup b : ObjectGroup.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); - } -} - diff --git a/src/main/java/com/xero/models/files/ObjectType.java b/src/main/java/com/xero/models/files/ObjectType.java deleted file mode 100644 index e0901616..00000000 --- a/src/main/java/com/xero/models/files/ObjectType.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Xero Files API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.files; - -import java.util.Objects; -import java.util.Arrays; -import io.swagger.annotations.ApiModel; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * The Object Type - */ -public enum ObjectType { - - ACCOUNT("ACCOUNT"), - - ACCPAY("ACCPAY"), - - ACCPAYCREDIT("ACCPAYCREDIT"), - - ACCPAYPAYMENT("ACCPAYPAYMENT"), - - ACCREC("ACCREC"), - - ACCRECCREDIT("ACCRECCREDIT"), - - ACCRECPAYMENT("ACCRECPAYMENT"), - - ADJUSTMENT("ADJUSTMENT"), - - APCREDITPAYMENT("APCREDITPAYMENT"), - - APOVERPAYMENT("APOVERPAYMENT"), - - APOVERPAYMENTPAYMENT("APOVERPAYMENTPAYMENT"), - - APOVERPAYMENTSOURCEPAYMENT("APOVERPAYMENTSOURCEPAYMENT"), - - APPREPAYMENT("APPREPAYMENT"), - - APPREPAYMENTPAYMENT("APPREPAYMENTPAYMENT"), - - APPREPAYMENTSOURCEPAYMENT("APPREPAYMENTSOURCEPAYMENT"), - - ARCREDITPAYMENT("ARCREDITPAYMENT"), - - AROVERPAYMENT("AROVERPAYMENT"), - - AROVERPAYMENTPAYMENT("AROVERPAYMENTPAYMENT"), - - AROVERPAYMENTSOURCEPAYMENT("AROVERPAYMENTSOURCEPAYMENT"), - - ARPREPAYMENT("ARPREPAYMENT"), - - ARPREPAYMENTPAYMENT("ARPREPAYMENTPAYMENT"), - - ARPREPAYMENTSOURCEPAYMENT("ARPREPAYMENTSOURCEPAYMENT"), - - CASHPAID("CASHPAID"), - - CASHREC("CASHREC"), - - CONTACT("CONTACT"), - - EXPPAYMENT("EXPPAYMENT"), - - FIXEDASSET("FIXEDASSET"), - - MANUALJOURNAL("MANUALJOURNAL"), - - PAYRUN("PAYRUN"), - - PRICELISTITEM("PRICELISTITEM"), - - PURCHASEORDER("PURCHASEORDER"), - - RECEIPT("RECEIPT"), - - TRANSFER("TRANSFER"); - - private String value; - - ObjectType(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static ObjectType fromValue(String text) { - for (ObjectType b : ObjectType.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); - } -} - diff --git a/src/main/java/com/xero/models/files/User.java b/src/main/java/com/xero/models/files/User.java deleted file mode 100644 index 9d92370d..00000000 --- a/src/main/java/com/xero/models/files/User.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Xero Files API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * OpenAPI spec version: 1.0.0 - * Contact: api@xero.com - * - * 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.models.files; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.UUID; -import org.threeten.bp.OffsetDateTime; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * User - */ - -public class User { - - @JsonProperty("UserID") - private UUID userID = null; - - - @JsonProperty("EmailAddress") - private String emailAddress = null; - - - @JsonProperty("FirstName") - private String firstName = null; - - - @JsonProperty("LastName") - private String lastName = null; - - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) - @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC = null; - - - @JsonProperty("IsSubscriber") - private Boolean isSubscriber = null; - - /** - * Boolean to indicate if user is the subscriber - */ - public enum OrganisationRoleEnum { - READONLY("READONLY"), - - INVOICEONLY("INVOICEONLY"), - - STANDARD("STANDARD"), - - FINANCIALADVISER("FINANCIALADVISER"), - - MANAGEDCLIENT("MANAGEDCLIENT"), - - CASHBOOKCLIENT("CASHBOOKCLIENT"); - - private String value; - - OrganisationRoleEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static OrganisationRoleEnum fromValue(String text) { - for (OrganisationRoleEnum b : OrganisationRoleEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + text + "'"); - } - } - - - @JsonProperty("OrganisationRole") - private OrganisationRoleEnum organisationRole = null; - - public User userID(UUID userID) { - this.userID = userID; - return this; - } - - /** - * Xero identifier - * @return userID - **/ - @ApiModelProperty(example = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c", value = "Xero identifier") - public UUID getUserID() { - return userID; - } - - public void setUserID(UUID userID) { - this.userID = userID; - } - - public User emailAddress(String emailAddress) { - this.emailAddress = emailAddress; - return this; - } - - /** - * Email address of user - * @return emailAddress - **/ - @ApiModelProperty(example = "john.smith@mail.com", value = "Email address of user") - public String getEmailAddress() { - return emailAddress; - } - - public void setEmailAddress(String emailAddress) { - this.emailAddress = emailAddress; - } - - public User firstName(String firstName) { - this.firstName = firstName; - return this; - } - - /** - * First name of user - * @return firstName - **/ - @ApiModelProperty(example = "John", required = true, value = "First name of user") - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public User lastName(String lastName) { - this.lastName = lastName; - return this; - } - - /** - * Last name of user - * @return lastName - **/ - @ApiModelProperty(example = "Smith", required = true, value = "Last name of user") - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public User updatedDateUTC(OffsetDateTime updatedDateUTC) { - this.updatedDateUTC = updatedDateUTC; - return this; - } - - /** - * Last name of user - * @return updatedDateUTC - **/ - @ApiModelProperty(value = "Last name of user") - public OffsetDateTime getUpdatedDateUTC() { - return updatedDateUTC; - } - - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { - this.updatedDateUTC = updatedDateUTC; - } - - public User isSubscriber(Boolean isSubscriber) { - this.isSubscriber = isSubscriber; - return this; - } - - /** - * Boolean to indicate if user is the subscriber - * @return isSubscriber - **/ - @ApiModelProperty(value = "Boolean to indicate if user is the subscriber") - public Boolean getIsSubscriber() { - return isSubscriber; - } - - public void setIsSubscriber(Boolean isSubscriber) { - this.isSubscriber = isSubscriber; - } - - public User organisationRole(OrganisationRoleEnum organisationRole) { - this.organisationRole = organisationRole; - return this; - } - - /** - * Boolean to indicate if user is the subscriber - * @return organisationRole - **/ - @ApiModelProperty(example = "STANDARD", value = "Boolean to indicate if user is the subscriber") - public OrganisationRoleEnum getOrganisationRole() { - return organisationRole; - } - - public void setOrganisationRole(OrganisationRoleEnum organisationRole) { - this.organisationRole = organisationRole; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - User user = (User) o; - return Objects.equals(this.userID, user.userID) && - Objects.equals(this.emailAddress, user.emailAddress) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.updatedDateUTC, user.updatedDateUTC) && - Objects.equals(this.isSubscriber, user.isSubscriber) && - Objects.equals(this.organisationRole, user.organisationRole); - } - - @Override - public int hashCode() { - return Objects.hash(userID, emailAddress, firstName, lastName, updatedDateUTC, isSubscriber, organisationRole); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class User {\n"); - - sb.append(" userID: ").append(toIndentedString(userID)).append("\n"); - sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n"); - sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); - sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); - sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); - sb.append(" isSubscriber: ").append(toIndentedString(isSubscriber)).append("\n"); - sb.append(" organisationRole: ").append(toIndentedString(organisationRole)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - From 5202726a113a0ca2ed601bbee1f591c537f96bfb Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Mon, 10 Jun 2019 10:33:51 -0700 Subject: [PATCH 04/76] fix missing import --- src/main/java/com/xero/api/ApiClient.java | 3 ++- src/main/java/com/xero/api/client/AccountingApi.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/xero/api/ApiClient.java b/src/main/java/com/xero/api/ApiClient.java index fb9eca0f..f8bbadca 100644 --- a/src/main/java/com/xero/api/ApiClient.java +++ b/src/main/java/com/xero/api/ApiClient.java @@ -49,7 +49,8 @@ public ApiClient( String basePath, HttpTransport httpTransport, HttpRequestInitializer initializer, - ObjectMapper objectMapper + ObjectMapper objectMapper, + HttpRequestFactory reqFactory ) { this.basePath = basePath == null ? defaultBasePath : ( basePath.endsWith("/") ? basePath.substring(0, basePath.length() - 1) : basePath diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index 5f81c93b..1818fa5f 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -57,6 +57,7 @@ import com.google.api.client.http.InputStreamContent; import com.google.api.client.http.HttpMethods; import com.google.api.client.http.HttpResponse; +import com.google.api.client.http.HttpHeaders; import com.google.api.client.json.Json; import javax.ws.rs.core.UriBuilder; From 5df83e3992d14717528237239ff9cd2a1ff6d060 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 11 Jun 2019 09:19:27 -0700 Subject: [PATCH 05/76] Maven badges --- README.md | 4 + .../com/xero/api/client/AccountingApi.java | 905 +++++++++++++----- 2 files changed, 644 insertions(+), 265 deletions(-) diff --git a/README.md b/README.md index cc321d3b..26c16cb8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # Xero-Java +[![Maven Central](https://img.shields.io/maven-central/v/com.github.xeroapi/xero-java.svg?label=Maven%20Central)](https://search.maven.org/artifact/com.github.xeroapi/xero-java/2.3.8/jar) + + [![Maven Central](https://img.shields.io/maven-central/v/com.github.xeroapi/xero-java.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.xeroapi%22%20AND%20a:%22xero-java%22) + This is the official Java SDK for Xero's API. It supports accounting, fixed asset and bank feed API endpoints. All third party libraries dependencies managed with Maven. diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index 1818fa5f..da397baf 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -153,7 +153,7 @@ public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account ac headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createAccountForHttpResponse(String xeroTenantId, java.io.InputStream account, String mediaType) throws IOException { @@ -172,7 +172,12 @@ public HttpResponse createAccountForHttpResponse(String xeroTenantId, java.io.In HttpContent content = account == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, account); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account account, Map params) throws IOException { @@ -275,7 +280,7 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xero headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -304,7 +309,12 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { @@ -415,7 +425,7 @@ public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, Ba headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, java.io.InputStream bankTransactions, Boolean summarizeErrors, String mediaType) throws IOException { @@ -445,7 +455,12 @@ public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, ja HttpContent content = bankTransactions == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, BankTransactions bankTransactions, Map params) throws IOException { @@ -548,7 +563,7 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -577,7 +592,12 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { @@ -684,7 +704,7 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xer headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -709,7 +729,12 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xer HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords, Map params) throws IOException { @@ -804,7 +829,7 @@ public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankT headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, java.io.InputStream bankTransfers, String mediaType) throws IOException { @@ -823,7 +848,12 @@ public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, java. HttpContent content = bankTransfers == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransfers); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankTransfers bankTransfers, Map params) throws IOException { @@ -924,7 +954,7 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -953,7 +983,12 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { @@ -1058,7 +1093,7 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTe headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -1083,7 +1118,12 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTe HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords, Map params) throws IOException { @@ -1178,7 +1218,7 @@ public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, Batch headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, java.io.InputStream batchPayments, String mediaType) throws IOException { @@ -1197,7 +1237,12 @@ public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, java. HttpContent content = batchPayments == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, batchPayments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, BatchPayments batchPayments, Map params) throws IOException { @@ -1294,7 +1339,7 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTe headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -1319,7 +1364,12 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTe HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords, Map params) throws IOException { @@ -1422,7 +1472,7 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xer headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, java.io.InputStream paymentService, String mediaType) throws IOException { @@ -1447,7 +1497,12 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xer HttpContent content = paymentService == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentService); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService, Map params) throws IOException { @@ -1540,7 +1595,7 @@ public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact co headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createContactForHttpResponse(String xeroTenantId, java.io.InputStream contact, String mediaType) throws IOException { @@ -1559,7 +1614,12 @@ public HttpResponse createContactForHttpResponse(String xeroTenantId, java.io.In HttpContent content = contact == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contact); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact contact, Map params) throws IOException { @@ -1660,7 +1720,7 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xero headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -1689,7 +1749,12 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { @@ -1788,7 +1853,7 @@ public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, Conta headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, java.io.InputStream contactGroups, String mediaType) throws IOException { @@ -1807,7 +1872,12 @@ public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, java. HttpContent content = contactGroups == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, ContactGroups contactGroups, Map params) throws IOException { @@ -1904,7 +1974,7 @@ public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, java.io.InputStream contacts, String mediaType) throws IOException { @@ -1929,7 +1999,12 @@ public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantI HttpContent content = contacts == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Contacts contacts, Map params) throws IOException { @@ -2032,7 +2107,7 @@ public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -2057,7 +2132,12 @@ public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUI HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, HistoryRecords historyRecords, Map params) throws IOException { @@ -2164,7 +2244,7 @@ public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditN headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, java.io.InputStream creditNotes, Boolean summarizeErrors, String mediaType) throws IOException { @@ -2194,7 +2274,12 @@ public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, java.io HttpContent content = creditNotes == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditNotes creditNotes, Map params) throws IOException { @@ -2291,7 +2376,7 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream allocations, String mediaType) throws IOException { @@ -2316,7 +2401,12 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantI HttpContent content = allocations == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, Allocations allocations, Map params) throws IOException { @@ -2425,7 +2515,7 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String x headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -2454,7 +2544,12 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String x HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { @@ -2561,7 +2656,7 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -2586,7 +2681,12 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords, Map params) throws IOException { @@ -2677,7 +2777,7 @@ public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencie headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, java.io.InputStream currencies, String mediaType) throws IOException { @@ -2696,7 +2796,12 @@ public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, java.io.I HttpContent content = currencies == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, currencies); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencies currencies, Map params) throws IOException { @@ -2785,7 +2890,7 @@ public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, java.io.InputStream employees, String mediaType) throws IOException { @@ -2804,7 +2909,12 @@ public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, java.io.I HttpContent content = employees == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees employees, Map params) throws IOException { @@ -2905,7 +3015,7 @@ public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, Expen headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, java.io.InputStream expenseClaims, Boolean summarizeErrors, String mediaType) throws IOException { @@ -2935,7 +3045,12 @@ public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, java. HttpContent content = expenseClaims == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, ExpenseClaims expenseClaims, Map params) throws IOException { @@ -3030,7 +3145,7 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -3055,7 +3170,12 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords, Map params) throws IOException { @@ -3162,7 +3282,7 @@ public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices i headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, java.io.InputStream invoices, Boolean summarizeErrors, String mediaType) throws IOException { @@ -3192,7 +3312,12 @@ public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, java.io.In HttpContent content = invoices == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices invoices, Map params) throws IOException { @@ -3295,7 +3420,7 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xero headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -3324,7 +3449,12 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { @@ -3431,7 +3561,7 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -3456,7 +3586,12 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUI HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords, Map params) throws IOException { @@ -3551,7 +3686,7 @@ public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items) headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createItemForHttpResponse(String xeroTenantId, java.io.InputStream items, String mediaType) throws IOException { @@ -3570,7 +3705,12 @@ public HttpResponse createItemForHttpResponse(String xeroTenantId, java.io.Input HttpContent content = items == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items, Map params) throws IOException { @@ -3665,7 +3805,7 @@ public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID i headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -3690,7 +3830,12 @@ public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID i HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, HistoryRecords historyRecords, Map params) throws IOException { @@ -3785,7 +3930,7 @@ public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, java.io.InputStream linkedTransactions, String mediaType) throws IOException { @@ -3804,7 +3949,12 @@ public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, HttpContent content = linkedTransactions == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, LinkedTransactions linkedTransactions, Map params) throws IOException { @@ -3893,7 +4043,7 @@ public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, Manu headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, java.io.InputStream manualJournals, String mediaType) throws IOException { @@ -3912,7 +4062,12 @@ public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, java HttpContent content = manualJournals == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, ManualJournals manualJournals, Map params) throws IOException { @@ -4015,7 +4170,7 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -4044,7 +4199,12 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { @@ -4151,7 +4311,7 @@ public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenant headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, java.io.InputStream allocations, String mediaType) throws IOException { @@ -4176,7 +4336,12 @@ public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenant HttpContent content = allocations == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, Allocations allocations, Map params) throws IOException { @@ -4279,7 +4444,7 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -4304,7 +4469,12 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords, Map params) throws IOException { @@ -4399,7 +4569,7 @@ public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments p headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPaymentForHttpResponse(String xeroTenantId, java.io.InputStream payments, String mediaType) throws IOException { @@ -4418,7 +4588,12 @@ public HttpResponse createPaymentForHttpResponse(String xeroTenantId, java.io.In HttpContent content = payments == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments payments, Map params) throws IOException { @@ -4515,7 +4690,7 @@ public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -4540,7 +4715,12 @@ public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUI HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords, Map params) throws IOException { @@ -4635,7 +4815,7 @@ public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, Pay headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, java.io.InputStream paymentServices, String mediaType) throws IOException { @@ -4654,7 +4834,12 @@ public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, jav HttpContent content = paymentServices == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentServices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, PaymentServices paymentServices, Map params) throws IOException { @@ -4751,7 +4936,7 @@ public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, java.io.InputStream allocations, String mediaType) throws IOException { @@ -4776,7 +4961,12 @@ public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantI HttpContent content = allocations == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, Allocations allocations, Map params) throws IOException { @@ -4879,7 +5069,7 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -4904,7 +5094,12 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords, Map params) throws IOException { @@ -5011,7 +5206,7 @@ public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, Purc headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, java.io.InputStream purchaseOrders, Boolean summarizeErrors, String mediaType) throws IOException { @@ -5041,7 +5236,12 @@ public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, java HttpContent content = purchaseOrders == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, PurchaseOrders purchaseOrders, Map params) throws IOException { @@ -5138,7 +5338,7 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -5163,7 +5363,12 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantI HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords, Map params) throws IOException { @@ -5258,7 +5463,7 @@ public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts r headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createReceiptForHttpResponse(String xeroTenantId, java.io.InputStream receipts, String mediaType) throws IOException { @@ -5277,7 +5482,12 @@ public HttpResponse createReceiptForHttpResponse(String xeroTenantId, java.io.In HttpContent content = receipts == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts receipts, Map params) throws IOException { @@ -5380,7 +5590,7 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xero headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -5409,7 +5619,12 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { @@ -5516,7 +5731,7 @@ public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -5541,7 +5756,12 @@ public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUI HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords, Map params) throws IOException { @@ -5650,7 +5870,7 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -5679,7 +5899,12 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { @@ -5786,7 +6011,7 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTena headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, java.io.InputStream historyRecords, String mediaType) throws IOException { @@ -5811,7 +6036,12 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTena HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords, Map params) throws IOException { @@ -5906,7 +6136,7 @@ public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates t headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, java.io.InputStream taxRates, String mediaType) throws IOException { @@ -5925,7 +6155,12 @@ public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, java.io.In HttpContent content = taxRates == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { @@ -6014,7 +6249,7 @@ public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, T headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, java.io.InputStream trackingCategory, String mediaType) throws IOException { @@ -6033,7 +6268,12 @@ public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, j HttpContent content = trackingCategory == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, TrackingCategory trackingCategory, Map params) throws IOException { @@ -6130,7 +6370,7 @@ public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UU headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, java.io.InputStream trackingOption, String mediaType) throws IOException { @@ -6155,7 +6395,12 @@ public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UU HttpContent content = trackingOption == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingOption); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption, Map params) throws IOException { @@ -6253,7 +6498,7 @@ public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accou headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { @@ -6348,7 +6593,7 @@ public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId, UUID contactGroupID, UUID contactID, Map params) throws IOException { @@ -6439,7 +6684,7 @@ public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { @@ -6528,7 +6773,7 @@ public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID) headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { @@ -6617,7 +6862,7 @@ public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { @@ -6717,7 +6962,7 @@ public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID payme headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, java.io.InputStream payments, String mediaType) throws IOException { @@ -6742,7 +6987,12 @@ public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID payme HttpContent content = payments == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, Payments payments, Map params) throws IOException { @@ -6840,7 +7090,7 @@ public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, U headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { @@ -6941,7 +7191,7 @@ public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UU headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, Map params) throws IOException { @@ -7039,7 +7289,7 @@ public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoic headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream requestEmpty, String mediaType) throws IOException { @@ -7064,7 +7314,12 @@ public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoic HttpContent content = requestEmpty == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, requestEmpty); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty, Map params) throws IOException { @@ -7160,7 +7415,7 @@ public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { @@ -7264,7 +7519,7 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTen headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, String contentType, Map params) throws IOException { @@ -7375,7 +7630,7 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType, Map params) throws IOException { @@ -7475,7 +7730,7 @@ public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UU headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { @@ -7584,7 +7839,7 @@ public HttpResponse getAccountsForHttpResponse(String xeroTenantId, OffsetDateTi headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getAccountsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -7671,7 +7926,7 @@ public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { @@ -7775,7 +8030,7 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType, Map params) throws IOException { @@ -7886,7 +8141,7 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroT headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType, Map params) throws IOException { @@ -7986,7 +8241,7 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTena headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { @@ -8117,7 +8372,7 @@ public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Offs headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -8204,7 +8459,7 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { @@ -8297,7 +8552,7 @@ public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID ban headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { @@ -8401,7 +8656,7 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xe headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, String contentType, Map params) throws IOException { @@ -8512,7 +8767,7 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTena headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType, Map params) throws IOException { @@ -8612,7 +8867,7 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { @@ -8705,7 +8960,7 @@ public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, U headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { @@ -8814,7 +9069,7 @@ public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, OffsetD headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -8901,7 +9156,7 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, U headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, UUID batchPaymentID, Map params) throws IOException { @@ -9010,7 +9265,7 @@ public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, OffsetD headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -9097,7 +9352,7 @@ public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID br headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { @@ -9190,7 +9445,7 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTe headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { @@ -9275,7 +9530,7 @@ public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId) throws headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -9362,7 +9617,7 @@ public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { @@ -9466,7 +9721,7 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTen headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, String contentType, Map params) throws IOException { @@ -9577,7 +9832,7 @@ public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType, Map params) throws IOException { @@ -9677,7 +9932,7 @@ public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UU headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { @@ -9770,7 +10025,7 @@ public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UU headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { @@ -9863,7 +10118,7 @@ public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID con headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { @@ -9971,7 +10226,7 @@ public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, String headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -10058,7 +10313,7 @@ public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID c headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { @@ -10200,7 +10455,7 @@ public HttpResponse getContactsForHttpResponse(String xeroTenantId, OffsetDateTi headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getContactsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -10287,7 +10542,7 @@ public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID credi headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { @@ -10385,7 +10640,7 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID creditNoteID, String contentType, Map params) throws IOException { @@ -10492,7 +10747,7 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xero headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, String contentType, Map params) throws IOException { @@ -10603,7 +10858,7 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenant headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType, Map params) throws IOException { @@ -10703,7 +10958,7 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { @@ -10796,7 +11051,7 @@ public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { @@ -10916,7 +11171,7 @@ public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, OffsetDat headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -11018,7 +11273,7 @@ public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, String whe headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -11105,7 +11360,7 @@ public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employe headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Map params) throws IOException { @@ -11214,7 +11469,7 @@ public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, OffsetDateT headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -11301,7 +11556,7 @@ public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID exp headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { @@ -11394,7 +11649,7 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, U headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { @@ -11503,7 +11758,7 @@ public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, OffsetD headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -11590,7 +11845,7 @@ public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { @@ -11688,7 +11943,7 @@ public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID inv headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID invoiceID, String contentType, Map params) throws IOException { @@ -11795,7 +12050,7 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTen headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, String contentType, Map params) throws IOException { @@ -11906,7 +12161,7 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType, Map params) throws IOException { @@ -12006,7 +12261,7 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UU headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { @@ -12099,7 +12354,7 @@ public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID i headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { @@ -12184,7 +12439,7 @@ public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId) thro headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -12375,7 +12630,7 @@ public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, OffsetDateTi headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -12462,7 +12717,7 @@ public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID) thr headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { @@ -12555,7 +12810,7 @@ public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID item headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { @@ -12675,7 +12930,7 @@ public HttpResponse getItemsForHttpResponse(String xeroTenantId, OffsetDateTime headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getItemsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -12762,7 +13017,7 @@ public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalID, Map params) throws IOException { @@ -12871,7 +13126,7 @@ public HttpResponse getJournalsForHttpResponse(String xeroTenantId, OffsetDateTi headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getJournalsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -12958,7 +13213,7 @@ public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { @@ -13110,7 +13365,7 @@ public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, In headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -13197,7 +13452,7 @@ public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID ma headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { @@ -13301,7 +13556,7 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String x headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, String contentType, Map params) throws IOException { @@ -13412,7 +13667,7 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTen headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType, Map params) throws IOException { @@ -13512,7 +13767,7 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenant headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { @@ -13632,7 +13887,7 @@ public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, Offset headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -13719,7 +13974,7 @@ public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID in headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { @@ -13812,7 +14067,7 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantId, UUID organisationID, Map params) throws IOException { @@ -13897,7 +14152,7 @@ public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId) throws headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -13984,7 +14239,7 @@ public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID over headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { @@ -14077,7 +14332,7 @@ public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UU headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { @@ -14208,7 +14463,7 @@ public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, OffsetDa headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -14295,7 +14550,7 @@ public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentID, Map params) throws IOException { @@ -14388,7 +14643,7 @@ public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID p headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, Map params) throws IOException { @@ -14473,7 +14728,7 @@ public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId) throw headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -14576,7 +14831,7 @@ public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, OffsetDateTi headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -14663,7 +14918,7 @@ public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepa headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { @@ -14756,7 +15011,7 @@ public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { @@ -14887,7 +15142,7 @@ public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, OffsetDat headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -14974,7 +15229,7 @@ public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID pu headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { @@ -15067,7 +15322,7 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { @@ -15209,7 +15464,7 @@ public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, Offset headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -15296,7 +15551,7 @@ public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { @@ -15400,7 +15655,7 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTen headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, String contentType, Map params) throws IOException { @@ -15511,7 +15766,7 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType, Map params) throws IOException { @@ -15611,7 +15866,7 @@ public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UU headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { @@ -15704,7 +15959,7 @@ public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID r headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { @@ -15824,7 +16079,7 @@ public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, OffsetDateTi headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -15911,7 +16166,7 @@ public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { @@ -16015,7 +16270,7 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(Strin headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType, Map params) throws IOException { @@ -16126,7 +16381,7 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xero headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType, Map params) throws IOException { @@ -16226,7 +16481,7 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTen headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { @@ -16319,7 +16574,7 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantI headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { @@ -16427,7 +16682,7 @@ public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, Str headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -16555,7 +16810,7 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTen headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTenantId, UUID contactId, Map params) throws IOException { @@ -16688,7 +16943,7 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xero headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xeroTenantId, UUID contactId, Map params) throws IOException { @@ -16780,7 +17035,7 @@ public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String reportID, Map params) throws IOException { @@ -16865,7 +17120,7 @@ public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId) th headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -17022,7 +17277,7 @@ public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, St headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -17135,7 +17390,7 @@ public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, Loc headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -17248,7 +17503,7 @@ public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, L headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -17339,7 +17594,7 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -17529,7 +17784,7 @@ public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, L headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -17620,7 +17875,7 @@ public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, S headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -17722,7 +17977,7 @@ public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Lo headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -17835,7 +18090,7 @@ public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, String where headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -17948,7 +18203,7 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, St headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -18035,7 +18290,7 @@ public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { @@ -18128,7 +18383,7 @@ public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID) thr headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID, Map params) throws IOException { @@ -18237,7 +18492,7 @@ public HttpResponse getUsersForHttpResponse(String xeroTenantId, OffsetDateTime headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse getUsersForHttpResponse(String xeroTenantId, Map params) throws IOException { @@ -18331,7 +18586,7 @@ public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accou headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, java.io.InputStream accounts, String mediaType) throws IOException { @@ -18356,7 +18611,12 @@ public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accou HttpContent content = accounts == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, accounts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, Accounts accounts, Map params) throws IOException { @@ -18465,7 +18725,7 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xero headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -18494,7 +18754,12 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { @@ -18601,7 +18866,7 @@ public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UU headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, java.io.InputStream bankTransactions, String mediaType) throws IOException { @@ -18626,7 +18891,12 @@ public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UU HttpContent content = bankTransactions == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions, Map params) throws IOException { @@ -18735,7 +19005,7 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -18764,7 +19034,12 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { @@ -18875,7 +19150,7 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -18904,7 +19179,12 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { @@ -19009,7 +19289,7 @@ public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID conta headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, java.io.InputStream contacts, String mediaType) throws IOException { @@ -19034,7 +19314,12 @@ public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID conta HttpContent content = contacts == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, Contacts contacts, Map params) throws IOException { @@ -19141,7 +19426,7 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xero headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -19170,7 +19455,12 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { @@ -19277,7 +19567,7 @@ public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, java.io.InputStream contactGroups, String mediaType) throws IOException { @@ -19302,7 +19592,12 @@ public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID HttpContent content = contactGroups == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups, Map params) throws IOException { @@ -19405,7 +19700,7 @@ public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID cr headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream creditNotes, String mediaType) throws IOException { @@ -19430,7 +19725,12 @@ public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID cr HttpContent content = creditNotes == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes, Map params) throws IOException { @@ -19539,7 +19839,7 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String x headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -19568,7 +19868,12 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String x HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { @@ -19675,7 +19980,7 @@ public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID empl headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, java.io.InputStream employees, String mediaType) throws IOException { @@ -19700,7 +20005,12 @@ public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID empl HttpContent content = employees == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Employees employees, Map params) throws IOException { @@ -19803,7 +20113,7 @@ public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, java.io.InputStream expenseClaims, String mediaType) throws IOException { @@ -19828,7 +20138,12 @@ public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID HttpContent content = expenseClaims == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims, Map params) throws IOException { @@ -19931,7 +20246,7 @@ public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoi headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream invoices, String mediaType) throws IOException { @@ -19956,7 +20271,12 @@ public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoi HttpContent content = invoices == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Invoices invoices, Map params) throws IOException { @@ -20065,7 +20385,7 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xero headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -20094,7 +20414,12 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { @@ -20201,7 +20526,7 @@ public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, java.io.InputStream items, String mediaType) throws IOException { @@ -20226,7 +20551,12 @@ public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, HttpContent content = items == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, Items items, Map params) throws IOException { @@ -20329,7 +20659,7 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, java.io.InputStream linkedTransactions, String mediaType) throws IOException { @@ -20354,7 +20684,12 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, HttpContent content = linkedTransactions == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions, Map params) throws IOException { @@ -20457,7 +20792,7 @@ public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, java.io.InputStream manualJournals, String mediaType) throws IOException { @@ -20482,7 +20817,12 @@ public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID HttpContent content = manualJournals == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals, Map params) throws IOException { @@ -20591,7 +20931,7 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -20620,7 +20960,12 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { @@ -20727,7 +21072,7 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, java.io.InputStream purchaseOrders, String mediaType) throws IOException { @@ -20752,7 +21097,12 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID HttpContent content = purchaseOrders == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders, Map params) throws IOException { @@ -20855,7 +21205,7 @@ public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID recei headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, java.io.InputStream receipts, String mediaType) throws IOException { @@ -20880,7 +21230,12 @@ public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID recei HttpContent content = receipts == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Receipts receipts, Map params) throws IOException { @@ -20989,7 +21344,7 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xero headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -21018,7 +21373,12 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { @@ -21131,7 +21491,7 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { @@ -21160,7 +21520,12 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { @@ -21259,7 +21624,7 @@ public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates t headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, java.io.InputStream taxRates, String mediaType) throws IOException { @@ -21278,7 +21643,12 @@ public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, java.io.In HttpContent content = taxRates == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { @@ -21375,7 +21745,7 @@ public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, U headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, java.io.InputStream trackingCategory, String mediaType) throws IOException { @@ -21400,7 +21770,12 @@ public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, U HttpContent content = trackingCategory == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory, Map params) throws IOException { From 9fb19d2ff613a6337f99c4c45b4a4d4170cde0e3 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 11 Jun 2019 09:22:21 -0700 Subject: [PATCH 06/76] Maven badge stable --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26c16cb8..7e7aa3c4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Xero-Java -[![Maven Central](https://img.shields.io/maven-central/v/com.github.xeroapi/xero-java.svg?label=Maven%20Central)](https://search.maven.org/artifact/com.github.xeroapi/xero-java/2.3.8/jar) +[![Maven Central](https://img.shields.io/badge/Maven%20Central-2.3.8-green.svg)](https://search.maven.org/artifact/com.github.xeroapi/xero-java/2.3.8/jar) [![Maven Central](https://img.shields.io/maven-central/v/com.github.xeroapi/xero-java.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.xeroapi%22%20AND%20a:%22xero-java%22) From 48018f2aa04971886170b11b3f790aa8a24b27bf Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Thu, 13 Jun 2019 13:06:51 -0700 Subject: [PATCH 07/76] fixing path and headers --- README.md | 2 - .../com/xero/api/client/AccountingApi.java | 10099 ++++++++++++---- 2 files changed, 7551 insertions(+), 2550 deletions(-) diff --git a/README.md b/README.md index 7e7aa3c4..a15d7b2b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Xero-Java -[![Maven Central](https://img.shields.io/badge/Maven%20Central-2.3.8-green.svg)](https://search.maven.org/artifact/com.github.xeroapi/xero-java/2.3.8/jar) - [![Maven Central](https://img.shields.io/maven-central/v/com.github.xeroapi/xero-java.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.xeroapi%22%20AND%20a:%22xero-java%22) diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index da397baf..c6931803 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -56,33 +56,23 @@ import com.google.api.client.http.HttpContent; import com.google.api.client.http.InputStreamContent; import com.google.api.client.http.HttpMethods; -import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpHeaders; +import com.google.api.client.http.HttpResponse; import com.google.api.client.json.Json; import javax.ws.rs.core.UriBuilder; import java.io.IOException; +import java.io.InputStream; +import java.io.ByteArrayInputStream; + import java.util.Collection; import java.util.HashMap; import java.util.Map; -import java.util.List; -import java.util.ArrayList; - -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; +import org.apache.commons.io.IOUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.io.ByteArrayInputStream; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.regex.Pattern; - -import javax.ws.rs.core.UriBuilder; - public class AccountingApi { private ApiClient apiClient; @@ -112,7 +102,7 @@ public void setApiClient(ApiClient apiClient) { * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts createAccount(String xeroTenantId, Account account) throws IOException { + public Accounts createAccount(String xeroTenantId, Account account) throws IOException { HttpResponse response = createAccountForHttpResponse(xeroTenantId, account); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -128,7 +118,7 @@ public Accounts createAccount(String xeroTenantId, Account account) throws IOExc * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts createAccount(String xeroTenantId, Account account, Map params) throws IOException { + public Accounts createAccount(String xeroTenantId, Account account, Map params) throws IOException { HttpResponse response = createAccountForHttpResponse(xeroTenantId, account, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -142,16 +132,18 @@ public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account ac if (account == null) { throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(account); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -164,7 +156,13 @@ public HttpResponse createAccountForHttpResponse(String xeroTenantId, java.io.In if (account == null) { throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -172,10 +170,6 @@ public HttpResponse createAccountForHttpResponse(String xeroTenantId, java.io.In HttpContent content = account == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, account); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -188,7 +182,13 @@ public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account ac if (account == null) { throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -211,8 +211,9 @@ public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account ac String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(account); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(account); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -227,7 +228,7 @@ public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account ac * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -245,7 +246,7 @@ public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID a * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { + public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -265,20 +266,33 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -297,11 +311,26 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -309,10 +338,6 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -331,11 +356,29 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -358,8 +401,9 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -373,7 +417,7 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xero * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { HttpResponse response = createBankTransactionForHttpResponse(xeroTenantId, bankTransactions, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -389,7 +433,7 @@ public BankTransactions createBankTransaction(String xeroTenantId, BankTransacti * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Map params) throws IOException { + public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Map params) throws IOException { HttpResponse response = createBankTransactionForHttpResponse(xeroTenantId, bankTransactions, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -403,7 +447,13 @@ public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, Ba if (bankTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; Object value = summarizeErrors; @@ -420,10 +470,6 @@ public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, Ba GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -436,7 +482,13 @@ public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, ja if (bankTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; Object value = summarizeErrors; @@ -455,10 +507,6 @@ public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, ja HttpContent content = bankTransactions == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -471,7 +519,13 @@ public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, Ba if (bankTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -494,8 +548,9 @@ public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, Ba String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -510,7 +565,7 @@ public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, Ba * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -528,7 +583,7 @@ public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { + public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -548,20 +603,33 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -580,11 +648,26 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -592,10 +675,6 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -614,11 +693,29 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -641,8 +738,9 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -656,7 +754,7 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(xeroTenantId, bankTransactionID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -673,7 +771,7 @@ public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UU * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(xeroTenantId, bankTransactionID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -690,19 +788,29 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xer if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -718,10 +826,25 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xer if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -729,10 +852,6 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xer HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -748,10 +867,25 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xer if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -774,8 +908,9 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xer String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -788,7 +923,7 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xer * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers) throws IOException { + public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers) throws IOException { HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -804,7 +939,7 @@ public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankT * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers, Map params) throws IOException { + public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers, Map params) throws IOException { HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -818,16 +953,18 @@ public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankT if (bankTransfers == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -840,7 +977,13 @@ public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, java. if (bankTransfers == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -848,10 +991,6 @@ public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, java. HttpContent content = bankTransfers == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransfers); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -864,7 +1003,13 @@ public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankT if (bankTransfers == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -887,8 +1032,9 @@ public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankT String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -902,7 +1048,7 @@ public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankT * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -919,7 +1065,7 @@ public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, U * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { + public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -939,20 +1085,33 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -971,11 +1130,26 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -983,10 +1157,6 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1005,11 +1175,29 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -1032,8 +1220,9 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1046,7 +1235,7 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createBankTransferHistoryRecordForHttpResponse(xeroTenantId, bankTransferID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1062,7 +1251,7 @@ public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createBankTransferHistoryRecordForHttpResponse(xeroTenantId, bankTransferID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1079,19 +1268,29 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTe if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1107,10 +1306,25 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTe if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -1118,10 +1332,6 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTe HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1137,10 +1347,25 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTe if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -1163,8 +1388,9 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTe String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1177,7 +1403,7 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTe * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments) throws IOException { + public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments) throws IOException { HttpResponse response = createBatchPaymentForHttpResponse(xeroTenantId, batchPayments); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1193,7 +1419,7 @@ public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batch * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments, Map params) throws IOException { + public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments, Map params) throws IOException { HttpResponse response = createBatchPaymentForHttpResponse(xeroTenantId, batchPayments, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1207,16 +1433,18 @@ public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, Batch if (batchPayments == null) { throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BatchPayments"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1229,7 +1457,13 @@ public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, java. if (batchPayments == null) { throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BatchPayments"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -1237,10 +1471,6 @@ public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, java. HttpContent content = batchPayments == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, batchPayments); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1253,7 +1483,13 @@ public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, Batch if (batchPayments == null) { throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BatchPayments"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -1276,8 +1512,9 @@ public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, Batch String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1291,7 +1528,7 @@ public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, Batch * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(xeroTenantId, batchPaymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1308,7 +1545,7 @@ public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(xeroTenantId, batchPaymentID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1325,19 +1562,29 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTe if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BatchPayments/{BatchPaymentID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BatchPayments/{BatchPaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BatchPaymentID", batchPaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1353,10 +1600,25 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTe if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BatchPayments/{BatchPaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BatchPayments/{BatchPaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BatchPaymentID", batchPaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -1364,10 +1626,6 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTe HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1383,10 +1641,25 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTe if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BatchPayments/{BatchPaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BatchPayments/{BatchPaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BatchPaymentID", batchPaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -1409,8 +1682,9 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTe String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1424,7 +1698,7 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTe * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { + public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, paymentService); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1441,7 +1715,7 @@ public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, U * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService, Map params) throws IOException { + public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService, Map params) throws IOException { HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, paymentService, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1458,19 +1732,29 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xer if (paymentService == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -1486,10 +1770,25 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xer if (paymentService == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BrandingThemeID", brandingThemeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -1497,10 +1796,6 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xer HttpContent content = paymentService == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentService); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -1516,10 +1811,25 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xer if (paymentService == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -1542,8 +1852,9 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xer String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -1555,7 +1866,7 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xer * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts createContact(String xeroTenantId, Contact contact) throws IOException { + public Contacts createContact(String xeroTenantId, Contact contact) throws IOException { HttpResponse response = createContactForHttpResponse(xeroTenantId, contact); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1570,7 +1881,7 @@ public Contacts createContact(String xeroTenantId, Contact contact) throws IOExc * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts createContact(String xeroTenantId, Contact contact, Map params) throws IOException { + public Contacts createContact(String xeroTenantId, Contact contact, Map params) throws IOException { HttpResponse response = createContactForHttpResponse(xeroTenantId, contact, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1584,16 +1895,18 @@ public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact co if (contact == null) { throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(contact); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1606,7 +1919,13 @@ public HttpResponse createContactForHttpResponse(String xeroTenantId, java.io.In if (contact == null) { throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -1614,10 +1933,6 @@ public HttpResponse createContactForHttpResponse(String xeroTenantId, java.io.In HttpContent content = contact == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contact); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1630,7 +1945,13 @@ public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact co if (contact == null) { throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -1653,8 +1974,9 @@ public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact co String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(contact); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(contact); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1668,7 +1990,7 @@ public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact co * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1685,7 +2007,7 @@ public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID c * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { + public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1705,20 +2027,33 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1737,11 +2072,26 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -1749,10 +2099,6 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1771,11 +2117,29 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -1798,8 +2162,9 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1812,7 +2177,7 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xero * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups) throws IOException { + public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups) throws IOException { HttpResponse response = createContactGroupForHttpResponse(xeroTenantId, contactGroups); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1828,7 +2193,7 @@ public ContactGroups createContactGroup(String xeroTenantId, ContactGroups conta * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups, Map params) throws IOException { + public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups, Map params) throws IOException { HttpResponse response = createContactGroupForHttpResponse(xeroTenantId, contactGroups, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1842,16 +2207,18 @@ public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, Conta if (contactGroups == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1864,7 +2231,13 @@ public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, java. if (contactGroups == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -1872,10 +2245,6 @@ public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, java. HttpContent content = contactGroups == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1888,7 +2257,13 @@ public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, Conta if (contactGroups == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -1911,8 +2286,9 @@ public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, Conta String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1926,7 +2302,7 @@ public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, Conta * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { + public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1943,7 +2319,7 @@ public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGrou * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts, Map params) throws IOException { + public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts, Map params) throws IOException { HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -1960,19 +2336,29 @@ public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantI if (contacts == null) { throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}/Contacts"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1988,10 +2374,25 @@ public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantI if (contacts == null) { throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}/Contacts"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -1999,10 +2400,6 @@ public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantI HttpContent content = contacts == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2018,10 +2415,25 @@ public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantI if (contacts == null) { throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}/Contacts"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -2044,8 +2456,9 @@ public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2059,7 +2472,7 @@ public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantI * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createContactHistoryForHttpResponse(xeroTenantId, contactID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2076,7 +2489,7 @@ public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createContactHistoryForHttpResponse(xeroTenantId, contactID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2093,19 +2506,29 @@ public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2121,10 +2544,25 @@ public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -2132,10 +2570,6 @@ public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUI HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2151,10 +2585,25 @@ public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -2177,8 +2626,9 @@ public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2192,7 +2642,7 @@ public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUI * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { HttpResponse response = createCreditNoteForHttpResponse(xeroTenantId, creditNotes, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2208,7 +2658,7 @@ public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Map params) throws IOException { + public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Map params) throws IOException { HttpResponse response = createCreditNoteForHttpResponse(xeroTenantId, creditNotes, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2222,7 +2672,13 @@ public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditN if (creditNotes == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; Object value = summarizeErrors; @@ -2239,10 +2695,6 @@ public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditN GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2255,7 +2707,13 @@ public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, java.io if (creditNotes == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; Object value = summarizeErrors; @@ -2274,10 +2732,6 @@ public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, java.io HttpContent content = creditNotes == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2290,7 +2744,13 @@ public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditN if (creditNotes == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -2313,8 +2773,9 @@ public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditN String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2328,7 +2789,7 @@ public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditN * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { + public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { HttpResponse response = createCreditNoteAllocationForHttpResponse(xeroTenantId, creditNoteID, allocations); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2345,7 +2806,7 @@ public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNo * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations, Map params) throws IOException { + public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations, Map params) throws IOException { HttpResponse response = createCreditNoteAllocationForHttpResponse(xeroTenantId, creditNoteID, allocations, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2362,19 +2823,29 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantI if (allocations == null) { throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Allocations"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Allocations"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2390,10 +2861,25 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantI if (allocations == null) { throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Allocations"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Allocations"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -2401,10 +2887,6 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantI HttpContent content = allocations == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2420,10 +2902,25 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantI if (allocations == null) { throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Allocations"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Allocations"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Allocations"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -2446,8 +2943,9 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2462,7 +2960,7 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantI * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2480,7 +2978,7 @@ public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUI * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { + public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2500,20 +2998,33 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String x if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2532,11 +3043,26 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String x if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -2544,10 +3070,6 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String x HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2566,11 +3088,29 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String x if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -2593,8 +3133,9 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String x String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2608,7 +3149,7 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String x * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2625,7 +3166,7 @@ public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNo * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2642,19 +3183,29 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2670,21 +3221,32 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); - + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2700,10 +3262,25 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -2726,8 +3303,9 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2738,7 +3316,7 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, * @return Currencies * @throws IOException if an error occurs while attempting to invoke the API **/ - public Currencies createCurrency(String xeroTenantId, Currencies currencies) throws IOException { + public Currencies createCurrency(String xeroTenantId, Currencies currencies) throws IOException { HttpResponse response = createCurrencyForHttpResponse(xeroTenantId, currencies); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2752,7 +3330,7 @@ public Currencies createCurrency(String xeroTenantId, Currencies currencies) thr * @return Currencies * @throws IOException if an error occurs while attempting to invoke the API **/ - public Currencies createCurrency(String xeroTenantId, Currencies currencies, Map params) throws IOException { + public Currencies createCurrency(String xeroTenantId, Currencies currencies, Map params) throws IOException { HttpResponse response = createCurrencyForHttpResponse(xeroTenantId, currencies, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2766,16 +3344,18 @@ public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencie if (currencies == null) { throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Currencies"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2788,7 +3368,13 @@ public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, java.io.I if (currencies == null) { throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Currencies"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -2796,10 +3382,6 @@ public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, java.io.I HttpContent content = currencies == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, currencies); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2812,7 +3394,13 @@ public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencie if (currencies == null) { throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Currencies"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -2835,8 +3423,9 @@ public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencie String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2849,7 +3438,7 @@ public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencie * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees createEmployee(String xeroTenantId, Employees employees) throws IOException { + public Employees createEmployee(String xeroTenantId, Employees employees) throws IOException { HttpResponse response = createEmployeeForHttpResponse(xeroTenantId, employees); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2865,7 +3454,7 @@ public Employees createEmployee(String xeroTenantId, Employees employees) throws * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees createEmployee(String xeroTenantId, Employees employees, Map params) throws IOException { + public Employees createEmployee(String xeroTenantId, Employees employees, Map params) throws IOException { HttpResponse response = createEmployeeForHttpResponse(xeroTenantId, employees, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2879,16 +3468,18 @@ public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees if (employees == null) { throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Employees"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2901,7 +3492,13 @@ public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, java.io.I if (employees == null) { throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Employees"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -2909,10 +3506,6 @@ public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, java.io.I HttpContent content = employees == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2925,7 +3518,13 @@ public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees if (employees == null) { throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Employees"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -2948,8 +3547,9 @@ public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2963,7 +3563,7 @@ public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2979,7 +3579,7 @@ public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expen * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Map params) throws IOException { + public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Map params) throws IOException { HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -2993,7 +3593,13 @@ public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, Expen if (expenseClaims == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; Object value = summarizeErrors; @@ -3010,10 +3616,6 @@ public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, Expen GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3026,7 +3628,13 @@ public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, java. if (expenseClaims == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; Object value = summarizeErrors; @@ -3045,10 +3653,6 @@ public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, java. HttpContent content = expenseClaims == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3061,7 +3665,13 @@ public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, Expen if (expenseClaims == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -3084,8 +3694,9 @@ public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, Expen String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3098,7 +3709,7 @@ public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, Expen * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3114,7 +3725,7 @@ public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expens * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3131,19 +3742,29 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ExpenseClaims/{ExpenseClaimID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3159,10 +3780,25 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ExpenseClaims/{ExpenseClaimID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -3170,10 +3806,6 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3189,10 +3821,25 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ExpenseClaims/{ExpenseClaimID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -3215,8 +3862,9 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3230,7 +3878,7 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices createInvoice(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + public Invoices createInvoice(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { HttpResponse response = createInvoiceForHttpResponse(xeroTenantId, invoices, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3246,7 +3894,7 @@ public Invoices createInvoice(String xeroTenantId, Invoices invoices, Boolean su * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices createInvoice(String xeroTenantId, Invoices invoices, Map params) throws IOException { + public Invoices createInvoice(String xeroTenantId, Invoices invoices, Map params) throws IOException { HttpResponse response = createInvoiceForHttpResponse(xeroTenantId, invoices, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3260,7 +3908,13 @@ public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices i if (invoices == null) { throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; Object value = summarizeErrors; @@ -3277,10 +3931,6 @@ public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices i GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3293,7 +3943,13 @@ public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, java.io.In if (invoices == null) { throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; Object value = summarizeErrors; @@ -3312,10 +3968,6 @@ public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, java.io.In HttpContent content = invoices == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3328,7 +3980,13 @@ public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices i if (invoices == null) { throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -3351,8 +4009,9 @@ public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices i String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3367,7 +4026,7 @@ public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices i * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3385,7 +4044,7 @@ public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID i * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { + public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3405,20 +4064,33 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3437,11 +4109,26 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -3449,10 +4136,6 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3471,11 +4154,29 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -3498,8 +4199,9 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3513,7 +4215,7 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xero * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3530,7 +4232,7 @@ public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3547,19 +4249,29 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3575,10 +4287,25 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -3586,10 +4313,6 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUI HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3605,10 +4328,25 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -3631,8 +4369,9 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3645,7 +4384,7 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUI * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items createItem(String xeroTenantId, Items items) throws IOException { + public Items createItem(String xeroTenantId, Items items) throws IOException { HttpResponse response = createItemForHttpResponse(xeroTenantId, items); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3661,7 +4400,7 @@ public Items createItem(String xeroTenantId, Items items) throws IOException { * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items createItem(String xeroTenantId, Items items, Map params) throws IOException { + public Items createItem(String xeroTenantId, Items items, Map params) throws IOException { HttpResponse response = createItemForHttpResponse(xeroTenantId, items, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3675,16 +4414,18 @@ public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items) if (items == null) { throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(items); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3697,7 +4438,13 @@ public HttpResponse createItemForHttpResponse(String xeroTenantId, java.io.Input if (items == null) { throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -3705,10 +4452,6 @@ public HttpResponse createItemForHttpResponse(String xeroTenantId, java.io.Input HttpContent content = items == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3721,7 +4464,13 @@ public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items, if (items == null) { throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -3744,8 +4493,9 @@ public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items, String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(items); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(items); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3758,7 +4508,7 @@ public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items, * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createItemHistoryForHttpResponse(xeroTenantId, itemID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3774,7 +4524,7 @@ public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, Histor * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createItemHistoryForHttpResponse(xeroTenantId, itemID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3791,19 +4541,29 @@ public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID i if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3819,10 +4579,25 @@ public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID i if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -3830,10 +4605,6 @@ public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID i HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3849,10 +4620,25 @@ public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID i if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -3875,8 +4661,9 @@ public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID i String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3889,7 +4676,7 @@ public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID i * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { + public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { HttpResponse response = createLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactions); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3905,7 +4692,7 @@ public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTra * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions, Map params) throws IOException { + public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions, Map params) throws IOException { HttpResponse response = createLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactions, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -3919,16 +4706,18 @@ public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, if (linkedTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3941,7 +4730,13 @@ public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, if (linkedTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -3949,10 +4744,6 @@ public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, HttpContent content = linkedTransactions == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -3965,7 +4756,13 @@ public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, if (linkedTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -3988,8 +4785,9 @@ public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4002,7 +4800,7 @@ public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals) throws IOException { + public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals) throws IOException { HttpResponse response = createManualJournalForHttpResponse(xeroTenantId, manualJournals); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4018,7 +4816,7 @@ public ManualJournals createManualJournal(String xeroTenantId, ManualJournals ma * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals, Map params) throws IOException { + public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals, Map params) throws IOException { HttpResponse response = createManualJournalForHttpResponse(xeroTenantId, manualJournals, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4032,16 +4830,18 @@ public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, Manu if (manualJournals == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4054,7 +4854,13 @@ public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, java if (manualJournals == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -4062,10 +4868,6 @@ public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, java HttpContent content = manualJournals == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4078,7 +4880,13 @@ public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, Manu if (manualJournals == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -4101,8 +4909,9 @@ public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, Manu String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4117,7 +4926,7 @@ public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, Manu * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4135,7 +4944,7 @@ public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { + public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4155,20 +4964,33 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4187,11 +5009,26 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -4199,10 +5036,6 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4221,11 +5054,29 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -4248,8 +5099,9 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4263,7 +5115,7 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { + public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { HttpResponse response = createOverpaymentAllocationForHttpResponse(xeroTenantId, overpaymentID, allocations); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4280,7 +5132,7 @@ public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpay * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations, Map params) throws IOException { + public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations, Map params) throws IOException { HttpResponse response = createOverpaymentAllocationForHttpResponse(xeroTenantId, overpaymentID, allocations, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4297,19 +5149,29 @@ public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenant if (allocations == null) { throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Overpayments/{OverpaymentID}/Allocations"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Overpayments/{OverpaymentID}/Allocations"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4325,10 +5187,25 @@ public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenant if (allocations == null) { throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Overpayments/{OverpaymentID}/Allocations"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Overpayments/{OverpaymentID}/Allocations"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -4336,10 +5213,6 @@ public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenant HttpContent content = allocations == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4355,10 +5228,25 @@ public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenant if (allocations == null) { throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Overpayments/{OverpaymentID}/Allocations"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Overpayments/{OverpaymentID}/Allocations"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/Allocations"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -4381,8 +5269,9 @@ public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenant String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4396,7 +5285,7 @@ public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenant * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4413,7 +5302,7 @@ public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpay * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4430,19 +5319,29 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Overpayments/{OverpaymentID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Overpayments/{OverpaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4458,10 +5357,25 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Overpayments/{OverpaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Overpayments/{OverpaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -4469,10 +5383,6 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4488,10 +5398,25 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Overpayments/{OverpaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Overpayments/{OverpaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -4514,8 +5439,9 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4528,7 +5454,7 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments createPayment(String xeroTenantId, Payments payments) throws IOException { + public Payments createPayment(String xeroTenantId, Payments payments) throws IOException { HttpResponse response = createPaymentForHttpResponse(xeroTenantId, payments); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4544,7 +5470,7 @@ public Payments createPayment(String xeroTenantId, Payments payments) throws IOE * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments createPayment(String xeroTenantId, Payments payments, Map params) throws IOException { + public Payments createPayment(String xeroTenantId, Payments payments, Map params) throws IOException { HttpResponse response = createPaymentForHttpResponse(xeroTenantId, payments, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4558,16 +5484,18 @@ public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments p if (payments == null) { throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(payments); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4580,7 +5508,13 @@ public HttpResponse createPaymentForHttpResponse(String xeroTenantId, java.io.In if (payments == null) { throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -4588,10 +5522,6 @@ public HttpResponse createPaymentForHttpResponse(String xeroTenantId, java.io.In HttpContent content = payments == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4604,7 +5534,13 @@ public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments p if (payments == null) { throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -4627,8 +5563,9 @@ public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments p String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(payments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4642,7 +5579,7 @@ public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments p * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createPaymentHistoryForHttpResponse(xeroTenantId, paymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4659,7 +5596,7 @@ public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createPaymentHistoryForHttpResponse(xeroTenantId, paymentID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4676,19 +5613,29 @@ public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments/{PaymentID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Payments/{PaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4704,10 +5651,25 @@ public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments/{PaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Payments/{PaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -4715,10 +5677,6 @@ public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUI HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4734,10 +5692,25 @@ public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments/{PaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Payments/{PaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -4760,8 +5733,9 @@ public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4774,7 +5748,7 @@ public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUI * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices) throws IOException { + public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices) throws IOException { HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4790,7 +5764,7 @@ public PaymentServices createPaymentService(String xeroTenantId, PaymentServices * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices, Map params) throws IOException { + public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices, Map params) throws IOException { HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4804,16 +5778,18 @@ public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, Pay if (paymentServices == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PaymentServices"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4826,7 +5802,13 @@ public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, jav if (paymentServices == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PaymentServices"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -4834,10 +5816,6 @@ public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, jav HttpContent content = paymentServices == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentServices); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4850,7 +5828,13 @@ public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, Pay if (paymentServices == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PaymentServices"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -4873,8 +5857,9 @@ public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, Pay String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4888,7 +5873,7 @@ public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, Pay * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { + public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { HttpResponse response = createPrepaymentAllocationForHttpResponse(xeroTenantId, prepaymentID, allocations); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4905,7 +5890,7 @@ public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepayme * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations, Map params) throws IOException { + public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations, Map params) throws IOException { HttpResponse response = createPrepaymentAllocationForHttpResponse(xeroTenantId, prepaymentID, allocations, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -4922,19 +5907,29 @@ public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantI if (allocations == null) { throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Prepayments/{PrepaymentID}/Allocations"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Prepayments/{PrepaymentID}/Allocations"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4950,10 +5945,25 @@ public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantI if (allocations == null) { throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Prepayments/{PrepaymentID}/Allocations"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Prepayments/{PrepaymentID}/Allocations"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -4961,10 +5971,6 @@ public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantI HttpContent content = allocations == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -4980,10 +5986,25 @@ public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantI if (allocations == null) { throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Prepayments/{PrepaymentID}/Allocations"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Prepayments/{PrepaymentID}/Allocations"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/Allocations"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -5006,8 +6027,9 @@ public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5021,7 +6043,7 @@ public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantI * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5038,7 +6060,7 @@ public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepayme * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5055,19 +6077,29 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Prepayments/{PrepaymentID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Prepayments/{PrepaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5083,10 +6115,25 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Prepayments/{PrepaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Prepayments/{PrepaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PrepaymentID", prepaymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -5094,10 +6141,6 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5113,10 +6156,25 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Prepayments/{PrepaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Prepayments/{PrepaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -5139,8 +6197,9 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5154,7 +6213,7 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { HttpResponse response = createPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrders, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5170,7 +6229,7 @@ public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders pu * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Map params) throws IOException { + public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Map params) throws IOException { HttpResponse response = createPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrders, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5184,7 +6243,13 @@ public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, Purc if (purchaseOrders == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; Object value = summarizeErrors; @@ -5201,10 +6266,6 @@ public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, Purc GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5217,7 +6278,13 @@ public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, java if (purchaseOrders == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; Object value = summarizeErrors; @@ -5236,10 +6303,6 @@ public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, java HttpContent content = purchaseOrders == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5252,7 +6315,13 @@ public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, Purc if (purchaseOrders == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -5275,8 +6344,9 @@ public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, Purc String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5290,7 +6360,7 @@ public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, Purc * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5307,7 +6377,7 @@ public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purch * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5324,19 +6394,29 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/PurchaseOrders/{PurchaseOrderID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5352,10 +6432,25 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/PurchaseOrders/{PurchaseOrderID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -5363,10 +6458,6 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantI HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5382,10 +6473,25 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/PurchaseOrders/{PurchaseOrderID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -5408,8 +6514,9 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5422,7 +6529,7 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantI * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts createReceipt(String xeroTenantId, Receipts receipts) throws IOException { + public Receipts createReceipt(String xeroTenantId, Receipts receipts) throws IOException { HttpResponse response = createReceiptForHttpResponse(xeroTenantId, receipts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5438,7 +6545,7 @@ public Receipts createReceipt(String xeroTenantId, Receipts receipts) throws IOE * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts createReceipt(String xeroTenantId, Receipts receipts, Map params) throws IOException { + public Receipts createReceipt(String xeroTenantId, Receipts receipts, Map params) throws IOException { HttpResponse response = createReceiptForHttpResponse(xeroTenantId, receipts, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5452,16 +6559,18 @@ public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts r if (receipts == null) { throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5474,7 +6583,13 @@ public HttpResponse createReceiptForHttpResponse(String xeroTenantId, java.io.In if (receipts == null) { throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -5482,10 +6597,6 @@ public HttpResponse createReceiptForHttpResponse(String xeroTenantId, java.io.In HttpContent content = receipts == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5498,7 +6609,13 @@ public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts r if (receipts == null) { throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -5521,8 +6638,9 @@ public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts r String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5537,7 +6655,7 @@ public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts r * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5555,7 +6673,7 @@ public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID r * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { + public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5575,20 +6693,33 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5607,11 +6738,26 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -5619,10 +6765,6 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5641,11 +6783,29 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -5668,8 +6828,9 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5683,7 +6844,7 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xero * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createReceiptHistoryForHttpResponse(xeroTenantId, receiptID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5700,7 +6861,7 @@ public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createReceiptHistoryForHttpResponse(xeroTenantId, receiptID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5717,19 +6878,29 @@ public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5745,10 +6916,25 @@ public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -5756,10 +6942,6 @@ public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUI HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5775,10 +6957,25 @@ public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUI if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -5801,8 +6998,9 @@ public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5817,7 +7015,7 @@ public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUI * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5835,7 +7033,7 @@ public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantI * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { + public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5855,20 +7053,33 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5887,11 +7098,26 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -5899,10 +7125,6 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5921,11 +7143,29 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -5948,8 +7188,9 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -5963,7 +7204,7 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { + public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5980,7 +7221,7 @@ public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID re * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords, Map params) throws IOException { + public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords, Map params) throws IOException { HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -5997,19 +7238,29 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTena if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6025,10 +7276,25 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTena if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -6036,10 +7302,6 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTena HttpContent content = historyRecords == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6055,10 +7317,25 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTena if (historyRecords == null) { throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -6081,8 +7358,9 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTena String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6095,7 +7373,7 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTena * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { + public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { HttpResponse response = createTaxRateForHttpResponse(xeroTenantId, taxRates); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -6111,7 +7389,7 @@ public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates) throws IOE * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { + public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { HttpResponse response = createTaxRateForHttpResponse(xeroTenantId, taxRates, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -6125,16 +7403,18 @@ public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates t if (taxRates == null) { throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TaxRates"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6147,7 +7427,13 @@ public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, java.io.In if (taxRates == null) { throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TaxRates"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -6155,10 +7441,6 @@ public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, java.io.In HttpContent content = taxRates == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6171,7 +7453,13 @@ public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates t if (taxRates == null) { throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TaxRates"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -6194,8 +7482,9 @@ public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates t String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6208,7 +7497,7 @@ public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates t * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory) throws IOException { + public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory) throws IOException { HttpResponse response = createTrackingCategoryForHttpResponse(xeroTenantId, trackingCategory); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -6224,7 +7513,7 @@ public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCa * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory, Map params) throws IOException { + public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory, Map params) throws IOException { HttpResponse response = createTrackingCategoryForHttpResponse(xeroTenantId, trackingCategory, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -6238,16 +7527,18 @@ public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, T if (trackingCategory == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6260,7 +7551,13 @@ public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, j if (trackingCategory == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -6268,10 +7565,6 @@ public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, j HttpContent content = trackingCategory == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6284,7 +7577,13 @@ public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, T if (trackingCategory == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -6307,8 +7606,9 @@ public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, T String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6322,7 +7622,7 @@ public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, T * @return TrackingOptions * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { + public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { HttpResponse response = createTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOption); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -6339,7 +7639,7 @@ public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingC * @return TrackingOptions * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption, Map params) throws IOException { + public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption, Map params) throws IOException { HttpResponse response = createTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOption, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -6356,19 +7656,29 @@ public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UU if (trackingOption == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}/Options"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6384,10 +7694,25 @@ public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UU if (trackingOption == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}/Options"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -6395,10 +7720,6 @@ public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UU HttpContent content = trackingOption == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingOption); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6414,10 +7735,25 @@ public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UU if (trackingOption == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}/Options"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -6440,8 +7776,9 @@ public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UU String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -6454,7 +7791,7 @@ public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UU * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws IOException { + public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws IOException { HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -6470,7 +7807,7 @@ public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws IOExce * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts deleteAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { + public Accounts deleteAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -6484,19 +7821,29 @@ public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accou if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -6509,10 +7856,25 @@ public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accou if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -6535,8 +7897,9 @@ public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accou String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -6578,20 +7941,30 @@ public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -6607,11 +7980,26 @@ public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -6634,8 +8022,9 @@ public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -6670,19 +8059,29 @@ public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantI if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}/Contacts"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -6695,10 +8094,25 @@ public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantI if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}/Contacts"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}/Contacts"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -6721,8 +8135,9 @@ public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -6759,19 +8174,29 @@ public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID) if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -6784,10 +8209,25 @@ public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID, if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -6810,8 +8250,9 @@ public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -6848,19 +8289,29 @@ public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, if (linkedTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/LinkedTransactions/{LinkedTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -6873,10 +8324,25 @@ public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, if (linkedTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/LinkedTransactions/{LinkedTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -6899,8 +8365,9 @@ public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -6914,7 +8381,7 @@ public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { + public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -6931,7 +8398,7 @@ public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments paym * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments, Map params) throws IOException { + public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments, Map params) throws IOException { HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -6948,19 +8415,29 @@ public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID payme if (payments == null) { throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments/{PaymentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Payments/{PaymentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(payments); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -6976,10 +8453,25 @@ public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID payme if (payments == null) { throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments/{PaymentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Payments/{PaymentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -6987,10 +8479,6 @@ public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID payme HttpContent content = payments == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -7006,10 +8494,25 @@ public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID payme if (payments == null) { throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments/{PaymentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Payments/{PaymentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -7032,8 +8535,9 @@ public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID payme String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(payments); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -7046,7 +8550,7 @@ public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID payme * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { + public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7062,7 +8566,7 @@ public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID track * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7076,19 +8580,29 @@ public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, U if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -7101,10 +8615,25 @@ public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, U if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -7127,8 +8656,9 @@ public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, U String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -7142,7 +8672,7 @@ public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, U * @return TrackingOptions * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { + public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7159,7 +8689,7 @@ public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingC * @return TrackingOptions * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, Map params) throws IOException { + public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, Map params) throws IOException { HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7176,20 +8706,30 @@ public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UU if (trackingOptionID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); uriVariables.put("TrackingOptionID", trackingOptionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -7205,11 +8745,26 @@ public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UU if (trackingOptionID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); uriVariables.put("TrackingOptionID", trackingOptionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -7232,8 +8787,9 @@ public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UU String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -7275,19 +8831,29 @@ public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoic if (requestEmpty == null) { throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Email"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Email"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -7303,10 +8869,25 @@ public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoic if (requestEmpty == null) { throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Email"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Email"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -7314,10 +8895,6 @@ public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoic HttpContent content = requestEmpty == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, requestEmpty); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -7333,10 +8910,25 @@ public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoic if (requestEmpty == null) { throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Email"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Email"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Email"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -7359,8 +8951,9 @@ public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoic String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -7372,7 +8965,7 @@ public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoic * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccount(String xeroTenantId, UUID accountID) throws IOException { + public Accounts getAccount(String xeroTenantId, UUID accountID) throws IOException { HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7387,7 +8980,7 @@ public Accounts getAccount(String xeroTenantId, UUID accountID) throws IOExcepti * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { + public Accounts getAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7401,19 +8994,29 @@ public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountI if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7426,10 +9029,25 @@ public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountI if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -7452,8 +9070,9 @@ public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7467,10 +9086,18 @@ public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountI * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { + public ByteArrayInputStream getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -7484,10 +9111,18 @@ public File getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType, Map params) throws IOException { + public ByteArrayInputStream getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType, Map params) throws IOException { HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { @@ -7504,20 +9139,30 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTen if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7536,11 +9181,26 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTen if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -7563,8 +9223,9 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTen String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7578,10 +9239,18 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTen * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { + public ByteArrayInputStream getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -7595,10 +9264,18 @@ public File getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID a * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType, Map params) throws IOException { + public ByteArrayInputStream getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType, Map params) throws IOException { HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { @@ -7615,20 +9292,30 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7647,11 +9334,26 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -7674,8 +9376,9 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7687,7 +9390,7 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) throws IOException { + public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) throws IOException { HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7702,7 +9405,7 @@ public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) th * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getAccountAttachments(String xeroTenantId, UUID accountID, Map params) throws IOException { + public Attachments getAccountAttachments(String xeroTenantId, UUID accountID, Map params) throws IOException { HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7716,19 +9419,29 @@ public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UU if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7741,10 +9454,25 @@ public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UU if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -7767,8 +9495,9 @@ public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UU String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7782,7 +9511,7 @@ public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UU * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { HttpResponse response = getAccountsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7796,7 +9525,7 @@ public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccounts(String xeroTenantId, Map params) throws IOException { + public Accounts getAccounts(String xeroTenantId, Map params) throws IOException { HttpResponse response = getAccountsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7807,7 +9536,13 @@ public HttpResponse getAccountsForHttpResponse(String xeroTenantId, OffsetDateTi if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -7834,10 +9569,6 @@ public HttpResponse getAccountsForHttpResponse(String xeroTenantId, OffsetDateTi GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7847,7 +9578,13 @@ public HttpResponse getAccountsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -7870,8 +9607,9 @@ public HttpResponse getAccountsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7898,7 +9636,7 @@ public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransac * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -7912,19 +9650,29 @@ public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7937,10 +9685,25 @@ public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -7963,8 +9726,9 @@ public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7978,10 +9742,18 @@ public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { + public ByteArrayInputStream getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -7995,10 +9767,18 @@ public File getBankTransactionAttachmentByFileName(String xeroTenantId, UUID ban * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType, Map params) throws IOException { + public ByteArrayInputStream getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType, Map params) throws IOException { HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { @@ -8015,20 +9795,30 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8047,11 +9837,26 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -8074,8 +9879,9 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8089,10 +9895,18 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { + public ByteArrayInputStream getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -8106,10 +9920,18 @@ public File getBankTransactionAttachmentById(String xeroTenantId, UUID bankTrans * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType, Map params) throws IOException { + public ByteArrayInputStream getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType, Map params) throws IOException { HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { @@ -8126,20 +9948,30 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroT if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8158,11 +9990,26 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroT if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -8185,8 +10032,9 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroT String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8198,7 +10046,7 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroT * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID) throws IOException { + public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID) throws IOException { HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8213,7 +10061,7 @@ public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankT * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8227,19 +10075,29 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTena if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8252,10 +10110,25 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTena if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -8278,8 +10151,9 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTena String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8295,7 +10169,7 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTena * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8309,7 +10183,7 @@ public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions getBankTransactions(String xeroTenantId, Map params) throws IOException { + public BankTransactions getBankTransactions(String xeroTenantId, Map params) throws IOException { HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8320,7 +10194,13 @@ public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Offs if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -8367,10 +10247,6 @@ public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Offs GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8380,7 +10256,13 @@ public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Map< if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -8403,8 +10285,9 @@ public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Map< String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8416,7 +10299,7 @@ public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Map< * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID) throws IOException { + public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID) throws IOException { HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8431,7 +10314,7 @@ public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankT * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8445,19 +10328,29 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantI if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8470,10 +10363,25 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantI if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -8496,8 +10404,9 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8509,7 +10418,7 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantI * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) throws IOException { + public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) throws IOException { HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8524,7 +10433,7 @@ public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) t * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8538,19 +10447,29 @@ public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID ban if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8563,10 +10482,25 @@ public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID ban if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -8589,8 +10523,9 @@ public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID ban String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8604,10 +10539,18 @@ public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID ban * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { + public ByteArrayInputStream getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -8621,10 +10564,18 @@ public File getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTr * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType, Map params) throws IOException { + public ByteArrayInputStream getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType, Map params) throws IOException { HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { @@ -8641,20 +10592,30 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xe if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8673,11 +10634,26 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xe if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -8700,8 +10676,9 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xe String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8715,10 +10692,18 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xe * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { + public ByteArrayInputStream getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -8732,10 +10717,18 @@ public File getBankTransferAttachmentById(String xeroTenantId, UUID bankTransfer * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType, Map params) throws IOException { + public ByteArrayInputStream getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType, Map params) throws IOException { HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { @@ -8752,20 +10745,30 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTena if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8784,11 +10787,26 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTena if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -8811,8 +10829,9 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTena String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8824,7 +10843,7 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTena * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID) throws IOException { + public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID) throws IOException { HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8839,7 +10858,7 @@ public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTran * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8853,19 +10872,29 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantI if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8878,10 +10907,25 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantI if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -8904,8 +10948,9 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8917,7 +10962,7 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantI * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID) throws IOException { + public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID) throws IOException { HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8932,7 +10977,7 @@ public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTrans * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -8946,19 +10991,29 @@ public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, U if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8971,10 +11026,25 @@ public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, U if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -8997,8 +11067,9 @@ public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, U String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9012,7 +11083,7 @@ public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, U * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9026,7 +11097,7 @@ public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModi * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfers(String xeroTenantId, Map params) throws IOException { + public BankTransfers getBankTransfers(String xeroTenantId, Map params) throws IOException { HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9037,7 +11108,13 @@ public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, OffsetD if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -9064,10 +11141,6 @@ public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, OffsetD GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9077,7 +11150,13 @@ public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -9100,8 +11179,9 @@ public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9128,7 +11208,7 @@ public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaym * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID, Map params) throws IOException { + public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID, Map params) throws IOException { HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9142,19 +11222,29 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, U if (batchPaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BatchPayments/{BatchPaymentID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BatchPayments/{BatchPaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BatchPaymentID", batchPaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9167,10 +11257,25 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, U if (batchPaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BatchPayments/{BatchPaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BatchPayments/{BatchPaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BatchPaymentID", batchPaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments/{BatchPaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -9193,8 +11298,9 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, U String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9208,7 +11314,7 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, U * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9222,7 +11328,7 @@ public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModi * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public BatchPayments getBatchPayments(String xeroTenantId, Map params) throws IOException { + public BatchPayments getBatchPayments(String xeroTenantId, Map params) throws IOException { HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9233,7 +11339,13 @@ public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, OffsetD if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BatchPayments"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -9260,10 +11372,6 @@ public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, OffsetD GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9273,7 +11381,13 @@ public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -9296,8 +11410,9 @@ public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9324,7 +11439,7 @@ public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID * @return BrandingThemes * @throws IOException if an error occurs while attempting to invoke the API **/ - public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9338,19 +11453,29 @@ public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID br if (brandingThemeID == null) { throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BrandingThemes/{BrandingThemeID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BrandingThemes/{BrandingThemeID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9363,10 +11488,25 @@ public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID br if (brandingThemeID == null) { throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BrandingThemes/{BrandingThemeID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BrandingThemes/{BrandingThemeID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -9389,8 +11529,9 @@ public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID br String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9402,7 +11543,7 @@ public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID br * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID) throws IOException { + public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID) throws IOException { HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9417,7 +11558,7 @@ public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9431,19 +11572,29 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTe if (brandingThemeID == null) { throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9456,10 +11607,25 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTe if (brandingThemeID == null) { throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes/{BrandingThemeID}/PaymentServices"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -9482,8 +11648,9 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTe String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9494,7 +11661,7 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTe * @return BrandingThemes * @throws IOException if an error occurs while attempting to invoke the API **/ - public BrandingThemes getBrandingThemes(String xeroTenantId) throws IOException { + public BrandingThemes getBrandingThemes(String xeroTenantId) throws IOException { HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9508,7 +11675,7 @@ public BrandingThemes getBrandingThemes(String xeroTenantId) throws IOException * @return BrandingThemes * @throws IOException if an error occurs while attempting to invoke the API **/ - public BrandingThemes getBrandingThemes(String xeroTenantId, Map params) throws IOException { + public BrandingThemes getBrandingThemes(String xeroTenantId, Map params) throws IOException { HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9519,16 +11686,18 @@ public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId) throws if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BrandingThemes"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9538,7 +11707,13 @@ public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -9561,8 +11736,9 @@ public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9589,7 +11765,7 @@ public Contacts getContact(String xeroTenantId, UUID contactID) throws IOExcepti * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContact(String xeroTenantId, UUID contactID, Map params) throws IOException { + public Contacts getContact(String xeroTenantId, UUID contactID, Map params) throws IOException { HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9603,19 +11779,29 @@ public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactI if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9628,10 +11814,25 @@ public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactI if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -9654,8 +11855,9 @@ public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9669,10 +11871,18 @@ public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactI * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { + public ByteArrayInputStream getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -9686,10 +11896,18 @@ public File getContactAttachmentByFileName(String xeroTenantId, UUID contactID, * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType, Map params) throws IOException { + public ByteArrayInputStream getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType, Map params) throws IOException { HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { @@ -9706,20 +11924,30 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTen if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9738,11 +11966,26 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTen if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -9765,8 +12008,9 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTen String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9780,10 +12024,18 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTen * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { + public ByteArrayInputStream getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -9797,10 +12049,18 @@ public File getContactAttachmentById(String xeroTenantId, UUID contactID, UUID a * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType, Map params) throws IOException { + public ByteArrayInputStream getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType, Map params) throws IOException { HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { @@ -9817,20 +12077,30 @@ public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9849,11 +12119,26 @@ public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -9876,8 +12161,9 @@ public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9889,7 +12175,7 @@ public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getContactAttachments(String xeroTenantId, UUID contactID) throws IOException { + public Attachments getContactAttachments(String xeroTenantId, UUID contactID) throws IOException { HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9904,7 +12190,7 @@ public Attachments getContactAttachments(String xeroTenantId, UUID contactID) th * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getContactAttachments(String xeroTenantId, UUID contactID, Map params) throws IOException { + public Attachments getContactAttachments(String xeroTenantId, UUID contactID, Map params) throws IOException { HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9918,19 +12204,29 @@ public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UU if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9943,10 +12239,25 @@ public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UU if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -9969,8 +12280,9 @@ public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UU String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9982,7 +12294,7 @@ public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UU * @return CISSettings * @throws IOException if an error occurs while attempting to invoke the API **/ - public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) throws IOException { + public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) throws IOException { HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -9997,7 +12309,7 @@ public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) th * @return CISSettings * @throws IOException if an error occurs while attempting to invoke the API **/ - public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID, Map params) throws IOException { + public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID, Map params) throws IOException { HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10011,19 +12323,29 @@ public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UU if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/CISSettings"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/CISSettings"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/CISSettings"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10036,10 +12358,25 @@ public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UU if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/CISSettings"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/CISSettings"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/CISSettings"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -10062,8 +12399,9 @@ public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UU String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10075,7 +12413,7 @@ public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UU * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) throws IOException { + public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) throws IOException { HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10090,7 +12428,7 @@ public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) t * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { + public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10104,19 +12442,29 @@ public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID con if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10129,10 +12477,25 @@ public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID con if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -10155,8 +12518,9 @@ public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID con String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10169,7 +12533,7 @@ public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID con * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroups(String xeroTenantId, String where, String order) throws IOException { + public ContactGroups getContactGroups(String xeroTenantId, String where, String order) throws IOException { HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10183,7 +12547,7 @@ public ContactGroups getContactGroups(String xeroTenantId, String where, String * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroups(String xeroTenantId, Map params) throws IOException { + public ContactGroups getContactGroups(String xeroTenantId, Map params) throws IOException { HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10194,7 +12558,13 @@ public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, String if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -10221,10 +12591,6 @@ public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, String GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10234,7 +12600,13 @@ public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -10257,8 +12629,9 @@ public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10285,7 +12658,7 @@ public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID) thr * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID, Map params) throws IOException { + public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID, Map params) throws IOException { HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10299,19 +12672,29 @@ public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID c if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10324,10 +12707,25 @@ public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID c if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); } - // create a map of path variables + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -10350,8 +12748,9 @@ public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID c String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10368,7 +12767,7 @@ public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID c * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { HttpResponse response = getContactsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, page, includeArchived); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10382,7 +12781,7 @@ public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContacts(String xeroTenantId, Map params) throws IOException { + public Contacts getContacts(String xeroTenantId, Map params) throws IOException { HttpResponse response = getContactsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10393,7 +12792,13 @@ public HttpResponse getContactsForHttpResponse(String xeroTenantId, OffsetDateTi if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -10450,10 +12855,6 @@ public HttpResponse getContactsForHttpResponse(String xeroTenantId, OffsetDateTi GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10463,7 +12864,13 @@ public HttpResponse getContactsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -10486,8 +12893,9 @@ public HttpResponse getContactsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10514,7 +12922,7 @@ public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID) throws * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10528,19 +12936,29 @@ public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID credi if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10553,10 +12971,25 @@ public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID credi if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -10579,8 +13012,9 @@ public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID credi String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10593,10 +13027,18 @@ public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID credi * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { + public ByteArrayInputStream getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -10609,10 +13051,18 @@ public File getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String co * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType, Map params) throws IOException { + public ByteArrayInputStream getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType, Map params) throws IOException { HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { @@ -10626,19 +13076,29 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/pdf"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/pdf"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/pdf"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10654,10 +13114,25 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/pdf"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/pdf"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/pdf"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -10680,8 +13155,9 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10695,10 +13171,18 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { + public ByteArrayInputStream getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -10712,10 +13196,18 @@ public File getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNo * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType, Map params) throws IOException { + public ByteArrayInputStream getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType, Map params) throws IOException { HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { @@ -10732,20 +13224,30 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xero if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10764,11 +13266,26 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xero if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -10791,8 +13308,9 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10806,10 +13324,18 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xero * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { + public ByteArrayInputStream getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -10823,10 +13349,18 @@ public File getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType, Map params) throws IOException { + public ByteArrayInputStream getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType, Map params) throws IOException { HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { @@ -10843,20 +13377,30 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenant if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10875,11 +13419,26 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenant if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -10902,8 +13461,9 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenant String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10915,7 +13475,7 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenant * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID) throws IOException { + public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID) throws IOException { HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10930,7 +13490,7 @@ public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNote * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -10944,19 +13504,29 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -10969,10 +13539,25 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -10995,8 +13580,9 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11008,7 +13594,7 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID) throws IOException { + public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID) throws IOException { HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11023,7 +13609,7 @@ public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteI * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11037,19 +13623,29 @@ public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUI if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11062,10 +13658,25 @@ public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUI if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -11088,8 +13699,9 @@ public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11104,7 +13716,7 @@ public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUI * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11118,7 +13730,7 @@ public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModified * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNotes(String xeroTenantId, Map params) throws IOException { + public CreditNotes getCreditNotes(String xeroTenantId, Map params) throws IOException { HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11129,7 +13741,13 @@ public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, OffsetDat if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -11166,10 +13784,6 @@ public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, OffsetDat GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11179,7 +13793,13 @@ public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -11202,8 +13822,9 @@ public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11230,7 +13851,7 @@ public Currencies getCurrencies(String xeroTenantId, String where, String order) * @return Currencies * @throws IOException if an error occurs while attempting to invoke the API **/ - public Currencies getCurrencies(String xeroTenantId, Map params) throws IOException { + public Currencies getCurrencies(String xeroTenantId, Map params) throws IOException { HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11241,7 +13862,13 @@ public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, String whe if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Currencies"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -11268,10 +13895,6 @@ public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, String whe GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11281,7 +13904,13 @@ public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -11304,8 +13933,9 @@ public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11332,7 +13962,7 @@ public Employees getEmployee(String xeroTenantId, UUID employeeID) throws IOExce * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployee(String xeroTenantId, UUID employeeID, Map params) throws IOException { + public Employees getEmployee(String xeroTenantId, UUID employeeID, Map params) throws IOException { HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11346,19 +13976,29 @@ public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employe if (employeeID == null) { throw new IllegalArgumentException("Missing the required parameter 'employeeID' when calling getEmployee"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Employees/{EmployeeID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Employees/{EmployeeID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("EmployeeID", employeeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11371,10 +14011,25 @@ public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employe if (employeeID == null) { throw new IllegalArgumentException("Missing the required parameter 'employeeID' when calling getEmployee"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Employees/{EmployeeID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Employees/{EmployeeID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("EmployeeID", employeeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -11397,8 +14052,9 @@ public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employe String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11412,7 +14068,7 @@ public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employe * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11426,7 +14082,7 @@ public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSinc * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployees(String xeroTenantId, Map params) throws IOException { + public Employees getEmployees(String xeroTenantId, Map params) throws IOException { HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11437,7 +14093,13 @@ public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, OffsetDateT if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Employees"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -11464,10 +14126,6 @@ public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, OffsetDateT GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11477,7 +14135,13 @@ public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -11500,8 +14164,9 @@ public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11528,7 +14193,7 @@ public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID) t * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11542,19 +14207,29 @@ public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID exp if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ExpenseClaims/{ExpenseClaimID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11567,10 +14242,25 @@ public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID exp if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ExpenseClaims/{ExpenseClaimID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -11593,8 +14283,9 @@ public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID exp String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11606,7 +14297,7 @@ public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID exp * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID) throws IOException { + public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID) throws IOException { HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11621,7 +14312,7 @@ public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseCl * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11635,19 +14326,29 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, U if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ExpenseClaims/{ExpenseClaimID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11660,10 +14361,25 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, U if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ExpenseClaims/{ExpenseClaimID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -11686,8 +14402,9 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, U String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11701,7 +14418,7 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, U * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11715,7 +14432,7 @@ public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModi * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims getExpenseClaims(String xeroTenantId, Map params) throws IOException { + public ExpenseClaims getExpenseClaims(String xeroTenantId, Map params) throws IOException { HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11726,7 +14443,13 @@ public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, OffsetD if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -11753,10 +14476,6 @@ public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, OffsetD GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11766,7 +14485,13 @@ public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -11789,8 +14514,9 @@ public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11817,7 +14543,7 @@ public Invoices getInvoice(String xeroTenantId, UUID invoiceID) throws IOExcepti * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices getInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + public Invoices getInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -11831,19 +14557,29 @@ public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceI if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11856,10 +14592,25 @@ public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceI if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -11882,8 +14633,9 @@ public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11896,10 +14648,18 @@ public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceI * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { + public ByteArrayInputStream getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -11912,10 +14672,18 @@ public File getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentT * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType, Map params) throws IOException { + public ByteArrayInputStream getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType, Map params) throws IOException { HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { @@ -11929,19 +14697,29 @@ public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID inv if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/pdf"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/pdf"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/pdf"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11957,10 +14735,25 @@ public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID inv if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/pdf"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/pdf"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/pdf"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -11983,8 +14776,9 @@ public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID inv String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -11998,10 +14792,18 @@ public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID inv * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { + public ByteArrayInputStream getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -12015,10 +14817,18 @@ public File getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType, Map params) throws IOException { + public ByteArrayInputStream getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType, Map params) throws IOException { HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { @@ -12035,20 +14845,30 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTen if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12067,11 +14887,26 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTen if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -12094,8 +14929,9 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTen String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12109,10 +14945,18 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTen * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { + public ByteArrayInputStream getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -12126,10 +14970,18 @@ public File getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID a * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType, Map params) throws IOException { + public ByteArrayInputStream getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType, Map params) throws IOException { HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { @@ -12146,20 +14998,30 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12178,11 +15040,26 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -12205,8 +15082,9 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12218,7 +15096,7 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) throws IOException { + public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) throws IOException { HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12233,7 +15111,7 @@ public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) th * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID, Map params) throws IOException { HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12247,19 +15125,29 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UU if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12272,10 +15160,25 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UU if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -12298,8 +15201,9 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UU String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12311,7 +15215,7 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UU * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) throws IOException { + public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) throws IOException { HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12326,7 +15230,7 @@ public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) thr * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID, Map params) throws IOException { HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12340,19 +15244,29 @@ public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID i if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12365,10 +15279,25 @@ public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID i if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -12391,8 +15320,9 @@ public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID i String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12403,7 +15333,7 @@ public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID i * @return InvoiceReminders * @throws IOException if an error occurs while attempting to invoke the API **/ - public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws IOException { + public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws IOException { HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12417,7 +15347,7 @@ public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws IOExcept * @return InvoiceReminders * @throws IOException if an error occurs while attempting to invoke the API **/ - public InvoiceReminders getInvoiceReminders(String xeroTenantId, Map params) throws IOException { + public InvoiceReminders getInvoiceReminders(String xeroTenantId, Map params) throws IOException { HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12428,16 +15358,18 @@ public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId) thro if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/InvoiceReminders/Settings"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/InvoiceReminders/Settings"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12447,7 +15379,13 @@ public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId, Map< if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/InvoiceReminders/Settings"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/InvoiceReminders/Settings"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -12470,8 +15408,9 @@ public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId, Map< String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12493,7 +15432,7 @@ public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId, Map< * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12507,7 +15446,7 @@ public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices getInvoices(String xeroTenantId, Map params) throws IOException { + public Invoices getInvoices(String xeroTenantId, Map params) throws IOException { HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12518,7 +15457,13 @@ public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, OffsetDateTi if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -12625,10 +15570,6 @@ public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, OffsetDateTi GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12638,7 +15579,13 @@ public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -12661,8 +15608,9 @@ public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12689,7 +15637,7 @@ public Items getItem(String xeroTenantId, UUID itemID) throws IOException { * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items getItem(String xeroTenantId, UUID itemID, Map params) throws IOException { + public Items getItem(String xeroTenantId, UUID itemID, Map params) throws IOException { HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12703,19 +15651,29 @@ public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID) thr if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12728,10 +15686,25 @@ public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID, Map if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -12754,8 +15727,9 @@ public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID, Map String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12767,7 +15741,7 @@ public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID, Map * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws IOException { + public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws IOException { HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12782,7 +15756,7 @@ public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws IO * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID, Map params) throws IOException { + public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID, Map params) throws IOException { HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12796,19 +15770,29 @@ public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID item if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12821,10 +15805,25 @@ public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID item if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -12847,8 +15846,9 @@ public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID item String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12863,7 +15863,7 @@ public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID item * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { HttpResponse response = getItemsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12877,7 +15877,7 @@ public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, Strin * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items getItems(String xeroTenantId, Map params) throws IOException { + public Items getItems(String xeroTenantId, Map params) throws IOException { HttpResponse response = getItemsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12888,7 +15888,13 @@ public HttpResponse getItemsForHttpResponse(String xeroTenantId, OffsetDateTime if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -12925,10 +15931,6 @@ public HttpResponse getItemsForHttpResponse(String xeroTenantId, OffsetDateTime GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -12938,7 +15940,13 @@ public HttpResponse getItemsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -12961,8 +15969,9 @@ public HttpResponse getItemsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -12989,7 +15998,7 @@ public Journals getJournal(String xeroTenantId, UUID journalID) throws IOExcepti * @return Journals * @throws IOException if an error occurs while attempting to invoke the API **/ - public Journals getJournal(String xeroTenantId, UUID journalID, Map params) throws IOException { + public Journals getJournal(String xeroTenantId, UUID journalID, Map params) throws IOException { HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13003,19 +16012,29 @@ public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalI if (journalID == null) { throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Journals/{JournalID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Journals/{JournalID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("JournalID", journalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals/{JournalID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13028,10 +16047,25 @@ public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalI if (journalID == null) { throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Journals/{JournalID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Journals/{JournalID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("JournalID", journalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals/{JournalID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -13054,8 +16088,9 @@ public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13069,7 +16104,7 @@ public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalI * @return Journals * @throws IOException if an error occurs while attempting to invoke the API **/ - public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { + public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { HttpResponse response = getJournalsForHttpResponse(xeroTenantId, ifModifiedSince, offset, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13083,7 +16118,7 @@ public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, * @return Journals * @throws IOException if an error occurs while attempting to invoke the API **/ - public Journals getJournals(String xeroTenantId, Map params) throws IOException { + public Journals getJournals(String xeroTenantId, Map params) throws IOException { HttpResponse response = getJournalsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13094,7 +16129,13 @@ public HttpResponse getJournalsForHttpResponse(String xeroTenantId, OffsetDateTi if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Journals"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (offset != null) { String key = "offset"; Object value = offset; @@ -13121,10 +16162,6 @@ public HttpResponse getJournalsForHttpResponse(String xeroTenantId, OffsetDateTi GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13134,7 +16171,13 @@ public HttpResponse getJournalsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -13157,8 +16200,9 @@ public HttpResponse getJournalsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13185,7 +16229,7 @@ public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedT * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { + public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13199,19 +16243,29 @@ public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUI if (linkedTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/LinkedTransactions/{LinkedTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13224,10 +16278,25 @@ public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUI if (linkedTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/LinkedTransactions/{LinkedTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -13250,8 +16319,9 @@ public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13268,7 +16338,7 @@ public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUI * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { + public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13282,7 +16352,7 @@ public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer pag * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions getLinkedTransactions(String xeroTenantId, Map params) throws IOException { + public LinkedTransactions getLinkedTransactions(String xeroTenantId, Map params) throws IOException { HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13293,7 +16363,13 @@ public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, In if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (page != null) { String key = "page"; Object value = page; @@ -13360,10 +16436,6 @@ public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, In GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13373,7 +16445,13 @@ public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Ma if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -13396,8 +16474,9 @@ public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Ma String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13409,7 +16488,7 @@ public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Ma * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID) throws IOException { + public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID) throws IOException { HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13424,7 +16503,7 @@ public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { + public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13438,19 +16517,29 @@ public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID ma if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13463,10 +16552,25 @@ public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID ma if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -13489,8 +16593,9 @@ public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID ma String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13504,10 +16609,18 @@ public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID ma * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { + public ByteArrayInputStream getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -13521,10 +16634,18 @@ public File getManualJournalAttachmentByFileName(String xeroTenantId, UUID manua * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType, Map params) throws IOException { + public ByteArrayInputStream getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType, Map params) throws IOException { HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { @@ -13541,20 +16662,30 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String x if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13573,11 +16704,26 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String x if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -13600,8 +16746,9 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String x String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13615,10 +16762,18 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String x * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { + public ByteArrayInputStream getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -13632,10 +16787,18 @@ public File getManualJournalAttachmentById(String xeroTenantId, UUID manualJourn * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType, Map params) throws IOException { + public ByteArrayInputStream getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType, Map params) throws IOException { HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { @@ -13652,20 +16815,30 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTen if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13684,11 +16857,26 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTen if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -13711,8 +16899,9 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTen String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13724,7 +16913,7 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTen * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID) throws IOException { + public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID) throws IOException { HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13739,7 +16928,7 @@ public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJ * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { + public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13753,19 +16942,29 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenant if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13778,10 +16977,25 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenant if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -13804,8 +17018,9 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenant String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13820,7 +17035,7 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenant * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13834,7 +17049,7 @@ public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifMo * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals getManualJournals(String xeroTenantId, Map params) throws IOException { + public ManualJournals getManualJournals(String xeroTenantId, Map params) throws IOException { HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13845,7 +17060,13 @@ public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, Offset if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -13882,10 +17103,6 @@ public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, Offset GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13895,7 +17112,13 @@ public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -13918,8 +17141,9 @@ public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13946,7 +17170,7 @@ public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID) thro * @return OnlineInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { + public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -13960,19 +17184,29 @@ public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID in if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/OnlineInvoice"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/OnlineInvoice"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/OnlineInvoice"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -13985,10 +17219,25 @@ public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID in if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/OnlineInvoice"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/OnlineInvoice"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/OnlineInvoice"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -14011,8 +17260,9 @@ public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID in String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14024,7 +17274,7 @@ public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID in * @return CISOrgSetting * @throws IOException if an error occurs while attempting to invoke the API **/ - public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID) throws IOException { + public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID) throws IOException { HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14039,7 +17289,7 @@ public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organi * @return CISOrgSetting * @throws IOException if an error occurs while attempting to invoke the API **/ - public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID, Map params) throws IOException { + public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID, Map params) throws IOException { HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14053,19 +17303,29 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantI if (organisationID == null) { throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Organisation/{OrganisationID}/CISSettings"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Organisation/{OrganisationID}/CISSettings"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OrganisationID", organisationID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation/{OrganisationID}/CISSettings"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14078,10 +17338,25 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantI if (organisationID == null) { throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Organisation/{OrganisationID}/CISSettings"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Organisation/{OrganisationID}/CISSettings"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OrganisationID", organisationID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation/{OrganisationID}/CISSettings"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -14104,8 +17379,9 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14116,7 +17392,7 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantI * @return Organisations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Organisations getOrganisations(String xeroTenantId) throws IOException { + public Organisations getOrganisations(String xeroTenantId) throws IOException { HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14130,7 +17406,7 @@ public Organisations getOrganisations(String xeroTenantId) throws IOException { * @return Organisations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Organisations getOrganisations(String xeroTenantId, Map params) throws IOException { + public Organisations getOrganisations(String xeroTenantId, Map params) throws IOException { HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14141,16 +17417,18 @@ public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId) throws if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Organisation"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14160,7 +17438,13 @@ public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -14183,8 +17467,9 @@ public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14211,7 +17496,7 @@ public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID) thro * @return Overpayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { + public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14225,19 +17510,29 @@ public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID over if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Overpayments/{OverpaymentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Overpayments/{OverpaymentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14250,10 +17545,25 @@ public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID over if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Overpayments/{OverpaymentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Overpayments/{OverpaymentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -14276,8 +17586,9 @@ public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID over String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14289,7 +17600,7 @@ public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID over * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID) throws IOException { + public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID) throws IOException { HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14304,7 +17615,7 @@ public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymen * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { + public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14318,19 +17629,29 @@ public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UU if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Overpayments/{OverpaymentID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Overpayments/{OverpaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14343,10 +17664,25 @@ public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UU if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Overpayments/{OverpaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Overpayments/{OverpaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments/{OverpaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -14369,8 +17705,9 @@ public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UU String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14386,7 +17723,7 @@ public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UU * @return Overpayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14400,7 +17737,7 @@ public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifi * @return Overpayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Overpayments getOverpayments(String xeroTenantId, Map params) throws IOException { + public Overpayments getOverpayments(String xeroTenantId, Map params) throws IOException { HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14411,7 +17748,13 @@ public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, OffsetDa if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Overpayments"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -14458,10 +17801,6 @@ public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, OffsetDa GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14471,7 +17810,13 @@ public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -14494,8 +17839,9 @@ public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14522,7 +17868,7 @@ public Payments getPayment(String xeroTenantId, UUID paymentID) throws IOExcepti * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments getPayment(String xeroTenantId, UUID paymentID, Map params) throws IOException { + public Payments getPayment(String xeroTenantId, UUID paymentID, Map params) throws IOException { HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14536,19 +17882,29 @@ public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentI if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments/{PaymentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Payments/{PaymentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14561,10 +17917,25 @@ public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentI if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments/{PaymentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Payments/{PaymentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -14587,8 +17958,9 @@ public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14600,7 +17972,7 @@ public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentI * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) throws IOException { + public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) throws IOException { HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14615,7 +17987,7 @@ public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) thr * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID, Map params) throws IOException { + public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID, Map params) throws IOException { HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14629,19 +18001,29 @@ public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID p if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments/{PaymentID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Payments/{PaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14654,10 +18036,25 @@ public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID p if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments/{PaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Payments/{PaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments/{PaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -14680,8 +18077,9 @@ public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID p String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14692,7 +18090,7 @@ public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID p * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices getPaymentServices(String xeroTenantId) throws IOException { + public PaymentServices getPaymentServices(String xeroTenantId) throws IOException { HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14706,7 +18104,7 @@ public PaymentServices getPaymentServices(String xeroTenantId) throws IOExceptio * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices getPaymentServices(String xeroTenantId, Map params) throws IOException { + public PaymentServices getPaymentServices(String xeroTenantId, Map params) throws IOException { HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14717,16 +18115,18 @@ public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId) throw if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PaymentServices"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14736,7 +18136,13 @@ public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -14759,8 +18165,9 @@ public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14788,7 +18195,7 @@ public Payments getPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments getPayments(String xeroTenantId, Map params) throws IOException { + public Payments getPayments(String xeroTenantId, Map params) throws IOException { HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14799,7 +18206,13 @@ public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, OffsetDateTi if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Payments"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -14826,10 +18239,6 @@ public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, OffsetDateTi GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14839,7 +18248,13 @@ public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -14862,8 +18277,9 @@ public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14890,7 +18306,7 @@ public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID) throws * @return Prepayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { + public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14904,19 +18320,29 @@ public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepa if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Prepayments/{PrepaymentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Prepayments/{PrepaymentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14929,10 +18355,25 @@ public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepa if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Prepayments/{PrepaymentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Prepayments/{PrepaymentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -14955,8 +18396,9 @@ public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepa String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -14968,7 +18410,7 @@ public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepa * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID) throws IOException { + public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID) throws IOException { HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14983,7 +18425,7 @@ public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentI * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { + public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -14997,19 +18439,29 @@ public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUI if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Prepayments/{PrepaymentID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Prepayments/{PrepaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15022,10 +18474,25 @@ public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUI if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Prepayments/{PrepaymentID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Prepayments/{PrepaymentID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments/{PrepaymentID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -15048,8 +18515,9 @@ public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15065,7 +18533,7 @@ public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUI * @return Prepayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15079,7 +18547,7 @@ public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModified * @return Prepayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Prepayments getPrepayments(String xeroTenantId, Map params) throws IOException { + public Prepayments getPrepayments(String xeroTenantId, Map params) throws IOException { HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15090,7 +18558,13 @@ public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, OffsetDat if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Prepayments"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -15137,10 +18611,6 @@ public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, OffsetDat GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15150,7 +18620,13 @@ public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -15173,8 +18649,9 @@ public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15201,7 +18678,7 @@ public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { + public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15215,19 +18692,29 @@ public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID pu if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/PurchaseOrders/{PurchaseOrderID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15240,10 +18727,25 @@ public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID pu if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/PurchaseOrders/{PurchaseOrderID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -15266,8 +18768,9 @@ public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID pu String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15279,7 +18782,7 @@ public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID pu * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID) throws IOException { + public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID) throws IOException { HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15294,7 +18797,7 @@ public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchase * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { + public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15308,19 +18811,29 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/PurchaseOrders/{PurchaseOrderID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15333,10 +18846,25 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/PurchaseOrders/{PurchaseOrderID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -15359,8 +18887,9 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15377,7 +18906,7 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { + public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15391,7 +18920,7 @@ public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifMo * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders getPurchaseOrders(String xeroTenantId, Map params) throws IOException { + public PurchaseOrders getPurchaseOrders(String xeroTenantId, Map params) throws IOException { HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15402,7 +18931,13 @@ public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, Offset if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (status != null) { String key = "Status"; Object value = status; @@ -15459,10 +18994,6 @@ public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, Offset GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15472,7 +19003,13 @@ public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -15495,8 +19032,9 @@ public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15523,7 +19061,7 @@ public Receipts getReceipt(String xeroTenantId, UUID receiptID) throws IOExcepti * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts getReceipt(String xeroTenantId, UUID receiptID, Map params) throws IOException { + public Receipts getReceipt(String xeroTenantId, UUID receiptID, Map params) throws IOException { HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15537,19 +19075,29 @@ public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptI if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15562,10 +19110,25 @@ public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptI if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -15588,8 +19151,9 @@ public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15603,10 +19167,18 @@ public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptI * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { + public ByteArrayInputStream getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -15620,10 +19192,18 @@ public File getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType, Map params) throws IOException { + public ByteArrayInputStream getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType, Map params) throws IOException { HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { @@ -15640,20 +19220,30 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTen if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15672,11 +19262,26 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTen if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -15699,8 +19304,9 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTen String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15714,11 +19320,19 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTen * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { + public ByteArrayInputStream getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + + } /** * Allows you to retrieve Attachments on expense claim receipts by ID @@ -15731,10 +19345,18 @@ public File getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID a * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType, Map params) throws IOException { + public ByteArrayInputStream getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType, Map params) throws IOException { HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { @@ -15751,20 +19373,30 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15783,11 +19415,26 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -15810,8 +19457,9 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15823,7 +19471,7 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) throws IOException { + public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) throws IOException { HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15838,7 +19486,7 @@ public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) th * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID, Map params) throws IOException { + public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID, Map params) throws IOException { HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15852,19 +19500,29 @@ public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UU if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15877,10 +19535,25 @@ public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UU if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -15903,8 +19576,9 @@ public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UU String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15916,7 +19590,7 @@ public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UU * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) throws IOException { + public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) throws IOException { HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15931,7 +19605,7 @@ public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) thr * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID, Map params) throws IOException { + public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID, Map params) throws IOException { HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -15945,19 +19619,29 @@ public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID r if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -15970,10 +19654,25 @@ public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID r if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -15996,8 +19695,9 @@ public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID r String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16012,7 +19712,7 @@ public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID r * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16026,7 +19726,7 @@ public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts getReceipts(String xeroTenantId, Map params) throws IOException { + public Receipts getReceipts(String xeroTenantId, Map params) throws IOException { HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16037,7 +19737,13 @@ public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, OffsetDateTi if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -16074,10 +19780,6 @@ public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, OffsetDateTi GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16087,7 +19789,13 @@ public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -16110,8 +19818,9 @@ public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16138,7 +19847,7 @@ public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeating * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16152,19 +19861,29 @@ public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16177,10 +19896,25 @@ public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -16203,8 +19937,9 @@ public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16218,10 +19953,18 @@ public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { + public ByteArrayInputStream getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -16235,10 +19978,18 @@ public File getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID re * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType, Map params) throws IOException { + public ByteArrayInputStream getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType, Map params) throws IOException { HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { @@ -16255,20 +20006,30 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(Strin if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16287,11 +20048,26 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(Strin if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -16314,8 +20090,9 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(Strin String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16329,10 +20106,18 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(Strin * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { + public ByteArrayInputStream getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } /** @@ -16346,10 +20131,18 @@ public File getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatin * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public File getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType, Map params) throws IOException { + public ByteArrayInputStream getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType, Map params) throws IOException { HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + InputStream is = response.getContent(); + byte[] bytes = IOUtils.toByteArray(is); + try { + // Process the input stream.. + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return byteArrayInputStream; + } finally { + is.close(); + } + } public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { @@ -16366,20 +20159,30 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xero if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16398,11 +20201,26 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xero if (contentType == null) { throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); uriVariables.put("AttachmentID", attachmentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -16425,8 +20243,9 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16438,7 +20257,7 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xero * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16453,7 +20272,7 @@ public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repe * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16467,19 +20286,29 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTen if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16492,10 +20321,25 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTen if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -16518,8 +20362,9 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTen String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16531,7 +20376,7 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTen * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16546,7 +20391,7 @@ public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repea * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { + public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16560,19 +20405,29 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantI if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16585,10 +20440,25 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantI if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -16611,8 +20481,9 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16625,7 +20496,7 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantI * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, String order) throws IOException { + public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, String order) throws IOException { HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16639,7 +20510,7 @@ public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, Map params) throws IOException { + public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, Map params) throws IOException { HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16650,7 +20521,13 @@ public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, Str if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -16677,10 +20554,6 @@ public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, Str GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16690,7 +20563,13 @@ public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, Map if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -16713,8 +20592,9 @@ public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, Map String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16729,7 +20609,7 @@ public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, Map * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16744,7 +20624,7 @@ public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID c * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { + public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16758,7 +20638,13 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTen if (contactId == null) { throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedPayablesByContact"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/AgedPayablesByContact"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (contactId != null) { String key = "contactId"; Object value = contactId; @@ -16805,10 +20691,6 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTen GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16821,7 +20703,13 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTen if (contactId == null) { throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedPayablesByContact"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/AgedPayablesByContact"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -16846,8 +20734,9 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTen String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16862,7 +20751,7 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTen * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16877,7 +20766,7 @@ public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUI * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { + public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -16891,7 +20780,13 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xero if (contactId == null) { throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedReceivablesByContact"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/AgedReceivablesByContact"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (contactId != null) { String key = "contactId"; Object value = contactId; @@ -16938,10 +20833,6 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xero GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16954,7 +20845,13 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xero if (contactId == null) { throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedReceivablesByContact"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/AgedReceivablesByContact"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -16979,8 +20876,9 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xero String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -16992,7 +20890,7 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xero * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) throws IOException { + public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) throws IOException { HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17007,7 +20905,7 @@ public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) th * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID, Map params) throws IOException { + public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID, Map params) throws IOException { HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17021,19 +20919,29 @@ public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String if (reportID == null) { throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/{ReportID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Reports/{ReportID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReportID", reportID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/{ReportID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17046,10 +20954,25 @@ public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String if (reportID == null) { throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/{ReportID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Reports/{ReportID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReportID", reportID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/{ReportID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -17072,9 +20995,10 @@ public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); - } + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } /** @@ -17084,7 +21008,7 @@ public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws IOException { + public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws IOException { HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17098,7 +21022,7 @@ public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws IOExcept * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBASorGSTList(String xeroTenantId, Map params) throws IOException { + public ReportWithRows getReportBASorGSTList(String xeroTenantId, Map params) throws IOException { HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17109,16 +21033,18 @@ public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId) th if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17128,7 +21054,13 @@ public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId, Ma if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -17151,8 +21083,9 @@ public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId, Ma String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17170,7 +21103,7 @@ public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId, Ma * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17184,7 +21117,7 @@ public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, In * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBalanceSheet(String xeroTenantId, Map params) throws IOException { + public ReportWithRows getReportBalanceSheet(String xeroTenantId, Map params) throws IOException { HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17195,7 +21128,13 @@ public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, St if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BalanceSheet"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/BalanceSheet"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { String key = "date"; Object value = date; @@ -17272,10 +21211,6 @@ public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, St GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17285,7 +21220,13 @@ public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, Ma if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BalanceSheet"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/BalanceSheet"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -17308,8 +21249,9 @@ public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, Ma String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17323,7 +21265,7 @@ public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, Ma * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, date, period, timeframe); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17337,7 +21279,7 @@ public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBankSummary(String xeroTenantId, Map params) throws IOException { + public ReportWithRows getReportBankSummary(String xeroTenantId, Map params) throws IOException { HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17348,7 +21290,13 @@ public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, Loc if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BankSummary"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/BankSummary"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { String key = "date"; Object value = date; @@ -17385,10 +21333,6 @@ public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, Loc GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17398,7 +21342,13 @@ public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, Map if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BankSummary"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/BankSummary"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -17421,8 +21371,9 @@ public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, Map String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17436,7 +21387,7 @@ public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, Map * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, date, period, timeframe); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17450,7 +21401,7 @@ public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBudgetSummary(String xeroTenantId, Map params) throws IOException { + public ReportWithRows getReportBudgetSummary(String xeroTenantId, Map params) throws IOException { HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17461,7 +21412,13 @@ public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, L if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BudgetSummary"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/BudgetSummary"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { String key = "date"; Object value = date; @@ -17498,10 +21455,6 @@ public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, L GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17511,7 +21464,13 @@ public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, M if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BudgetSummary"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/BudgetSummary"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -17534,8 +21493,9 @@ public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, M String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17547,7 +21507,7 @@ public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, M * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate date) throws IOException { + public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate date) throws IOException { HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, date); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17561,7 +21521,7 @@ public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate d * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportExecutiveSummary(String xeroTenantId, Map params) throws IOException { + public ReportWithRows getReportExecutiveSummary(String xeroTenantId, Map params) throws IOException { HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17572,7 +21532,13 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ExecutiveSummary"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/ExecutiveSummary"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { String key = "date"; Object value = date; @@ -17589,10 +21555,6 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17602,7 +21564,13 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ExecutiveSummary"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/ExecutiveSummary"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -17625,8 +21593,9 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17647,7 +21616,7 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17661,7 +21630,7 @@ public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate from * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportProfitAndLoss(String xeroTenantId, Map params) throws IOException { + public ReportWithRows getReportProfitAndLoss(String xeroTenantId, Map params) throws IOException { HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17672,7 +21641,13 @@ public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, L if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ProfitAndLoss"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/ProfitAndLoss"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (fromDate != null) { String key = "fromDate"; Object value = fromDate; @@ -17779,10 +21754,6 @@ public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, L GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17792,7 +21763,13 @@ public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, M if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ProfitAndLoss"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/ProfitAndLoss"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -17815,8 +21792,9 @@ public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, M String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17828,7 +21806,7 @@ public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, M * @return Reports * @throws IOException if an error occurs while attempting to invoke the API **/ - public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) throws IOException { + public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) throws IOException { HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, reportYear); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17842,7 +21820,7 @@ public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) th * @return Reports * @throws IOException if an error occurs while attempting to invoke the API **/ - public Reports getReportTenNinetyNine(String xeroTenantId, Map params) throws IOException { + public Reports getReportTenNinetyNine(String xeroTenantId, Map params) throws IOException { HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17853,7 +21831,13 @@ public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, S if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TenNinetyNine"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/TenNinetyNine"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (reportYear != null) { String key = "reportYear"; Object value = reportYear; @@ -17870,10 +21854,6 @@ public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, S GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17883,7 +21863,13 @@ public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, M if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TenNinetyNine"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/TenNinetyNine"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -17906,8 +21892,9 @@ public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, M String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17920,7 +21907,7 @@ public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, M * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { + public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, date, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17934,7 +21921,7 @@ public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportTrialBalance(String xeroTenantId, Map params) throws IOException { + public ReportWithRows getReportTrialBalance(String xeroTenantId, Map params) throws IOException { HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -17945,7 +21932,13 @@ public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Lo if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TrialBalance"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/TrialBalance"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { String key = "date"; Object value = date; @@ -17972,10 +21965,6 @@ public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Lo GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -17985,7 +21974,13 @@ public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Ma if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TrialBalance"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Reports/TrialBalance"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -18008,8 +22003,9 @@ public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Ma String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -18023,7 +22019,7 @@ public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Ma * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates getTaxRates(String xeroTenantId, String where, String order, String taxType) throws IOException { + public TaxRates getTaxRates(String xeroTenantId, String where, String order, String taxType) throws IOException { HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, where, order, taxType); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18037,7 +22033,7 @@ public TaxRates getTaxRates(String xeroTenantId, String where, String order, Str * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates getTaxRates(String xeroTenantId, Map params) throws IOException { + public TaxRates getTaxRates(String xeroTenantId, Map params) throws IOException { HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18048,7 +22044,13 @@ public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, String where if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TaxRates"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -18085,10 +22087,6 @@ public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, String where GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -18098,7 +22096,13 @@ public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -18121,8 +22125,9 @@ public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18150,7 +22155,7 @@ public TrackingCategories getTrackingCategories(String xeroTenantId, String wher * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories getTrackingCategories(String xeroTenantId, Map params) throws IOException { + public TrackingCategories getTrackingCategories(String xeroTenantId, Map params) throws IOException { HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18161,7 +22166,13 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, St if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -18198,10 +22209,6 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, St GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -18211,7 +22218,13 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, Ma if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -18234,8 +22247,9 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, Ma String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -18247,7 +22261,7 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, Ma * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { + public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18262,7 +22276,7 @@ public TrackingCategories getTrackingCategory(String xeroTenantId, UUID tracking * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18276,19 +22290,29 @@ public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -18301,10 +22325,25 @@ public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -18327,8 +22366,9 @@ public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -18340,7 +22380,7 @@ public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID * @return Users * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUser(String xeroTenantId, UUID userID) throws IOException { + public Users getUser(String xeroTenantId, UUID userID) throws IOException { HttpResponse response = getUserForHttpResponse(xeroTenantId, userID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18355,7 +22395,7 @@ public Users getUser(String xeroTenantId, UUID userID) throws IOException { * @return Users * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUser(String xeroTenantId, UUID userID, Map params) throws IOException { + public Users getUser(String xeroTenantId, UUID userID, Map params) throws IOException { HttpResponse response = getUserForHttpResponse(xeroTenantId, userID, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18369,19 +22409,29 @@ public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID) thr if (userID == null) { throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Users/{UserID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Users/{UserID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("UserID", userID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users/{UserID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -18394,10 +22444,25 @@ public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID, Map if (userID == null) { throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Users/{UserID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Users/{UserID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("UserID", userID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users/{UserID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -18420,8 +22485,9 @@ public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID, Map String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); + HttpContent content = null; + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -18435,7 +22501,7 @@ public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID, Map * @return Users * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { HttpResponse response = getUsersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18449,7 +22515,7 @@ public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, Strin * @return Users * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUsers(String xeroTenantId, Map params) throws IOException { + public Users getUsers(String xeroTenantId, Map params) throws IOException { HttpResponse response = getUsersForHttpResponse(xeroTenantId, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18460,7 +22526,13 @@ public HttpResponse getUsersForHttpResponse(String xeroTenantId, OffsetDateTime if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Users"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; Object value = where; @@ -18487,10 +22559,6 @@ public HttpResponse getUsersForHttpResponse(String xeroTenantId, OffsetDateTime GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -18500,7 +22568,13 @@ public HttpResponse getUsersForHttpResponse(String xeroTenantId, Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -18523,8 +22597,9 @@ public HttpResponse getUsersForHttpResponse(String xeroTenantId, Map() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18555,7 +22630,7 @@ public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts acco * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts, Map params) throws IOException { + public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts, Map params) throws IOException { HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18572,19 +22647,29 @@ public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accou if (accounts == null) { throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -18600,10 +22685,25 @@ public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accou if (accounts == null) { throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -18611,10 +22711,6 @@ public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accou HttpContent content = accounts == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, accounts); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -18630,10 +22726,25 @@ public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accou if (accounts == null) { throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -18656,8 +22767,9 @@ public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accou String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -18672,7 +22784,7 @@ public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accou * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18690,7 +22802,7 @@ public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID a * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { + public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18710,20 +22822,33 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + + // create a map of path variables + final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -18742,11 +22867,26 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -18754,10 +22894,6 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -18776,11 +22912,29 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -18803,8 +22957,9 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -18818,7 +22973,7 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xero * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { + public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18835,7 +22990,7 @@ public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTran * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions, Map params) throws IOException { + public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions, Map params) throws IOException { HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18852,19 +23007,29 @@ public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UU if (bankTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -18880,10 +23045,25 @@ public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UU if (bankTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -18891,10 +23071,6 @@ public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UU HttpContent content = bankTransactions == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -18910,10 +23086,25 @@ public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UU if (bankTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -18936,8 +23127,9 @@ public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UU String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -18952,7 +23144,7 @@ public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UU * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18970,7 +23162,7 @@ public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { + public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -18990,20 +23182,33 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19022,11 +23227,26 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -19034,10 +23254,6 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19056,11 +23272,29 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -19083,8 +23317,9 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19098,7 +23333,7 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19115,7 +23350,7 @@ public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, U * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { + public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19135,20 +23370,33 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19167,11 +23415,26 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -19179,10 +23442,6 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19201,11 +23460,29 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -19228,8 +23505,9 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19242,7 +23520,7 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { + public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { HttpResponse response = updateContactForHttpResponse(xeroTenantId, contactID, contacts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19258,7 +23536,7 @@ public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts cont * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts, Map params) throws IOException { + public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts, Map params) throws IOException { HttpResponse response = updateContactForHttpResponse(xeroTenantId, contactID, contacts, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19275,19 +23553,29 @@ public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID conta if (contacts == null) { throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19303,10 +23591,25 @@ public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID conta if (contacts == null) { throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -19314,10 +23617,6 @@ public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID conta HttpContent content = contacts == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19333,10 +23632,25 @@ public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID conta if (contacts == null) { throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -19359,8 +23673,9 @@ public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID conta String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19374,7 +23689,7 @@ public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID conta * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19391,7 +23706,7 @@ public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID c * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { + public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19411,20 +23726,33 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19443,11 +23771,26 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -19455,10 +23798,6 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19477,11 +23816,29 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Contacts/{ContactID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -19504,8 +23861,9 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19519,7 +23877,7 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xero * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { + public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19536,7 +23894,7 @@ public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups, Map params) throws IOException { + public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups, Map params) throws IOException { HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19553,19 +23911,29 @@ public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID if (contactGroups == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19581,10 +23949,25 @@ public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID if (contactGroups == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ContactGroupID", contactGroupID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -19592,10 +23975,6 @@ public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID HttpContent content = contactGroups == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19611,10 +23990,25 @@ public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID if (contactGroups == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ContactGroups/{ContactGroupID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ContactGroups/{ContactGroupID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -19637,8 +24031,9 @@ public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19652,7 +24047,7 @@ public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { + public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { HttpResponse response = updateCreditNoteForHttpResponse(xeroTenantId, creditNoteID, creditNotes); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19669,7 +24064,7 @@ public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, Cred * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes, Map params) throws IOException { + public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes, Map params) throws IOException { HttpResponse response = updateCreditNoteForHttpResponse(xeroTenantId, creditNoteID, creditNotes, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19686,19 +24081,29 @@ public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID cr if (creditNotes == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19714,10 +24119,25 @@ public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID cr if (creditNotes == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -19725,10 +24145,6 @@ public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID cr HttpContent content = creditNotes == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19744,10 +24160,25 @@ public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID cr if (creditNotes == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -19770,8 +24201,9 @@ public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID cr String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19786,7 +24218,7 @@ public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID cr * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19804,7 +24236,7 @@ public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUI * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { + public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19824,20 +24256,33 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String x if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19856,11 +24301,26 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String x if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -19868,10 +24328,6 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String x HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19890,11 +24346,29 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String x if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -19917,8 +24391,9 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String x String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19932,7 +24407,7 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String x * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees) throws IOException { + public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees) throws IOException { HttpResponse response = updateEmployeeForHttpResponse(xeroTenantId, employeeID, employees); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19949,7 +24424,7 @@ public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees, Map params) throws IOException { + public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees, Map params) throws IOException { HttpResponse response = updateEmployeeForHttpResponse(xeroTenantId, employeeID, employees, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -19966,19 +24441,29 @@ public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID empl if (employees == null) { throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Employees/{EmployeeID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Employees/{EmployeeID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("EmployeeID", employeeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -19994,10 +24479,25 @@ public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID empl if (employees == null) { throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("EmployeeID", employeeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Employees/{EmployeeID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Employees/{EmployeeID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("EmployeeID", employeeID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -20005,10 +24505,6 @@ public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID empl HttpContent content = employees == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20024,10 +24520,25 @@ public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID empl if (employees == null) { throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Employees/{EmployeeID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Employees/{EmployeeID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("EmployeeID", employeeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -20050,8 +24561,9 @@ public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID empl String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20065,7 +24577,7 @@ public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID empl * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { + public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20082,7 +24594,7 @@ public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims, Map params) throws IOException { + public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims, Map params) throws IOException { HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20099,19 +24611,29 @@ public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID if (expenseClaims == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ExpenseClaims/{ExpenseClaimID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20127,10 +24649,25 @@ public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID if (expenseClaims == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ExpenseClaims/{ExpenseClaimID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ExpenseClaimID", expenseClaimID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -20138,10 +24675,6 @@ public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID HttpContent content = expenseClaims == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20157,10 +24690,25 @@ public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID if (expenseClaims == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ExpenseClaims/{ExpenseClaimID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -20183,8 +24731,9 @@ public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20198,7 +24747,7 @@ public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { + public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { HttpResponse response = updateInvoiceForHttpResponse(xeroTenantId, invoiceID, invoices); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20215,7 +24764,7 @@ public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invo * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices, Map params) throws IOException { + public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices, Map params) throws IOException { HttpResponse response = updateInvoiceForHttpResponse(xeroTenantId, invoiceID, invoices, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20232,19 +24781,29 @@ public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoi if (invoices == null) { throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20260,10 +24819,25 @@ public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoi if (invoices == null) { throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -20271,10 +24845,6 @@ public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoi HttpContent content = invoices == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20290,10 +24860,25 @@ public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoi if (invoices == null) { throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -20316,8 +24901,9 @@ public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoi String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20332,7 +24918,7 @@ public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoi * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20350,7 +24936,7 @@ public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID i * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { + public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20370,20 +24956,33 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20402,11 +25001,26 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -20414,10 +25028,6 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20436,11 +25046,29 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -20463,8 +25091,9 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20478,7 +25107,7 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xero * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items updateItem(String xeroTenantId, UUID itemID, Items items) throws IOException { + public Items updateItem(String xeroTenantId, UUID itemID, Items items) throws IOException { HttpResponse response = updateItemForHttpResponse(xeroTenantId, itemID, items); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20495,7 +25124,7 @@ public Items updateItem(String xeroTenantId, UUID itemID, Items items) throws IO * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items updateItem(String xeroTenantId, UUID itemID, Items items, Map params) throws IOException { + public Items updateItem(String xeroTenantId, UUID itemID, Items items, Map params) throws IOException { HttpResponse response = updateItemForHttpResponse(xeroTenantId, itemID, items, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20512,19 +25141,29 @@ public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, if (items == null) { throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(items); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20540,10 +25179,25 @@ public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, if (items == null) { throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ItemID", itemID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -20551,10 +25205,6 @@ public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, HttpContent content = items == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20570,10 +25220,25 @@ public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, if (items == null) { throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Items/{ItemID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Items/{ItemID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -20596,8 +25261,9 @@ public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(items); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(items); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20611,7 +25277,7 @@ public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { + public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20628,7 +25294,7 @@ public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID link * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions, Map params) throws IOException { + public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions, Map params) throws IOException { HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20645,19 +25311,29 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, if (linkedTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/LinkedTransactions/{LinkedTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20673,10 +25349,25 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, if (linkedTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/LinkedTransactions/{LinkedTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LinkedTransactionID", linkedTransactionID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -20684,10 +25375,6 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, HttpContent content = linkedTransactions == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20703,10 +25390,25 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, if (linkedTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/LinkedTransactions/{LinkedTransactionID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -20729,8 +25431,9 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20744,7 +25447,7 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { + public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { HttpResponse response = updateManualJournalForHttpResponse(xeroTenantId, manualJournalID, manualJournals); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20761,7 +25464,7 @@ public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJourna * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals, Map params) throws IOException { + public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals, Map params) throws IOException { HttpResponse response = updateManualJournalForHttpResponse(xeroTenantId, manualJournalID, manualJournals, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20778,19 +25481,29 @@ public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID if (manualJournals == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20806,10 +25519,25 @@ public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID if (manualJournals == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -20817,10 +25545,6 @@ public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID HttpContent content = manualJournals == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20836,10 +25560,25 @@ public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID if (manualJournals == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -20862,8 +25601,9 @@ public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20878,7 +25618,7 @@ public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20896,7 +25636,7 @@ public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { + public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -20916,20 +25656,33 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20948,11 +25701,26 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -20960,10 +25728,6 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -20982,11 +25746,29 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -21009,8 +25791,9 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21024,7 +25807,7 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { + public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { HttpResponse response = updatePurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, purchaseOrders); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21041,7 +25824,7 @@ public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrde * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders, Map params) throws IOException { + public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders, Map params) throws IOException { HttpResponse response = updatePurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, purchaseOrders, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21058,19 +25841,29 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID if (purchaseOrders == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/PurchaseOrders/{PurchaseOrderID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21086,10 +25879,25 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID if (purchaseOrders == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/PurchaseOrders/{PurchaseOrderID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PurchaseOrderID", purchaseOrderID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -21097,10 +25905,6 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID HttpContent content = purchaseOrders == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21116,10 +25920,25 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID if (purchaseOrders == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/PurchaseOrders/{PurchaseOrderID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -21142,8 +25961,9 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21157,7 +25977,7 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { + public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21174,7 +25994,7 @@ public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts rece * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts, Map params) throws IOException { + public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts, Map params) throws IOException { HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21191,19 +26011,29 @@ public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID recei if (receipts == null) { throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21219,10 +26049,25 @@ public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID recei if (receipts == null) { throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -21230,10 +26075,6 @@ public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID recei HttpContent content = receipts == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21249,10 +26090,25 @@ public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID recei if (receipts == null) { throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -21275,8 +26131,9 @@ public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID recei String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21291,7 +26148,7 @@ public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID recei * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21309,7 +26166,7 @@ public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID r * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { + public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21329,20 +26186,33 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21361,11 +26231,26 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -21373,10 +26258,6 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xero HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21395,11 +26276,29 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xero if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -21422,8 +26321,9 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21438,7 +26338,7 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xero * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21456,7 +26356,7 @@ public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantI * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { + public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21476,20 +26376,33 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21508,11 +26421,26 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -21520,10 +26448,6 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21542,11 +26466,29 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // Set ContentType for Binary data + headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -21569,8 +26511,9 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21583,7 +26526,7 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { + public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { HttpResponse response = updateTaxRateForHttpResponse(xeroTenantId, taxRates); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21599,7 +26542,7 @@ public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates) throws IOE * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { + public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { HttpResponse response = updateTaxRateForHttpResponse(xeroTenantId, taxRates, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21613,16 +26556,18 @@ public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates t if (taxRates == null) { throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TaxRates"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21635,7 +26580,13 @@ public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, java.io.In if (taxRates == null) { throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TaxRates"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -21643,10 +26594,6 @@ public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, java.io.In HttpContent content = taxRates == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21659,7 +26606,13 @@ public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates t if (taxRates == null) { throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); } - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TaxRates"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -21682,8 +26635,9 @@ public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates t String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21697,7 +26651,7 @@ public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates t * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { + public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { HttpResponse response = updateTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, trackingCategory); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21714,7 +26668,7 @@ public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID track * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory, Map params) throws IOException { + public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory, Map params) throws IOException { HttpResponse response = updateTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, trackingCategory, params); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); @@ -21731,19 +26685,29 @@ public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, U if (trackingCategory == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21759,10 +26723,25 @@ public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, U if (trackingCategory == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -21770,10 +26749,6 @@ public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, U HttpContent content = trackingCategory == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -21789,10 +26764,25 @@ public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, U if (trackingCategory == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/TrackingCategories/{TrackingCategoryID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories/{TrackingCategoryID}"); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); @@ -21815,9 +26805,22 @@ public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, U String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + 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(); + } + + } } From 68f6409a199ac36c5ab996d5c047e85128fec43b Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Thu, 13 Jun 2019 13:46:10 -0700 Subject: [PATCH 08/76] removing unnecessary functions from templates adding binary body content formating --- .../com/xero/api/client/AccountingApi.java | 24388 +++------------- 1 file changed, 4170 insertions(+), 20218 deletions(-) diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index c6931803..17ef9831 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -108,23 +108,7 @@ public Accounts createAccount(String xeroTenantId, Account account) throws IOEx return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create a new chart of accounts - *

200 - Success - created new Account and return response of type Accounts array with new Account - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param account Request of type Account - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts createAccount(String xeroTenantId, Account account, Map params) throws IOException { - HttpResponse response = createAccountForHttpResponse(xeroTenantId, account, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account account) throws IOException { + public HttpResponse createAccountForHttpResponse( String xeroTenantId, Account account) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); @@ -143,80 +127,13 @@ public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account ac String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(account); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createAccountForHttpResponse(String xeroTenantId, java.io.InputStream account, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); - }// verify the required parameter 'account' is set - if (account == null) { - throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Accounts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = account == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, account); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account account, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); - }// verify the required parameter 'account' is set - if (account == null) { - throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Accounts"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(account); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create Attachment on Account *

200 - Success - return response of type Attachments array of Attachment @@ -228,31 +145,13 @@ public HttpResponse createAccountForHttpResponse(String xeroTenantId, Account ac * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create Attachment on Account - *

200 - Success - return response of type Attachments array of Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + public HttpResponse createAccountAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); @@ -280,7 +179,7 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xero } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -292,121 +191,15 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create a spend or receive money transaction *

200 - Success - return response of type BankTransactions array with new BankTransaction @@ -423,23 +216,7 @@ public BankTransactions createBankTransaction(String xeroTenantId, BankTransact return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create a spend or receive money transaction - *

200 - Success - return response of type BankTransactions array with new BankTransaction - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactions The bankTransactions parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Map params) throws IOException { - HttpResponse response = createBankTransactionForHttpResponse(xeroTenantId, bankTransactions, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + public HttpResponse createBankTransactionForHttpResponse( String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); @@ -469,91 +246,13 @@ public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, Ba String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, java.io.InputStream bankTransactions, Boolean summarizeErrors, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransactions"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = bankTransactions == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, BankTransactions bankTransactions, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransactions"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to createa an Attachment on BankTransaction by Filename *

200 - Success - return response of Attachments array of Attachment @@ -565,31 +264,13 @@ public HttpResponse createBankTransactionForHttpResponse(String xeroTenantId, Ba * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to createa an Attachment on BankTransaction by Filename - *

200 - Success - return response of Attachments array of Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName The name of the file being attached - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); @@ -617,7 +298,7 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -629,121 +310,15 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create history record for a bank transactions *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord @@ -760,24 +335,7 @@ public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, U return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create history record for a bank transactions - *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(xeroTenantId, bankTransactionID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createBankTransactionHistoryRecordForHttpResponse( String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); @@ -810,142 +368,29 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xer String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransactions/{BankTransactionID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransactions/{BankTransactionID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to create a bank transfers - *

200 - Success - return response of BankTransfers array of one BankTransfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransfers The bankTransfers parameter - * @return BankTransfers - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers) throws IOException { - HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create a bank transfers - *

200 - Success - return response of BankTransfers array of one BankTransfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransfers The bankTransfers parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransfers - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers, Map params) throws IOException { - HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankTransfers bankTransfers) throws IOException { + /** + * Allows you to create a bank transfers + *

200 - Success - return response of BankTransfers array of one BankTransfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransfers The bankTransfers parameter + * @return BankTransfers + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers) throws IOException { + HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createBankTransferForHttpResponse( String xeroTenantId, BankTransfers bankTransfers) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); @@ -964,80 +409,13 @@ public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankT String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, java.io.InputStream bankTransfers, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); - }// verify the required parameter 'bankTransfers' is set - if (bankTransfers == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransfers"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = bankTransfers == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransfers); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankTransfers bankTransfers, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); - }// verify the required parameter 'bankTransfers' is set - if (bankTransfers == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransfers"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer *

400 - A failed request due to validation error @@ -1048,30 +426,13 @@ public HttpResponse createBankTransferForHttpResponse(String xeroTenantId, BankT * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName The name of the file being attached to a Bank Transfer - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); @@ -1099,7 +460,7 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1111,121 +472,15 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** *

200 - Success - return response HistoryRecords array with the newly created HistoryRecord for a Bank Transfer *

400 - A failed request due to validation error @@ -1241,23 +496,7 @@ public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - *

200 - Success - return response HistoryRecords array with the newly created HistoryRecord for a Bank Transfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createBankTransferHistoryRecordForHttpResponse(xeroTenantId, bankTransferID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createBankTransferHistoryRecordForHttpResponse( String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); @@ -1290,110 +529,13 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTe String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransfers/{BankTransferID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBankTransferHistoryRecordForHttpResponse(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransfers/{BankTransferID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Create one or many BatchPayments for invoices *

200 - Success - return response of type BatchPayments array of BatchPayment objects @@ -1409,23 +551,7 @@ public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batc return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Create one or many BatchPayments for invoices - *

200 - Success - return response of type BatchPayments array of BatchPayment objects - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BatchPayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments, Map params) throws IOException { - HttpResponse response = createBatchPaymentForHttpResponse(xeroTenantId, batchPayments, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, BatchPayments batchPayments) throws IOException { + public HttpResponse createBatchPaymentForHttpResponse( String xeroTenantId, BatchPayments batchPayments) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); @@ -1444,80 +570,13 @@ public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, Batch String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, java.io.InputStream batchPayments, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); - }// verify the required parameter 'batchPayments' is set - if (batchPayments == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BatchPayments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = batchPayments == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, batchPayments); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBatchPaymentForHttpResponse(String xeroTenantId, BatchPayments batchPayments, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); - }// verify the required parameter 'batchPayments' is set - if (batchPayments == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BatchPayments"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create a history record for a Batch Payment *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects @@ -1534,24 +593,7 @@ public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create a history record for a Batch Payment - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param batchPaymentID Unique identifier for BatchPayment - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(xeroTenantId, batchPaymentID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); @@ -1584,110 +626,13 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTe String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); - }// verify the required parameter 'batchPaymentID' is set - if (batchPaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BatchPayments/{BatchPaymentID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BatchPayments/{BatchPaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); - }// verify the required parameter 'batchPaymentID' is set - if (batchPaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BatchPayments/{BatchPaymentID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BatchPayments/{BatchPaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allow for the creation of new custom payment service for specified Branding Theme *

200 - Success - return response of type PaymentServices array with newly created PaymentService @@ -1704,24 +649,7 @@ public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allow for the creation of new custom payment service for specified Branding Theme - *

200 - Success - return response of type PaymentServices array with newly created PaymentService - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param brandingThemeID Unique identifier for a Branding Theme - * @param paymentService The paymentService parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService, Map params) throws IOException { - HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, paymentService, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { + public HttpResponse createBrandingThemePaymentServicesForHttpResponse( String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); @@ -1754,110 +682,13 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xer String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, java.io.InputStream paymentService, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); - }// verify the required parameter 'paymentService' is set - if (paymentService == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = paymentService == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentService); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); - }// verify the required parameter 'paymentService' is set - if (paymentService == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** *

200 - Success - return response of type Contacts array with newly created Contact *

400 - Validation Error - some data was incorrect returns response of type Error @@ -1872,22 +703,7 @@ public Contacts createContact(String xeroTenantId, Contact contact) throws IOEx return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - *

200 - Success - return response of type Contacts array with newly created Contact - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param contact The contact parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts createContact(String xeroTenantId, Contact contact, Map params) throws IOException { - HttpResponse response = createContactForHttpResponse(xeroTenantId, contact, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact contact) throws IOException { + public HttpResponse createContactForHttpResponse( String xeroTenantId, Contact contact) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); @@ -1906,80 +722,13 @@ public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact co String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contact); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createContactForHttpResponse(String xeroTenantId, java.io.InputStream contact, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); - }// verify the required parameter 'contact' is set - if (contact == null) { - throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Contacts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = contact == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contact); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact contact, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); - }// verify the required parameter 'contact' is set - if (contact == null) { - throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Contacts"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contact); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** *

200 - Success - return response of type Attachments array with an newly created Attachment *

400 - A failed request due to validation error @@ -1990,30 +739,13 @@ public HttpResponse createContactForHttpResponse(String xeroTenantId, Contact co * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - *

200 - Success - return response of type Attachments array with an newly created Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name for the file you are attaching - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + public HttpResponse createContactAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); @@ -2041,7 +773,7 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xero } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2053,121 +785,15 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create a contact group *

200 - Success - return response of type Contact Groups array of newly created Contact Group @@ -2183,23 +809,7 @@ public ContactGroups createContactGroup(String xeroTenantId, ContactGroups cont return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create a contact group - *

200 - Success - return response of type Contact Groups array of newly created Contact Group - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroups an array of contact groups with names specified - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups, Map params) throws IOException { - HttpResponse response = createContactGroupForHttpResponse(xeroTenantId, contactGroups, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, ContactGroups contactGroups) throws IOException { + public HttpResponse createContactGroupForHttpResponse( String xeroTenantId, ContactGroups contactGroups) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); @@ -2218,114 +828,30 @@ public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, Conta String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, java.io.InputStream contactGroups, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); - }// verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ContactGroups"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = contactGroups == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } + /** + * Allows you to add Contacts to a Contract Group + *

200 - Success - return response of type Contacts array of added Contacts + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @param contacts an array of contacts with ContactID to be added to ContactGroup + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { + HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - public HttpResponse createContactGroupForHttpResponse(String xeroTenantId, ContactGroups contactGroups, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); - }// verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ContactGroups"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to add Contacts to a Contract Group - *

200 - Success - return response of type Contacts array of added Contacts - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contacts an array of contacts with ContactID to be added to ContactGroup - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { - HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to add Contacts to a Contract Group - *

200 - Success - return response of type Contacts array of added Contacts - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contacts an array of contacts with ContactID to be added to ContactGroup - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts, Map params) throws IOException { - HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { + public HttpResponse createContactGroupContactsForHttpResponse( String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); @@ -2358,110 +884,13 @@ public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, java.io.InputStream contacts, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); - }// verify the required parameter 'contacts' is set - if (contacts == null) { - throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = contacts == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Contacts contacts, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); - }// verify the required parameter 'contacts' is set - if (contacts == null) { - throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to retrieve a history records of an Contact *

200 - Success - return response of type History Records array of newly created History Record for a specific Contact @@ -2478,24 +907,7 @@ public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to retrieve a history records of an Contact - *

200 - Success - return response of type History Records array of newly created History Record for a specific Contact - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createContactHistoryForHttpResponse(xeroTenantId, contactID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createContactHistoryForHttpResponse( String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); @@ -2528,110 +940,13 @@ public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Contacts/{ContactID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Contacts/{ContactID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create a credit note *

200 - Success - return response of type Credit Notes array of newly created CreditNote @@ -2648,23 +963,7 @@ public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNote return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create a credit note - *

200 - Success - return response of type Credit Notes array of newly created CreditNote - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNotes an array of Credit Notes with a single CreditNote object. - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Map params) throws IOException { - HttpResponse response = createCreditNoteForHttpResponse(xeroTenantId, creditNotes, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + public HttpResponse createCreditNoteForHttpResponse( String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); @@ -2694,91 +993,13 @@ public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditN String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, java.io.InputStream creditNotes, Boolean summarizeErrors, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); - }// verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = creditNotes == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createCreditNoteForHttpResponse(String xeroTenantId, CreditNotes creditNotes, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); - }// verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create Allocation on CreditNote *

200 - Success - return response of type Allocations array with newly created Allocation for specific Credit Note @@ -2795,24 +1016,7 @@ public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditN return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create Allocation on CreditNote - *

200 - Success - return response of type Allocations array with newly created Allocation for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param allocations an array of Allocations with single Allocation object defined. - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Allocations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations, Map params) throws IOException { - HttpResponse response = createCreditNoteAllocationForHttpResponse(xeroTenantId, creditNoteID, allocations, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { + public HttpResponse createCreditNoteAllocationForHttpResponse( String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); @@ -2845,300 +1049,79 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream allocations, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes/{CreditNoteID}/Allocations"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Allocations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = allocations == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createCreditNoteAllocationForHttpResponse(String xeroTenantId, UUID creditNoteID, Allocations allocations, Map params) throws IOException { + /** + * Allows you to create Attachments on CreditNote by file name + *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param fileName Name of the file you are attaching to Credit Note + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { + HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Allocations"; - + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Allocations"; + String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); } + // Set ContentType for Binary data + //headers.setContentType("application/octet-stream"); + // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to create Attachments on CreditNote by file name - *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the file you are attaching to Credit Note - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { - HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create Attachments on CreditNote by file name - *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the file you are attaching to Credit Note - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to retrieve a history records of an CreditNote *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Credit Note @@ -3155,24 +1138,7 @@ public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditN return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to retrieve a history records of an CreditNote - *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createCreditNoteHistoryForHttpResponse( String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); @@ -3205,110 +1171,13 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes/{CreditNoteID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes/{CreditNoteID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency * @param xeroTenantId Xero identifier for Tenant @@ -3322,21 +1191,7 @@ public Currencies createCurrency(String xeroTenantId, Currencies currencies) th return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency - * @param xeroTenantId Xero identifier for Tenant - * @param currencies The currencies parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Currencies - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Currencies createCurrency(String xeroTenantId, Currencies currencies, Map params) throws IOException { - HttpResponse response = createCurrencyForHttpResponse(xeroTenantId, currencies, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencies currencies) throws IOException { + public HttpResponse createCurrencyForHttpResponse( String xeroTenantId, Currencies currencies) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); @@ -3355,80 +1210,13 @@ public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencie String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, java.io.InputStream currencies, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); - }// verify the required parameter 'currencies' is set - if (currencies == null) { - throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Currencies"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = currencies == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, currencies); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createCurrencyForHttpResponse(String xeroTenantId, Currencies currencies, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); - }// verify the required parameter 'currencies' is set - if (currencies == null) { - throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Currencies"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create new employees used in Xero payrun *

200 - Success - return response of type Employees array with new Employee @@ -3444,23 +1232,7 @@ public Employees createEmployee(String xeroTenantId, Employees employees) throw return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create new employees used in Xero payrun - *

200 - Success - return response of type Employees array with new Employee - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param employees The employees parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees createEmployee(String xeroTenantId, Employees employees, Map params) throws IOException { - HttpResponse response = createEmployeeForHttpResponse(xeroTenantId, employees, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees employees) throws IOException { + public HttpResponse createEmployeeForHttpResponse( String xeroTenantId, Employees employees) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createEmployee"); @@ -3479,113 +1251,30 @@ public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, java.io.InputStream employees, String mediaType) 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 'employees' is set - if (employees == null) { - throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Employees"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = employees == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } + /** + * Allows you to retrieve expense claims + *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaims The expenseClaims parameter + * @param summarizeErrors shows validation errors for each expense claim + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } - public HttpResponse createEmployeeForHttpResponse(String xeroTenantId, Employees employees, Map params) 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 'employees' is set - if (employees == null) { - throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Employees"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve expense claims - *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaims The expenseClaims parameter - * @param summarizeErrors shows validation errors for each expense claim - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { - HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, summarizeErrors); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve expense claims - *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaims The expenseClaims parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Map params) throws IOException { - HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + public HttpResponse createExpenseClaimForHttpResponse( String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); @@ -3615,91 +1304,13 @@ public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, Expen String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, java.io.InputStream expenseClaims, Boolean summarizeErrors, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ExpenseClaims"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = expenseClaims == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createExpenseClaimForHttpResponse(String xeroTenantId, ExpenseClaims expenseClaims, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ExpenseClaims"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create a history records of an ExpenseClaim *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims @@ -3715,23 +1326,7 @@ public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expen return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create a history records of an ExpenseClaim - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createExpenseClaimHistoryForHttpResponse( String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); @@ -3764,110 +1359,13 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create any sales invoices or purchase bills *

200 - Success - return response of type Invoices array with newly created Invoice @@ -3884,23 +1382,7 @@ public Invoices createInvoice(String xeroTenantId, Invoices invoices, Boolean s return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create any sales invoices or purchase bills - *

200 - Success - return response of type Invoices array with newly created Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoices The invoices parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices createInvoice(String xeroTenantId, Invoices invoices, Map params) throws IOException { - HttpResponse response = createInvoiceForHttpResponse(xeroTenantId, invoices, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + public HttpResponse createInvoiceForHttpResponse( String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); @@ -3930,91 +1412,13 @@ public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices i String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, java.io.InputStream invoices, Boolean summarizeErrors, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); - }// verify the required parameter 'invoices' is set - if (invoices == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = invoices == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices invoices, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); - }// verify the required parameter 'invoices' is set - if (invoices == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create an Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of type Attachments array with newly created Attachment @@ -4026,31 +1430,13 @@ public HttpResponse createInvoiceForHttpResponse(String xeroTenantId, Invoices i * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create an Attachment on invoices or purchase bills by it's filename - *

200 - Success - return response of type Attachments array with newly created Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the file you are attaching - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); @@ -4078,7 +1464,7 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xero } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4090,121 +1476,15 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to retrieve a history records of an invoice *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Invoice @@ -4221,24 +1501,7 @@ public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to retrieve a history records of an invoice - *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createInvoiceHistoryForHttpResponse( String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); @@ -4271,110 +1534,13 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create an item *

200 - Success - return response of type Items array with newly created Item @@ -4390,23 +1556,7 @@ public Items createItem(String xeroTenantId, Items items) throws IOException { return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create an item - *

200 - Success - return response of type Items array with newly created Item - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param items The items parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items createItem(String xeroTenantId, Items items, Map params) throws IOException { - HttpResponse response = createItemForHttpResponse(xeroTenantId, items, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items) throws IOException { + public HttpResponse createItemForHttpResponse( String xeroTenantId, Items items) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); @@ -4425,80 +1575,13 @@ public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items) String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(items); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createItemForHttpResponse(String xeroTenantId, java.io.InputStream items, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); - }// verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = items == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createItemForHttpResponse(String xeroTenantId, Items items, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); - }// verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(items); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create a history record for items *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items @@ -4514,23 +1597,7 @@ public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, Histo return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create a history record for items - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createItemHistoryForHttpResponse(xeroTenantId, itemID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createItemHistoryForHttpResponse( String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); @@ -4563,110 +1630,13 @@ public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID i String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items/{ItemID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items/{ItemID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction @@ -4682,23 +1652,7 @@ public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTr return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactions The linkedTransactions parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions, Map params) throws IOException { - HttpResponse response = createLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactions, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { + public HttpResponse createLinkedTransactionForHttpResponse( String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); @@ -4717,80 +1671,13 @@ public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, java.io.InputStream linkedTransactions, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); - }// verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/LinkedTransactions"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = linkedTransactions == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createLinkedTransactionForHttpResponse(String xeroTenantId, LinkedTransactions linkedTransactions, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); - }// verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/LinkedTransactions"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create a manual journal *

200 - Success - return response of type ManualJournals array with newly created ManualJournal @@ -4806,23 +1693,7 @@ public ManualJournals createManualJournal(String xeroTenantId, ManualJournals m return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create a manual journal - *

200 - Success - return response of type ManualJournals array with newly created ManualJournal - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournals The manualJournals parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals, Map params) throws IOException { - HttpResponse response = createManualJournalForHttpResponse(xeroTenantId, manualJournals, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, ManualJournals manualJournals) throws IOException { + public HttpResponse createManualJournalForHttpResponse( String xeroTenantId, ManualJournals manualJournals) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); @@ -4841,80 +1712,13 @@ public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, Manu String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, java.io.InputStream manualJournals, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); - }// verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = manualJournals == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, ManualJournals manualJournals, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); - }// verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create a specified Attachment on ManualJournal by file name *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals @@ -4926,31 +1730,13 @@ public HttpResponse createManualJournalForHttpResponse(String xeroTenantId, Manu * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create a specified Attachment on ManualJournal by file name - *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName The name of the file being attached to a ManualJournal - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); @@ -4978,7 +1764,7 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4990,121 +1776,15 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to retrieve Allocations for overpayments *

200 - Success - return response of type Allocations array with all Allocation for Overpayments @@ -5121,24 +1801,7 @@ public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpa return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to retrieve Allocations for overpayments - *

200 - Success - return response of type Allocations array with all Allocation for Overpayments - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @param allocations The allocations parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Allocations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations, Map params) throws IOException { - HttpResponse response = createOverpaymentAllocationForHttpResponse(xeroTenantId, overpaymentID, allocations, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { + public HttpResponse createOverpaymentAllocationForHttpResponse( String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); @@ -5171,110 +1834,13 @@ public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenant String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, java.io.InputStream allocations, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Overpayments/{OverpaymentID}/Allocations"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/Allocations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = allocations == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createOverpaymentAllocationForHttpResponse(String xeroTenantId, UUID overpaymentID, Allocations allocations, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Overpayments/{OverpaymentID}/Allocations"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/Allocations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create history records of an Overpayment *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Overpayments @@ -5291,24 +1857,7 @@ public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpa return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create history records of an Overpayment - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Overpayments - *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createOverpaymentHistoryForHttpResponse( String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); @@ -5341,110 +1890,13 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Overpayments/{OverpaymentID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Overpayments/{OverpaymentID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create payments for invoices and credit notes *

200 - Success - return response of type Payments array for newly created Payment @@ -5460,23 +1912,7 @@ public Payments createPayment(String xeroTenantId, Payments payments) throws IO return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create payments for invoices and credit notes - *

200 - Success - return response of type Payments array for newly created Payment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param payments The payments parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments createPayment(String xeroTenantId, Payments payments, Map params) throws IOException { - HttpResponse response = createPaymentForHttpResponse(xeroTenantId, payments, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments payments) throws IOException { + public HttpResponse createPaymentForHttpResponse( String xeroTenantId, Payments payments) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); @@ -5495,80 +1931,13 @@ public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments p String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPaymentForHttpResponse(String xeroTenantId, java.io.InputStream payments, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Payments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = payments == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPaymentForHttpResponse(String xeroTenantId, Payments payments, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Payments"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(payments); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create a history record for a payment *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments @@ -5585,24 +1954,7 @@ public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create a history record for a payment - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments - *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Payments - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createPaymentHistoryForHttpResponse(xeroTenantId, paymentID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createPaymentHistoryForHttpResponse( String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); @@ -5635,148 +1987,35 @@ public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Payments/{PaymentID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords, Map params) throws IOException { + /** + * Allows you to create payment services + *

200 - Success - return response of type PaymentServices array for newly created PaymentService + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param paymentServices The paymentServices parameter + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices) throws IOException { + HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createPaymentServiceForHttpResponse( String xeroTenantId, PaymentServices paymentServices) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Payments/{PaymentID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to create payment services - *

200 - Success - return response of type PaymentServices array for newly created PaymentService - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param paymentServices The paymentServices parameter - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices) throws IOException { - HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create payment services - *

200 - Success - return response of type PaymentServices array for newly created PaymentService - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param paymentServices The paymentServices parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices, Map params) throws IOException { - HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, PaymentServices paymentServices) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); - }// verify the required parameter 'paymentServices' is set - if (paymentServices == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); + }// verify the required parameter 'paymentServices' is set + if (paymentServices == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -5789,80 +2028,13 @@ public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, Pay String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, java.io.InputStream paymentServices, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); - }// verify the required parameter 'paymentServices' is set - if (paymentServices == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PaymentServices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = paymentServices == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, paymentServices); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPaymentServiceForHttpResponse(String xeroTenantId, PaymentServices paymentServices, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); - }// verify the required parameter 'paymentServices' is set - if (paymentServices == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PaymentServices"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create an Allocation for prepayments *

200 - Success - return response of type Allocations array of Allocation for all Prepayment @@ -5879,24 +2051,7 @@ public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaym return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create an Allocation for prepayments - *

200 - Success - return response of type Allocations array of Allocation for all Prepayment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID The prepaymentID parameter - * @param allocations The allocations parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Allocations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations, Map params) throws IOException { - HttpResponse response = createPrepaymentAllocationForHttpResponse(xeroTenantId, prepaymentID, allocations, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { + public HttpResponse createPrepaymentAllocationForHttpResponse( String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); @@ -5929,110 +2084,13 @@ public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, java.io.InputStream allocations, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Prepayments/{PrepaymentID}/Allocations"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/Allocations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = allocations == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, allocations); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPrepaymentAllocationForHttpResponse(String xeroTenantId, UUID prepaymentID, Allocations allocations, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); - }// verify the required parameter 'allocations' is set - if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Prepayments/{PrepaymentID}/Allocations"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/Allocations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create a history record for an Prepayment *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PrePayment @@ -6049,24 +2107,7 @@ public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaym return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create a history record for an Prepayment - *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PrePayment - *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID Unique identifier for a PrePayment - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createPrepaymentHistoryForHttpResponse( String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); @@ -6099,110 +2140,13 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Prepayments/{PrepaymentID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Prepayments/{PrepaymentID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create purchase orders *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder @@ -6219,23 +2163,7 @@ public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders p return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create purchase orders - *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrders The purchaseOrders parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Map params) throws IOException { - HttpResponse response = createPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrders, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + public HttpResponse createPurchaseOrderForHttpResponse( String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); @@ -6265,91 +2193,13 @@ public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, Purc String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, java.io.InputStream purchaseOrders, Boolean summarizeErrors, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = purchaseOrders == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPurchaseOrderForHttpResponse(String xeroTenantId, PurchaseOrders purchaseOrders, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create HistoryRecord for purchase orders *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PurchaseOrder @@ -6366,24 +2216,7 @@ public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purc return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create HistoryRecord for purchase orders - *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PurchaseOrder - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createPurchaseOrderHistoryForHttpResponse( String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); @@ -6416,110 +2249,13 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create draft expense claim receipts for any user *

200 - Success - return response of type Receipts array for newly created Receipt @@ -6535,23 +2271,7 @@ public Receipts createReceipt(String xeroTenantId, Receipts receipts) throws IO return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create draft expense claim receipts for any user - *

200 - Success - return response of type Receipts array for newly created Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receipts The receipts parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts createReceipt(String xeroTenantId, Receipts receipts, Map params) throws IOException { - HttpResponse response = createReceiptForHttpResponse(xeroTenantId, receipts, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts receipts) throws IOException { + public HttpResponse createReceiptForHttpResponse( String xeroTenantId, Receipts receipts) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); @@ -6570,80 +2290,13 @@ public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts r String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createReceiptForHttpResponse(String xeroTenantId, java.io.InputStream receipts, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); - }// verify the required parameter 'receipts' is set - if (receipts == null) { - throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = receipts == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts receipts, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); - }// verify the required parameter 'receipts' is set - if (receipts == null) { - throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create Attachment on expense claim receipts by file name *

200 - Success - return response of type Attachments array with newly created Attachment for a specified Receipt @@ -6655,31 +2308,13 @@ public HttpResponse createReceiptForHttpResponse(String xeroTenantId, Receipts r * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create Attachment on expense claim receipts by file name - *

200 - Success - return response of type Attachments array with newly created Attachment for a specified Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param fileName The name of the file being attached to the Receipt - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); @@ -6707,7 +2342,7 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xero } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6719,121 +2354,15 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to retrieve a history records of an Receipt *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts @@ -6850,24 +2379,7 @@ public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to retrieve a history records of an Receipt - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts - *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createReceiptHistoryForHttpResponse(xeroTenantId, receiptID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createReceiptHistoryForHttpResponse( String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); @@ -6900,110 +2412,13 @@ public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUI String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create attachment on repeating invoices by file name *

200 - Success - return response of type Attachments array with updated Attachment for a specified Repeating Invoice @@ -7015,31 +2430,13 @@ public HttpResponse createReceiptHistoryForHttpResponse(String xeroTenantId, UUI * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create attachment on repeating invoices by file name - *

200 - Success - return response of type Attachments array with updated Attachment for a specified Repeating Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName The name of the file being attached to a Repeating Invoice - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); @@ -7067,7 +2464,7 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7079,158 +2476,35 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - + + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { + /** + * Allows you to create history for a repeating invoice + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param historyRecords The historyRecords parameter + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to create history for a repeating invoice - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param historyRecords The historyRecords parameter - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to create history for a repeating invoice - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param historyRecords The historyRecords parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords, Map params) throws IOException { - HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); }// verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); @@ -7260,110 +2534,13 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTena String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, java.io.InputStream historyRecords, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = historyRecords == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, historyRecords); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create Tax Rates *

200 - Success - return response of type TaxRates array newly created TaxRate @@ -7379,23 +2556,7 @@ public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates) throws IO return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create Tax Rates - *

200 - Success - return response of type TaxRates array newly created TaxRate - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param taxRates The taxRates parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TaxRates - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { - HttpResponse response = createTaxRateForHttpResponse(xeroTenantId, taxRates, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates) throws IOException { + public HttpResponse createTaxRateForHttpResponse( String xeroTenantId, TaxRates taxRates) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); @@ -7414,80 +2575,13 @@ public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates t String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, java.io.InputStream taxRates, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); - }// verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TaxRates"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = taxRates == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); - }// verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TaxRates"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create tracking categories *

200 - Success - return response of type TrackingCategories array of newly created TrackingCategory @@ -7503,23 +2597,7 @@ public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingC return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create tracking categories - *

200 - Success - return response of type TrackingCategories array of newly created TrackingCategory - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategory The trackingCategory parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory, Map params) throws IOException { - HttpResponse response = createTrackingCategoryForHttpResponse(xeroTenantId, trackingCategory, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, TrackingCategory trackingCategory) throws IOException { + public HttpResponse createTrackingCategoryForHttpResponse( String xeroTenantId, TrackingCategory trackingCategory) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); @@ -7538,80 +2616,13 @@ public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, T String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, java.io.InputStream trackingCategory, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); - }// verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TrackingCategories"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = trackingCategory == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createTrackingCategoryForHttpResponse(String xeroTenantId, TrackingCategory trackingCategory, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); - }// verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TrackingCategories"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to create options for a specified tracking category *

200 - Success - return response of type TrackingOptions array of options for a specified category @@ -7628,24 +2639,7 @@ public TrackingOptions createTrackingOptions(String xeroTenantId, UUID tracking return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to create options for a specified tracking category - *

200 - Success - return response of type TrackingOptions array of options for a specified category - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingOption The trackingOption parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingOptions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption, Map params) throws IOException { - HttpResponse response = createTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOption, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { + public HttpResponse createTrackingOptionsForHttpResponse( String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); @@ -7678,71 +2672,43 @@ public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UU String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, java.io.InputStream trackingOption, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); - }// verify the required parameter 'trackingOption' is set - if (trackingOption == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}/Options"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = trackingOption == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingOption); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption, Map params) throws IOException { + /** + * Allows you to delete a chart of accounts + *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for retrieving single object + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse deleteAccountForHttpResponse( String xeroTenantId, UUID accountID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); - }// verify the required parameter 'trackingOption' is set - if (trackingOption == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options"; - + String correctPath = "/Accounts/{AccountID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}/Options"; + String path = "/Accounts/{AccountID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -7751,83 +2717,49 @@ public HttpResponse createTrackingOptionsForHttpResponse(String xeroTenantId, UU // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); + uriVariables.put("AccountID", accountID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to delete a chart of accounts - *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws IOException { - HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to delete a chart of accounts - *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account - *

400 - Validation Error - some data was incorrect returns response of type Error + * Allows you to delete a specific Contact from a Contract Group + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Accounts + * @param contactGroupID Unique identifier for a Contact Group + * @param contactID Unique identifier for a Contact * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts deleteAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { - HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { + deleteContactGroupContactForHttpResponse(xeroTenantId, contactGroupID, contactID); } - public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { + public HttpResponse deleteContactGroupContactForHttpResponse( String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}"; + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; + String path = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -7836,34 +2768,45 @@ public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accou // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); + uriVariables.put("ContactGroupID", contactGroupID); + uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { + /** + * Allows you to delete all Contacts from a Contract Group + *

200 - Success - return response 204 no content + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID) throws IOException { + deleteContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID); + } + + public HttpResponse deleteContactGroupContactsForHttpResponse( String xeroTenantId, UUID contactGroupID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}"; - + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; + String path = "/ContactGroups/{ContactGroupID}/Contacts"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -7872,82 +2815,45 @@ public HttpResponse deleteAccountForHttpResponse(String xeroTenantId, UUID accou // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); + uriVariables.put("ContactGroupID", contactGroupID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to delete a specific Contact from a Contract Group - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contactID Unique identifier for a Contact - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { - deleteContactGroupContactForHttpResponse(xeroTenantId, contactGroupID, contactID); - } - /** - * Allows you to delete a specific Contact from a Contract Group + * Allows you to delete a specified item *

204 - Success - return response 204 no content *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contactID Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @param itemID Unique identifier for an Item * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID, Map params) throws IOException { - deleteContactGroupContactForHttpResponse(xeroTenantId, contactGroupID, contactID, params); + public void deleteItem(String xeroTenantId, UUID itemID) throws IOException { + deleteItemForHttpResponse(xeroTenantId, itemID); } - public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { + public HttpResponse deleteItemForHttpResponse( String xeroTenantId, UUID itemID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; + String correctPath = "/Items/{ItemID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; + String path = "/Items/{ItemID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -7956,38 +2862,45 @@ public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - uriVariables.put("ContactID", contactID); + uriVariables.put("ItemID", itemID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId, UUID contactGroupID, UUID contactID, Map params) throws IOException { + /** + * Allows you to delete a specified linked transactions (billable expenses) + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { + deleteLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); + } + + public HttpResponse deleteLinkedTransactionForHttpResponse( String xeroTenantId, UUID linkedTransactionID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; - + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; + String path = "/LinkedTransactions/{LinkedTransactionID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -7996,76 +2909,52 @@ public HttpResponse deleteContactGroupContactForHttpResponse(String xeroTenantId // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - uriVariables.put("ContactID", contactID); + uriVariables.put("LinkedTransactionID", linkedTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to delete all Contacts from a Contract Group - *

200 - Success - return response 204 no content - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID) throws IOException { - deleteContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID); - } - /** - * Allows you to delete all Contacts from a Contract Group - *

200 - Success - return response 204 no content + * Allows you to update a specified payment for invoices and credit notes + *

200 - Success - return response of type Payments array for updated Payment + *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @param paymentID Unique identifier for a Payment + * @param payments The payments parameter + * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { - deleteContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, params); + public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { + HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID) throws IOException { + public HttpResponse deletePaymentForHttpResponse( String xeroTenantId, UUID paymentID, Payments payments) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; + String correctPath = "/Payments/{PaymentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts"; + String path = "/Payments/{PaymentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8074,34 +2963,50 @@ public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantI // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); + uriVariables.put("PaymentID", paymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; + + + HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); + /** + * Allows you to delete tracking categories + *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @return TrackingCategories + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { + HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { + public HttpResponse deleteTrackingCategoryForHttpResponse( String xeroTenantId, UUID trackingCategoryID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; - + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts"; + String path = "/TrackingCategories/{TrackingCategoryID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8110,77 +3015,52 @@ public HttpResponse deleteContactGroupContactsForHttpResponse(String xeroTenantI // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); + uriVariables.put("TrackingCategoryID", trackingCategoryID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to delete a specified item - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteItem(String xeroTenantId, UUID itemID) throws IOException { - deleteItemForHttpResponse(xeroTenantId, itemID); - } - - /** - * Allows you to delete a specified item - *

204 - Success - return response 204 no content + * Allows you to delete a specified option for a specified tracking category + *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param trackingOptionID Unique identifier for a Tracking Option + * @return TrackingOptions * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteItem(String xeroTenantId, UUID itemID, Map params) throws IOException { - deleteItemForHttpResponse(xeroTenantId, itemID, params); + public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { + HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { + public HttpResponse deleteTrackingOptionsForHttpResponse( String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); + }// verify the required parameter 'trackingOptionID' is set + if (trackingOptionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Items/{ItemID}"; + String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; + String path = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8189,34 +3069,50 @@ public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID) // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + uriVariables.put("TrackingOptionID", trackingOptionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { + /** + * Allows you to email a copy of invoice to related Contact + *

204 - Success - return response 204 no content + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param requestEmpty The requestEmpty parameter + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { + emailInvoiceForHttpResponse(xeroTenantId, invoiceID, requestEmpty); + } + + public HttpResponse emailInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); + }// verify the required parameter 'requestEmpty' is set + if (requestEmpty == null) { + throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Items/{ItemID}"; - + String correctPath = "/Invoices/{InvoiceID}/Email"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; + String path = "/Invoices/{InvoiceID}/Email"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8225,77 +3121,49 @@ public HttpResponse deleteItemForHttpResponse(String xeroTenantId, UUID itemID, // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); + uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to delete a specified linked transactions (billable expenses) - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { - deleteLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); + + + HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to delete a specified linked transactions (billable expenses) - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error + * Allows you to retrieve a single chart of accounts + *

200 - Success - return response of type Accounts array with one Account * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @param accountID Unique identifier for retrieving single object + * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { - deleteLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, params); + public Accounts getAccount(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID) throws IOException { + public HttpResponse getAccountForHttpResponse( String xeroTenantId, UUID accountID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; + String correctPath = "/Accounts/{AccountID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; + String path = "/Accounts/{AccountID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8304,34 +3172,56 @@ public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); + uriVariables.put("AccountID", accountID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); + /** + * Allows you to retrieve Attachment on Account by Filename + *

200 - Success - return response of attachment for Account as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @param fileName Name of the attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ByteArrayInputStream getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { + HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + } - public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { + public HttpResponse getAccountAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; + String path = "/Accounts/{AccountID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8340,88 +3230,57 @@ public HttpResponse deleteLinkedTransactionForHttpResponse(String xeroTenantId, // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); + uriVariables.put("AccountID", accountID); + uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to update a specified payment for invoices and credit notes - *

200 - Success - return response of type Payments array for updated Payment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param payments The payments parameter - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { - HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to update a specified payment for invoices and credit notes - *

200 - Success - return response of type Payments array for updated Payment - *

400 - A failed request due to validation error + * Allows you to retrieve specific Attachment on Account + *

200 - Success - return response of attachment for Account as binary data * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param payments The payments parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Payments + * @param accountID Unique identifier for Account object + * @param attachmentID Unique identifier for Attachment object + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments, Map params) throws IOException { - HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public ByteArrayInputStream getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + } - public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { + public HttpResponse getAccountAttachmentByIdForHttpResponse( String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getAccountAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Payments/{PaymentID}"; + String correctPath = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}"; + String path = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8430,78 +3289,48 @@ public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID payme // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); + uriVariables.put("AccountID", accountID); + uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(payments); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + /** + * Allows you to retrieve Attachments for accounts + *

200 - Success - return response of type Attachments array of Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for Account object + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, java.io.InputStream payments, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Payments/{PaymentID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = payments == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, payments); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID paymentID, Payments payments, Map params) throws IOException { + public HttpResponse getAccountAttachmentsForHttpResponse( String xeroTenantId, UUID accountID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); - } + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); + } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Payments/{PaymentID}"; - + String correctPath = "/Accounts/{AccountID}/Attachments"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}"; + String path = "/Accounts/{AccountID}/Attachments"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8510,83 +3339,105 @@ public HttpResponse deletePaymentForHttpResponse(String xeroTenantId, UUID payme // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); + uriVariables.put("AccountID", accountID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(payments); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to delete tracking categories - *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory - *

400 - A failed request due to validation error + * Allows you to retrieve the full chart of accounts + *

200 - Success - return response of type Accounts array with 0 to n Account * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @return TrackingCategories + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { - HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); - TypeReference typeRef = new TypeReference() {}; + public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getAccountsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + public HttpResponse getAccountsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Accounts"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + /** - * Allows you to delete tracking categories - *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory - *

400 - A failed request due to validation error + * Allows you to retrieve a single spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with a specific BankTransaction * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingCategories + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { - HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, params); - TypeReference typeRef = new TypeReference() {}; + public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID) throws IOException { + public HttpResponse getBankTransactionForHttpResponse( String xeroTenantId, UUID bankTransactionID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; + String correctPath = "/BankTransactions/{BankTransactionID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; + String path = "/BankTransactions/{BankTransactionID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8595,34 +3446,56 @@ public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, U // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); + uriVariables.put("BankTransactionID", bankTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); + /** + * Allows you to retrieve Attachments on BankTransaction by Filename + *

200 - Success - return response of attachment for BankTransaction as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param fileName The name of the file being attached + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ByteArrayInputStream getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { + HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + } - public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; - + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; + String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8631,88 +3504,57 @@ public HttpResponse deleteTrackingCategoryForHttpResponse(String xeroTenantId, U // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to delete a specified option for a specified tracking category - *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingOptionID Unique identifier for a Tracking Option - * @return TrackingOptions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { - HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to delete a specified option for a specified tracking category - *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category - *

400 - A failed request due to validation error + * Allows you to retrieve Attachments on a specific BankTransaction + *

200 - Success - return response of attachment for BankTransaction as binary data * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingOptionID Unique identifier for a Tracking Option - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingOptions + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param attachmentID Xero generated unique identifier for an attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, Map params) throws IOException { - HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public ByteArrayInputStream getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + } - public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { + public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); - }// verify the required parameter 'trackingOptionID' is set - if (trackingOptionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; + String path = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8721,38 +3563,48 @@ public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UU // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - uriVariables.put("TrackingOptionID", trackingOptionID); + uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); + /** + * Allows you to retrieve any attachments to bank transactions + *

200 - Success - return response of type Attachments array with 0 to n Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, Map params) throws IOException { + public HttpResponse getBankTransactionAttachmentsForHttpResponse( String xeroTenantId, UUID bankTransactionID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); - }// verify the required parameter 'trackingOptionID' is set - if (trackingOptionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; - + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments"; // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; + String path = "/BankTransactions/{BankTransactionID}/Attachments"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8761,83 +3613,127 @@ public HttpResponse deleteTrackingOptionsForHttpResponse(String xeroTenantId, UU // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - uriVariables.put("TrackingOptionID", trackingOptionID); + uriVariables.put("BankTransactionID", bankTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to email a copy of invoice to related Contact - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error + * Allows you to retrieve any spend or receive money transactions + *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param requestEmpty The requestEmpty parameter + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 bank transactions will be returned in a single API call with line items shown for each bank transaction + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { - emailInvoiceForHttpResponse(xeroTenantId, invoiceID, requestEmpty); + public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransactionsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BankTransactions"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to email a copy of invoice to related Contact - *

204 - Success - return response 204 no content - *

400 - A failed request due to validation error + * Allows you to retrieve history from a bank transactions + *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param requestEmpty The requestEmpty parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty, Map params) throws IOException { - emailInvoiceForHttpResponse(xeroTenantId, invoiceID, requestEmpty, params); + public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { + public HttpResponse getBankTransactionsHistoryForHttpResponse( String xeroTenantId, UUID bankTransactionID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); - }// verify the required parameter 'requestEmpty' is set - if (requestEmpty == null) { - throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/Email"; + String correctPath = "/BankTransactions/{BankTransactionID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Email"; + String path = "/BankTransactions/{BankTransactionID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8846,78 +3742,47 @@ public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoic // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("BankTransactionID", bankTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + /** + * Allows you to retrieve any bank transfers + *

200 - Success - return response of BankTransfers array with one BankTransfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @return BankTransfers + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream requestEmpty, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); - }// verify the required parameter 'requestEmpty' is set - if (requestEmpty == null) { - throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/Email"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Email"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = requestEmpty == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, requestEmpty); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty, Map params) throws IOException { + public HttpResponse getBankTransferForHttpResponse( String xeroTenantId, UUID bankTransferID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); - }// verify the required parameter 'requestEmpty' is set - if (requestEmpty == null) { - throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/Email"; - + String correctPath = "/BankTransfers/{BankTransferID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Email"; + String path = "/BankTransfers/{BankTransferID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -8926,81 +3791,56 @@ public HttpResponse emailInvoiceForHttpResponse(String xeroTenantId, UUID invoic // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("BankTransferID", bankTransferID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a single chart of accounts - *

200 - Success - return response of type Accounts array with one Account - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts getAccount(String xeroTenantId, UUID accountID) throws IOException { - HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to retrieve a single chart of accounts - *

200 - Success - return response of type Accounts array with one Account + * Allows you to retrieve Attachments on BankTransfer by file name + *

200 - Success - return response of binary data from the Attachment to a Bank Transfer * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Accounts + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param fileName The name of the file being attached to a Bank Transfer + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccount(String xeroTenantId, UUID accountID, Map params) throws IOException { - HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public ByteArrayInputStream getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { + HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + } - public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { + public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}"; + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; + String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9009,34 +3849,57 @@ public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountI // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { + /** + * Allows you to retrieve Attachments on BankTransfer + *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ByteArrayInputStream getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + + } + + public HttpResponse getBankTransferAttachmentByIdForHttpResponse( String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}"; - + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; + String path = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9045,107 +3908,48 @@ public HttpResponse getAccountForHttpResponse(String xeroTenantId, UUID accountI // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); + uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve Attachment on Account by Filename - *

200 - Success - return response of attachment for Account as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { - HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - /** - * Allows you to retrieve Attachment on Account by Filename - *

200 - Success - return response of attachment for Account as binary data + * Allows you to retrieve Attachments from bank transfers + *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - + public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { + public HttpResponse getBankTransferAttachmentsForHttpResponse( String xeroTenantId, UUID bankTransferID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; + String correctPath = "/BankTransfers/{BankTransferID}/Attachments"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String path = "/BankTransfers/{BankTransferID}/Attachments"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9154,41 +3958,47 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTen // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); + uriVariables.put("BankTransferID", bankTransferID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, String contentType, Map params) throws IOException { + /** + * Allows you to retrieve history from a bank transfers + *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBankTransferHistoryForHttpResponse( String xeroTenantId, UUID bankTransferID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); + }// verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; - + String correctPath = "/BankTransfers/{BankTransferID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String path = "/BankTransfers/{BankTransferID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9197,151 +4007,105 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String xeroTen // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); + uriVariables.put("BankTransferID", bankTransferID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve specific Attachment on Account - *

200 - Success - return response of attachment for Account as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param attachmentID Unique identifier for Attachment object - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to retrieve specific Attachment on Account - *

200 - Success - return response of attachment for Account as binary data + * Allows you to retrieve all bank transfers + *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param attachmentID Unique identifier for Attachment object - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - + public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { + public HttpResponse getBankTransfersForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getAccountAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("AttachmentID", attachmentID); + String correctPath = "/BankTransfers"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType, Map params) throws IOException { + /** + * Allows you to retrieve history from a Batch Payment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + * @param xeroTenantId Xero identifier for Tenant + * @param batchPaymentID Unique identifier for BatchPayment + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID) throws IOException { + HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBatchPaymentHistoryForHttpResponse( String xeroTenantId, UUID batchPaymentID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getAccountAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); + }// verify the required parameter 'batchPaymentID' is set + if (batchPaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; - + String correctPath = "/BatchPayments/{BatchPaymentID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; + String path = "/BatchPayments/{BatchPaymentID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9350,82 +4114,105 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse(String xeroTenantId, // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("AttachmentID", attachmentID); + uriVariables.put("BatchPaymentID", batchPaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve Attachments for accounts - *

200 - Success - return response of type Attachments array of Attachment + * Retrieve either one or many BatchPayments for invoices + *

200 - Success - return response of type BatchPayments array of BatchPayment objects * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @return Attachments + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) throws IOException { - HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID); - TypeReference typeRef = new TypeReference() {}; + public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + public HttpResponse getBatchPaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/BatchPayments"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + /** - * Allows you to retrieve Attachments for accounts - *

200 - Success - return response of type Attachments array of Attachment + * Allows you to retrieve a specific BrandingThemes + *

200 - Success - return response of type BrandingThemes with one BrandingTheme * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments + * @param brandingThemeID Unique identifier for a Branding Theme + * @return BrandingThemes * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getAccountAttachments(String xeroTenantId, UUID accountID, Map params) throws IOException { - HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID, params); - TypeReference typeRef = new TypeReference() {}; + public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID) throws IOException { + HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UUID accountID) throws IOException { + public HttpResponse getBrandingThemeForHttpResponse( String xeroTenantId, UUID brandingThemeID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments"; + String correctPath = "/BrandingThemes/{BrandingThemeID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments"; + String path = "/BrandingThemes/{BrandingThemeID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9434,34 +4221,47 @@ public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UU // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); + uriVariables.put("BrandingThemeID", brandingThemeID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UUID accountID, Map params) throws IOException { + /** + * Allows you to retrieve the Payment services for a Branding Theme + *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService + * @param xeroTenantId Xero identifier for Tenant + * @param brandingThemeID Unique identifier for a Branding Theme + * @return PaymentServices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID) throws IOException { + HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getBrandingThemePaymentServicesForHttpResponse( String xeroTenantId, UUID brandingThemeID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set + if (brandingThemeID == null) { + throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments"; - + String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments"; + String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9470,193 +4270,81 @@ public HttpResponse getAccountAttachmentsForHttpResponse(String xeroTenantId, UU // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); + uriVariables.put("BrandingThemeID", brandingThemeID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve the full chart of accounts - *

200 - Success - return response of type Accounts array with 0 to n Account - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getAccountsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve the full chart of accounts - *

200 - Success - return response of type Accounts array with 0 to n Account + * Allows you to retrieve all the BrandingThemes + *

200 - Success - return response of type BrandingThemes * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Accounts + * @return BrandingThemes * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccounts(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getAccountsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; + public BrandingThemes getBrandingThemes(String xeroTenantId) throws IOException { + HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getAccountsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Accounts"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getAccountsForHttpResponse(String xeroTenantId, Map params) throws IOException { + public HttpResponse getBrandingThemesForHttpResponse( String xeroTenantId) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts"; + String correctPath = "/BrandingThemes"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve a single spend or receive money transaction - *

200 - Success - return response of type BankTransactions array with a specific BankTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve a single spend or receive money transaction - *

200 - Success - return response of type BankTransactions array with a specific BankTransaction + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Contacts array with a unique Contact * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransactions + * @param contactID Unique identifier for a Contact + * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { - HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, params); - TypeReference typeRef = new TypeReference() {}; + public Contacts getContact(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { + public HttpResponse getContactForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContact"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}"; + String correctPath = "/Contacts/{ContactID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}"; + String path = "/Contacts/{ContactID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9665,34 +4353,56 @@ public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + /** + * Allows you to retrieve Attachments on Contacts by file name + *

200 - Success - return response of attachment for Contact as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @param fileName Name for the file you are attaching + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ByteArrayInputStream getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { + HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + + } + + public HttpResponse getContactAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}"; - + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}"; + String path = "/Contacts/{ContactID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9701,107 +4411,57 @@ public HttpResponse getBankTransactionForHttpResponse(String xeroTenantId, UUID // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("ContactID", contactID); + uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachments on BankTransaction by Filename - *

200 - Success - return response of attachment for BankTransaction as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName The name of the file being attached - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { - HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to retrieve Attachments on BankTransaction by Filename - *

200 - Success - return response of attachment for BankTransaction as binary data + * Allows you to retrieve Attachments on Contacts + *

200 - Success - return response of attachment for Contact as binary data * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName The name of the file being attached + * @param contactID Unique identifier for a Contact + * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType, params); + public ByteArrayInputStream getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType); InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } + return convertInputToByteArray(is); } - public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { + public HttpResponse getContactAttachmentByIdForHttpResponse( String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransactionAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getContactAttachmentById"); }// verify the required parameter 'contentType' is set if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String correctPath = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String path = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9810,41 +4470,48 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); + uriVariables.put("ContactID", contactID); + uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType, Map params) throws IOException { + /** + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Attachments array with 0 to N Attachment + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getContactAttachments(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactAttachmentsForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - + String correctPath = "/Contacts/{ContactID}/Attachments"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String path = "/Contacts/{ContactID}/Attachments"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9853,108 +4520,47 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); + uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachments on a specific BankTransaction - *

200 - Success - return response of attachment for BankTransaction as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param attachmentID Xero generated unique identifier for an attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to retrieve Attachments on a specific BankTransaction - *

200 - Success - return response of attachment for BankTransaction as binary data + * Allows you to retrieve CISSettings for a contact in a Xero organisation + *

200 - Success - return response of type CISSettings for a specific Contact * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param attachmentID Xero generated unique identifier for an attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File + * @param contactID Unique identifier for a Contact + * @return CISSettings * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - + public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { + public HttpResponse getContactCISSettingsForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; + String correctPath = "/Contacts/{ContactID}/CISSettings"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; + String path = "/Contacts/{ContactID}/CISSettings"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -9963,41 +4569,47 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroT // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("AttachmentID", attachmentID); + uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType, Map params) throws IOException { + /** + * Allows you to retrieve a unique Contract Group by ID + *

200 - Success - return response of type Contact Groups array with a specific Contact Group + * @param xeroTenantId Xero identifier for Tenant + * @param contactGroupID Unique identifier for a Contact Group + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) throws IOException { + HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactGroupForHttpResponse( String xeroTenantId, UUID contactGroupID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroup"); + }// verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; - + String correctPath = "/ContactGroups/{ContactGroupID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; + String path = "/ContactGroups/{ContactGroupID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -10006,118 +4618,104 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String xeroT // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("AttachmentID", attachmentID); + uriVariables.put("ContactGroupID", contactGroupID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve any attachments to bank transactions - *

200 - Success - return response of type Attachments array with 0 to n Attachment + * Allows you to retrieve the ContactID and Name of all the contacts in a contact group + *

200 - Success - return response of type Contact Groups array of Contact Group * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any attachments to bank transactions - *

200 - Success - return response of type Attachments array with 0 to n Attachment - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments + * @param where Filter by an any element + * @param order Order by an any element + * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { - HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID, params); - TypeReference typeRef = new TypeReference() {}; + public ContactGroups getContactGroups(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, where, order); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { + public HttpResponse getContactGroupsForHttpResponse( String xeroTenantId, String where, String order) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); + String correctPath = "/ContactGroups"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + /** + * Allows you to retrieve a history records of an Contact + *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact + * @param xeroTenantId Xero identifier for Tenant + * @param contactID Unique identifier for a Contact + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getContactHistoryForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactHistory"); + }// verify the required parameter 'contactID' is set + if (contactID == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments"; - + String correctPath = "/Contacts/{ContactID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments"; + String path = "/Contacts/{ContactID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -10126,79 +4724,47 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse(String xeroTena // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve any spend or receive money transactions - *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction + * Allows you to retrieve, add and update contacts in a Xero organisation + *

200 - Success - return response of type Contacts array with 0 to N Contact * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 bank transactions will be returned in a single API call with line items shown for each bank transaction - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any spend or receive money transactions - *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransactions + * @param ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. + * @param page e.g. page=1 - Up to 100 contacts will be returned in a single API call. + * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response + * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions getBankTransactions(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; + public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + HttpResponse response = getContactsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, page, includeArchived); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + public HttpResponse getContactsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions"; + String correctPath = "/Contacts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -10221,6 +4787,16 @@ public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Offs } else { uriBuilder = uriBuilder.queryParam(key, value); } + } if (ids != null) { + String key = "IDs"; + Object value = ids; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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; @@ -10231,9 +4807,9 @@ public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Offs } else { uriBuilder = uriBuilder.queryParam(key, value); } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; + } if (includeArchived != null) { + String key = "includeArchived"; + Object value = includeArchived; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } else if (value instanceof Object[]) { @@ -10246,95 +4822,40 @@ public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Offs String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getBankTransactionsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransactions"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve history from a bank transactions - *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve history from a bank transactions - *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord + * Allows you to retrieve a specific credit note + *

200 - Success - return response of type Credit Notes array with a unique CreditNote * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords + * @param creditNoteID Unique identifier for a Credit Note + * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { - HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID, params); - TypeReference typeRef = new TypeReference() {}; + public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantId, UUID bankTransactionID) throws IOException { + public HttpResponse getCreditNoteForHttpResponse( String xeroTenantId, UUID creditNoteID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNote"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/History"; + String correctPath = "/CreditNotes/{CreditNoteID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/History"; + String path = "/CreditNotes/{CreditNoteID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -10343,34 +4864,52 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantI // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantId, UUID bankTransactionID, Map params) throws IOException { + /** + * Allows you to retrieve Credit Note as PDF files + *

200 - Success - return response of binary data from the Attachment to a Credit Note + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ByteArrayInputStream getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { + HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + + } + + public HttpResponse getCreditNoteAsPdfForHttpResponse( String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/History"; - + String correctPath = "/CreditNotes/{CreditNoteID}/pdf"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/History"; + String path = "/CreditNotes/{CreditNoteID}/pdf"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -10379,81 +4918,56 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse(String xeroTenantI // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve any bank transfers - *

200 - Success - return response of BankTransfers array with one BankTransfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @return BankTransfers - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to retrieve any bank transfers - *

200 - Success - return response of BankTransfers array with one BankTransfer + * Allows you to retrieve Attachments on CreditNote by file name + *

200 - Success - return response of attachment for Credit Note as binary data * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransfers + * @param creditNoteID Unique identifier for a Credit Note + * @param fileName Name of the file you are attaching to Credit Note + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { - HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public ByteArrayInputStream getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { + HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + } - public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { + public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}"; + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}"; + String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -10462,34 +4976,57 @@ public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID ban // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + /** + * Allows you to retrieve Attachments on CreditNote + *

200 - Success - return response of attachment for Credit Note as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ByteArrayInputStream getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + + } + + public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}"; - + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}"; + String path = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -10498,107 +5035,48 @@ public HttpResponse getBankTransferForHttpResponse(String xeroTenantId, UUID ban // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachments on BankTransfer by file name - *

200 - Success - return response of binary data from the Attachment to a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName The name of the file being attached to a Bank Transfer - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { - HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to retrieve Attachments on BankTransfer by file name - *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * Allows you to retrieve Attachments for credit notes + *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName The name of the file being attached to a Bank Transfer - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File + * @param creditNoteID Unique identifier for a Credit Note + * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - + public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { + public HttpResponse getCreditNoteAttachmentsForHttpResponse( String xeroTenantId, UUID creditNoteID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String path = "/CreditNotes/{CreditNoteID}/Attachments"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -10607,41 +5085,47 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xe // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); + uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, String contentType, Map params) throws IOException { + /** + * Allows you to retrieve a history records of an CreditNote + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note + * @param xeroTenantId Xero identifier for Tenant + * @param creditNoteID Unique identifier for a Credit Note + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCreditNoteHistoryForHttpResponse( String xeroTenantId, UUID creditNoteID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - + String correctPath = "/CreditNotes/{CreditNoteID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String path = "/CreditNotes/{CreditNoteID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -10650,235 +5134,173 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String xe // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); + uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve Attachments on BankTransfer - *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * Allows you to retrieve any credit notes + *

200 - Success - return response of type Credit Notes array of CreditNote * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note + * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - + public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to retrieve Attachments on BankTransfer - *

200 - Success - return response of binary data from the Attachment to a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { + public HttpResponse getCreditNotesForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("AttachmentID", attachmentID); + String correctPath = "/CreditNotes"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType, Map params) throws IOException { + /** + * Allows you to retrieve currencies for your organisation + *

200 - Success - return response of type Currencies array with all Currencies + * @param xeroTenantId Xero identifier for Tenant + * @param where Filter by an any element + * @param order Order by an any element + * @return Currencies + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Currencies getCurrencies(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getCurrenciesForHttpResponse( String xeroTenantId, String where, String order) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("AttachmentID", attachmentID); + String correctPath = "/Currencies"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve Attachments from bank transfers - *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve Attachments from bank transfers - *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + * Allows you to retrieve a specific employee used in Xero payrun + *

200 - Success - return response of type Employees array with specified Employee * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments + * @param employeeID Unique identifier for a Employee + * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { - HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID, params); - TypeReference typeRef = new TypeReference() {}; + public Employees getEmployee(String xeroTenantId, UUID employeeID) throws IOException { + HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { + public HttpResponse getEmployeeForHttpResponse( 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 getBankTransferAttachments"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); + 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"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments"; + String correctPath = "/Employees/{EmployeeID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments"; + String path = "/Employees/{EmployeeID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -10887,117 +5309,105 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantI // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("EmployeeID", employeeID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBankTransferAttachmentsForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + /** + * Allows you to retrieve employees used in Xero payrun + *

200 - Success - return response of type Employees array with all Employee + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getEmployeesForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); + String correctPath = "/Employees"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve history from a bank transfers - *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer + * Allows you to retrieve a specified expense claim + *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @return HistoryRecords + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID); - TypeReference typeRef = new TypeReference() {}; + public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID) throws IOException { + HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to retrieve history from a bank transfers - *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { - HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, UUID bankTransferID) throws IOException { + public HttpResponse getExpenseClaimForHttpResponse( String xeroTenantId, UUID expenseClaimID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/History"; + String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/History"; + String path = "/ExpenseClaims/{ExpenseClaimID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -11006,34 +5416,47 @@ public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, U // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("ExpenseClaimID", expenseClaimID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, UUID bankTransferID, Map params) throws IOException { + /** + * Allows you to retrieve a history records of an ExpenseClaim + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID) throws IOException { + HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getExpenseClaimHistoryForHttpResponse( String xeroTenantId, UUID expenseClaimID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/History"; - + String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/History"; + String path = "/ExpenseClaims/{ExpenseClaimID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -11042,77 +5465,44 @@ public HttpResponse getBankTransferHistoryForHttpResponse(String xeroTenantId, U // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("ExpenseClaimID", expenseClaimID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve all bank transfers - *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer + * Allows you to retrieve expense claims + *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element - * @return BankTransfers - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve all bank transfers - *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransfers + * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfers(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; + public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + public HttpResponse getExpenseClaimsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers"; + String correctPath = "/ExpenseClaims"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -11140,95 +5530,94 @@ public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, OffsetD String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBankTransfersForHttpResponse(String xeroTenantId, Map params) throws IOException { + /** + * Allows you to retrieve a specified sales invoice or purchase bill + *

200 - Success - return response of type Invoices array with specified Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices getInvoice(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers"; + String correctPath = "/Invoices/{InvoiceID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Invoices/{InvoiceID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - } - - String url = uriBuilder.build().toString(); + String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve history from a Batch Payment - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * @param xeroTenantId Xero identifier for Tenant - * @param batchPaymentID Unique identifier for BatchPayment - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID) throws IOException { - HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve history from a Batch Payment - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + * Allows you to retrieve invoices or purchase bills as PDF files + *

200 - Success - return response of byte array pdf version of specified Invoices * @param xeroTenantId Xero identifier for Tenant - * @param batchPaymentID Unique identifier for BatchPayment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords + * @param invoiceID Unique identifier for an Invoice + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID, Map params) throws IOException { - HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public ByteArrayInputStream getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { + HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + } - public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, UUID batchPaymentID) throws IOException { + public HttpResponse getInvoiceAsPdfForHttpResponse( String xeroTenantId, UUID invoiceID, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); - }// verify the required parameter 'batchPaymentID' is set - if (batchPaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BatchPayments/{BatchPaymentID}/History"; + String correctPath = "/Invoices/{InvoiceID}/pdf"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BatchPayments/{BatchPaymentID}/History"; + String path = "/Invoices/{InvoiceID}/pdf"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -11237,34 +5626,56 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, U // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID); + uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, UUID batchPaymentID, Map params) throws IOException { + /** + * Allows you to retrieve Attachment on invoices or purchase bills by it's filename + *

200 - Success - return response of attachment for Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @param fileName Name of the file you are attaching + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ByteArrayInputStream getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { + HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + + } + + public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); - }// verify the required parameter 'batchPaymentID' is set - if (batchPaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BatchPayments/{BatchPaymentID}/History"; - + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BatchPayments/{BatchPaymentID}/History"; + String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -11273,193 +5684,57 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse(String xeroTenantId, U // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BatchPaymentID", batchPaymentID); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Retrieve either one or many BatchPayments for invoices - *

200 - Success - return response of type BatchPayments array of BatchPayment objects + * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID + *

200 - Success - return response of attachment for Invoice as binary data * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @return BatchPayments + * @param invoiceID Unique identifier for an Invoice + * @param attachmentID Unique identifier for an Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public ByteArrayInputStream getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + } - /** - * Retrieve either one or many BatchPayments for invoices - *

200 - Success - return response of type BatchPayments array of BatchPayment objects - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BatchPayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BatchPayments getBatchPayments(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BatchPayments"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getBatchPaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BatchPayments"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specific BrandingThemes - *

200 - Success - return response of type BrandingThemes with one BrandingTheme - * @param xeroTenantId Xero identifier for Tenant - * @param brandingThemeID Unique identifier for a Branding Theme - * @return BrandingThemes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID) throws IOException { - HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specific BrandingThemes - *

200 - Success - return response of type BrandingThemes with one BrandingTheme - * @param xeroTenantId Xero identifier for Tenant - * @param brandingThemeID Unique identifier for a Branding Theme - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BrandingThemes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { - HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID brandingThemeID) throws IOException { + public HttpResponse getInvoiceAttachmentByIdForHttpResponse( String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BrandingThemes/{BrandingThemeID}"; + String correctPath = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}"; + String path = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -11468,34 +5743,48 @@ public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID br // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); + uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + /** + * Allows you to retrieve Attachments on invoices or purchase bills + *

200 - Success - return response of type Attachments array of Attachments for specified Invoices + * @param xeroTenantId Xero identifier for Tenant + * @param invoiceID Unique identifier for an Invoice + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceAttachmentsForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BrandingThemes/{BrandingThemeID}"; - + String correctPath = "/Invoices/{InvoiceID}/Attachments"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}"; + String path = "/Invoices/{InvoiceID}/Attachments"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -11504,81 +5793,47 @@ public HttpResponse getBrandingThemeForHttpResponse(String xeroTenantId, UUID br // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); + uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve the Payment services for a Branding Theme - *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService - * @param xeroTenantId Xero identifier for Tenant - * @param brandingThemeID Unique identifier for a Branding Theme - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID) throws IOException { - HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve the Payment services for a Branding Theme - *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService + * Allows you to retrieve a history records of an invoice + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice * @param xeroTenantId Xero identifier for Tenant - * @param brandingThemeID Unique identifier for a Branding Theme - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PaymentServices + * @param invoiceID Unique identifier for an Invoice + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { - HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, params); - TypeReference typeRef = new TypeReference() {}; + public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID) throws IOException { + public HttpResponse getInvoiceHistoryForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + String correctPath = "/Invoices/{InvoiceID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; + String path = "/Invoices/{InvoiceID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -11587,205 +5842,227 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTe // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); + uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String xeroTenantId, UUID brandingThemeID, Map params) throws IOException { + /** + * Allows you to retrieve invoice reminder settings + *

200 - Success - return response of Invoice Reminders + * @param xeroTenantId Xero identifier for Tenant + * @return InvoiceReminders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws IOException { + HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInvoiceRemindersForHttpResponse( String xeroTenantId) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); - }// verify the required parameter 'brandingThemeID' is set - if (brandingThemeID == null) { - throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BrandingThemeID", brandingThemeID); + String correctPath = "/InvoiceReminders/Settings"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - } - - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve all the BrandingThemes - *

200 - Success - return response of type BrandingThemes + * Allows you to retrieve any sales invoices or purchase bills + *

200 - Success - return response of type Invoices array with all Invoices * @param xeroTenantId Xero identifier for Tenant - * @return BrandingThemes + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param ids Filter by a comma-separated list of InvoicesIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. + * @param invoiceNumbers Filter by a comma-separated list of InvoiceNumbers. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. + * @param contactIDs Filter by a comma-separated list of ContactIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. + * @param statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. + * @param page e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice + * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response + * @param createdByMyApp When set to true you'll only retrieve Invoices created by your app + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public BrandingThemes getBrandingThemes(String xeroTenantId) throws IOException { - HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId); - TypeReference typeRef = new TypeReference() {}; + public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to retrieve all the BrandingThemes - *

200 - Success - return response of type BrandingThemes - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BrandingThemes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BrandingThemes getBrandingThemes(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BrandingThemes"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getBrandingThemesForHttpResponse(String xeroTenantId, Map params) throws IOException { + public HttpResponse getInvoicesForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BrandingThemes"; + String correctPath = "/Invoices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (ids != null) { + String key = "IDs"; + Object value = ids; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (invoiceNumbers != null) { + String key = "InvoiceNumbers"; + Object value = invoiceNumbers; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (contactIDs != null) { + String key = "ContactIDs"; + Object value = contactIDs; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (statuses != null) { + String key = "Statuses"; + Object value = statuses; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (includeArchived != null) { + String key = "includeArchived"; + Object value = includeArchived; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (createdByMyApp != null) { + String key = "createdByMyApp"; + Object value = createdByMyApp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Contacts array with a unique Contact - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts getContact(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Contacts array with a unique Contact + * Allows you to retrieve a specified item + *

200 - Success - return response of type Items array with specified Item * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Contacts + * @param itemID Unique identifier for an Item + * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContact(String xeroTenantId, UUID contactID, Map params) throws IOException { - HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID, params); - TypeReference typeRef = new TypeReference() {}; + public Items getItem(String xeroTenantId, UUID itemID) throws IOException { + HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + public HttpResponse getItemForHttpResponse( String xeroTenantId, UUID itemID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItem"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}"; + String correctPath = "/Items/{ItemID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}"; + String path = "/Items/{ItemID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -11794,34 +6071,47 @@ public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactI // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); + uriVariables.put("ItemID", itemID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + /** + * Allows you to retrieve history for items + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item + * @param xeroTenantId Xero identifier for Tenant + * @param itemID Unique identifier for an Item + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws IOException { + HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getItemHistoryForHttpResponse( String xeroTenantId, UUID itemID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItemHistory"); + }// verify the required parameter 'itemID' is set + if (itemID == null) { + throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}"; - + String correctPath = "/Items/{ItemID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}"; + String path = "/Items/{ItemID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -11830,150 +6120,116 @@ public HttpResponse getContactForHttpResponse(String xeroTenantId, UUID contactI // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); + uriVariables.put("ItemID", itemID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve Attachments on Contacts by file name - *

200 - Success - return response of attachment for Contact as binary data + * Allows you to retrieve any items + *

200 - Success - return response of type Items array with all Item * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name for the file you are attaching - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { - HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - + public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpResponse response = getItemsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to retrieve Attachments on Contacts by file name - *

200 - Success - return response of attachment for Contact as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name for the file you are attaching - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { + public HttpResponse getItemsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); + String correctPath = "/Items"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, String contentType, Map params) throws IOException { + /** + * Allows you to retrieve a specified journals. + *

200 - Success - return response of type Journals array with specified Journal + * @param xeroTenantId Xero identifier for Tenant + * @param journalID Unique identifier for a Journal + * @return Journals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Journals getJournal(String xeroTenantId, UUID journalID) throws IOException { + HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getJournalForHttpResponse( String xeroTenantId, UUID journalID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournal"); + }// verify the required parameter 'journalID' is set + if (journalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; - + String correctPath = "/Journals/{JournalID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{FileName}"; + String path = "/Journals/{JournalID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -11982,151 +6238,105 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse(String xeroTen // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); + uriVariables.put("JournalID", journalID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachments on Contacts - *

200 - Success - return response of attachment for Contact as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to retrieve Attachments on Contacts - *

200 - Success - return response of attachment for Contact as binary data + * Allows you to retrieve any journals. + *

200 - Success - return response of type Journals array with all Journals * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned + * @param paymentsOnly Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. + * @return Journals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - + public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { + HttpResponse response = getJournalsForHttpResponse(xeroTenantId, ifModifiedSince, offset, paymentsOnly); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { + public HttpResponse getJournalsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getContactAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("AttachmentID", attachmentID); + String correctPath = "/Journals"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (offset != null) { + String key = "offset"; + Object value = offset; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType, Map params) throws IOException { + /** + * Allows you to retrieve a specified linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { + HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getLinkedTransactionForHttpResponse( String xeroTenantId, UUID linkedTransactionID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getContactAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; - + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; + String path = "/LinkedTransactions/{LinkedTransactionID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -12135,82 +6345,148 @@ public HttpResponse getContactAttachmentByIdForHttpResponse(String xeroTenantId, // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("AttachmentID", attachmentID); + uriVariables.put("LinkedTransactionID", linkedTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Attachments array with 0 to N Attachment + * Retrieve linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @return Attachments + * @param page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. + * @param linkedTransactionID The Xero identifier for an Linked Transaction + * @param sourceTransactionID Filter by the SourceTransactionID. Get all the linked transactions created from a particular ACCPAY invoice + * @param contactID Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. + * @param status Filter by the combination of ContactID and Status. Get all the linked transactions that have been assigned to a particular customer and have a particular status e.g. GET /LinkedTransactions?ContactID=4bb34b03-3378-4bb2-a0ed-6345abf3224e&Status=APPROVED. + * @param targetTransactionID Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice + * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getContactAttachments(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID); - TypeReference typeRef = new TypeReference() {}; + public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { + HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + public HttpResponse getLinkedTransactionsForHttpResponse( String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/LinkedTransactions"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (page != null) { + String key = "page"; + Object value = page; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (linkedTransactionID != null) { + String key = "LinkedTransactionID"; + Object value = linkedTransactionID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (sourceTransactionID != null) { + String key = "SourceTransactionID"; + Object value = sourceTransactionID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (contactID != null) { + String key = "ContactID"; + Object value = contactID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (targetTransactionID != null) { + String key = "TargetTransactionID"; + Object value = targetTransactionID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Attachments array with 0 to N Attachment + * Allows you to retrieve a specified manual journals + *

200 - Success - return response of type ManualJournals array with a specified ManualJournals * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments + * @param manualJournalID Unique identifier for a ManualJournal + * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getContactAttachments(String xeroTenantId, UUID contactID, Map params) throws IOException { - HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID, params); - TypeReference typeRef = new TypeReference() {}; + public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID) throws IOException { + HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + public HttpResponse getManualJournalForHttpResponse( String xeroTenantId, UUID manualJournalID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournal"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/Attachments"; + String correctPath = "/ManualJournals/{ManualJournalID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments"; + String path = "/ManualJournals/{ManualJournalID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -12219,34 +6495,56 @@ public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UU // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); + uriVariables.put("ManualJournalID", manualJournalID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + /** + * Allows you to retrieve specified Attachment on ManualJournal by file name + *

200 - Success - return response of attachment for Manual Journal as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @param fileName The name of the file being attached to a ManualJournal + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ByteArrayInputStream getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { + HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + + } + + public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/Attachments"; - + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments"; + String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -12255,81 +6553,57 @@ public HttpResponse getContactAttachmentsForHttpResponse(String xeroTenantId, UU // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve CISSettings for a contact in a Xero organisation - *

200 - Success - return response of type CISSettings for a specific Contact - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @return CISSettings - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve CISSettings for a contact in a Xero organisation - *

200 - Success - return response of type CISSettings for a specific Contact + * Allows you to retrieve specified Attachment on ManualJournals + *

200 - Success - return response of attachment for Manual Journal as binary data * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CISSettings + * @param manualJournalID Unique identifier for a ManualJournal + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID, Map params) throws IOException { - HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public ByteArrayInputStream getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + } - public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + public HttpResponse getManualJournalAttachmentByIdForHttpResponse( String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/CISSettings"; + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/CISSettings"; + String path = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -12338,34 +6612,48 @@ public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UU // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + /** + * Allows you to retrieve Attachment for manual journals + *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournalID Unique identifier for a ManualJournal + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID) throws IOException { + HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getManualJournalAttachmentsForHttpResponse( String xeroTenantId, UUID manualJournalID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/CISSettings"; - + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/CISSettings"; + String path = "/ManualJournals/{ManualJournalID}/Attachments"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -12374,81 +6662,116 @@ public HttpResponse getContactCISSettingsForHttpResponse(String xeroTenantId, UU // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); + uriVariables.put("ManualJournalID", manualJournalID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve a unique Contract Group by ID - *

200 - Success - return response of type Contact Groups array with a specific Contact Group + * Allows you to retrieve any manual journals + *

200 - Success - return response of type ManualJournals array with a all ManualJournals * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @return ContactGroups + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment + * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) throws IOException { - HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID); - TypeReference typeRef = new TypeReference() {}; + public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + public HttpResponse getManualJournalsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/ManualJournals"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + /** - * Allows you to retrieve a unique Contract Group by ID - *

200 - Success - return response of type Contact Groups array with a specific Contact Group + * Allows you to retrieve a URL to an online invoice + *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ContactGroups + * @param invoiceID Unique identifier for an Invoice + * @return OnlineInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { - HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID, params); - TypeReference typeRef = new TypeReference() {}; + public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID) throws IOException { + public HttpResponse getOnlineInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroup"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); + }// verify the required parameter 'invoiceID' is set + if (invoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups/{ContactGroupID}"; + String correctPath = "/Invoices/{InvoiceID}/OnlineInvoice"; // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}"; + String path = "/Invoices/{InvoiceID}/OnlineInvoice"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -12457,34 +6780,47 @@ public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID con // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); + uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, Map params) throws IOException { + /** + * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. + *

200 - Success - return response of type Organisation array with specified Organisation + * @param xeroTenantId Xero identifier for Tenant + * @param organisationID The organisationID parameter + * @return CISOrgSetting + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID) throws IOException { + HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getOrganisationCISSettingsForHttpResponse( String xeroTenantId, UUID organisationID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroup"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); + }// verify the required parameter 'organisationID' is set + if (organisationID == null) { + throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups/{ContactGroupID}"; - + String correctPath = "/Organisation/{OrganisationID}/CISSettings"; // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}"; + String path = "/Organisation/{OrganisationID}/CISSettings"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -12493,192 +6829,81 @@ public HttpResponse getContactGroupForHttpResponse(String xeroTenantId, UUID con // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); + uriVariables.put("OrganisationID", organisationID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve the ContactID and Name of all the contacts in a contact group - *

200 - Success - return response of type Contact Groups array of Contact Group - * @param xeroTenantId Xero identifier for Tenant - * @param where Filter by an any element - * @param order Order by an any element - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups getContactGroups(String xeroTenantId, String where, String order) throws IOException { - HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve the ContactID and Name of all the contacts in a contact group - *

200 - Success - return response of type Contact Groups array of Contact Group + * Allows you to retrieve Organisation details + *

200 - Success - return response of type Organisation array with all Organisation * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ContactGroups + * @return Organisations * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroups(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; + public Organisations getOrganisations(String xeroTenantId) throws IOException { + HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ContactGroups"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getContactGroupsForHttpResponse(String xeroTenantId, Map params) throws IOException { + public HttpResponse getOrganisationsForHttpResponse( String xeroTenantId) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups"; + String correctPath = "/Organisation"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve a history records of an Contact - *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve a history records of an Contact - *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact + * Allows you to retrieve a specified overpayments + *

200 - Success - return response of type Overpayments array with specified Overpayments * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords + * @param overpaymentID Unique identifier for a Overpayment + * @return Overpayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID, Map params) throws IOException { - HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID, params); - TypeReference typeRef = new TypeReference() {}; + public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID) throws IOException { + HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID contactID) throws IOException { + public HttpResponse getOverpaymentForHttpResponse( String xeroTenantId, UUID overpaymentID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactHistory"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayment"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/History"; + String correctPath = "/Overpayments/{OverpaymentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/History"; + String path = "/Overpayments/{OverpaymentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -12687,34 +6912,47 @@ public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID c // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); + uriVariables.put("OverpaymentID", overpaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID contactID, Map params) throws IOException { + /** + * Allows you to retrieve a history records of an Overpayment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID) throws IOException { + HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getOverpaymentHistoryForHttpResponse( String xeroTenantId, UUID overpaymentID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactHistory"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/History"; - + String correctPath = "/Overpayments/{OverpaymentID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/History"; + String path = "/Overpayments/{OverpaymentID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -12723,80 +6961,46 @@ public HttpResponse getContactHistoryForHttpResponse(String xeroTenantId, UUID c // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); + uriVariables.put("OverpaymentID", overpaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Contacts array with 0 to N Contact + * Allows you to retrieve overpayments + *

200 - Success - return response of type Overpayments array with all Overpayments * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element - * @param ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. - * @param page e.g. page=1 - Up to 100 contacts will be returned in a single API call. - * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { - HttpResponse response = getContactsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, page, includeArchived); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve, add and update contacts in a Xero organisation - *

200 - Success - return response of type Contacts array with 0 to N Contact - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Contacts + * @param page e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return Overpayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContacts(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getContactsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; + public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + public HttpResponse getOverpaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts"; + String correctPath = "/Overpayments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -12819,16 +7023,6 @@ public HttpResponse getContactsForHttpResponse(String xeroTenantId, OffsetDateTi } else { uriBuilder = uriBuilder.queryParam(key, value); } - } if (ids != null) { - String key = "IDs"; - Object value = ids; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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; @@ -12839,9 +7033,9 @@ public HttpResponse getContactsForHttpResponse(String xeroTenantId, OffsetDateTi } else { uriBuilder = uriBuilder.queryParam(key, value); } - } if (includeArchived != null) { - String key = "includeArchived"; - Object value = includeArchived; + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } else if (value instanceof Object[]) { @@ -12854,95 +7048,40 @@ public HttpResponse getContactsForHttpResponse(String xeroTenantId, OffsetDateTi String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getContactsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Contacts"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve a specific credit note - *

200 - Success - return response of type Credit Notes array with a unique CreditNote - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve a specific credit note - *

200 - Success - return response of type Credit Notes array with a unique CreditNote + * Allows you to retrieve a specified payment for invoices and credit notes + *

200 - Success - return response of type Payments array for specified Payment * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CreditNotes + * @param paymentID Unique identifier for a Payment + * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { - HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID, params); - TypeReference typeRef = new TypeReference() {}; + public Payments getPayment(String xeroTenantId, UUID paymentID) throws IOException { + HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { + public HttpResponse getPaymentForHttpResponse( String xeroTenantId, UUID paymentID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNote"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayment"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}"; + String correctPath = "/Payments/{PaymentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}"; + String path = "/Payments/{PaymentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -12951,34 +7090,47 @@ public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID credi // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("PaymentID", paymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + /** + * Allows you to retrieve history records of a payment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments + * @param xeroTenantId Xero identifier for Tenant + * @param paymentID Unique identifier for a Payment + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) throws IOException { + HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPaymentHistoryForHttpResponse( String xeroTenantId, UUID paymentID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNote"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}"; - + String correctPath = "/Payments/{PaymentID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}"; + String path = "/Payments/{PaymentID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -12987,250 +7139,139 @@ public HttpResponse getCreditNoteForHttpResponse(String xeroTenantId, UUID credi // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("PaymentID", paymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Credit Note as PDF files - *

200 - Success - return response of binary data from the Attachment to a Credit Note - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { - HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to retrieve Credit Note as PDF files - *

200 - Success - return response of binary data from the Attachment to a Credit Note + * Allows you to retrieve payment services + *

200 - Success - return response of type PaymentServices array for all PaymentService * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File + * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType, Map params) throws IOException { - HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - + public PaymentServices getPaymentServices(String xeroTenantId) throws IOException { + HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { + public HttpResponse getPaymentServicesForHttpResponse( String xeroTenantId) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/pdf"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/pdf"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); + String correctPath = "/PaymentServices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getCreditNoteAsPdfForHttpResponse(String xeroTenantId, UUID creditNoteID, String contentType, Map params) throws IOException { + /** + * Allows you to retrieve payments for invoices and credit notes + *

200 - Success - return response of type Payments array for all Payments + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments getPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/pdf"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/pdf"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); + String correctPath = "/Payments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachments on CreditNote by file name - *

200 - Success - return response of attachment for Credit Note as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the file you are attaching to Credit Note - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { - HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to retrieve Attachments on CreditNote by file name - *

200 - Success - return response of attachment for Credit Note as binary data + * Allows you to retrieve a specified prepayments + *

200 - Success - return response of type Prepayments array for a specified Prepayment * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the file you are attaching to Credit Note - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File + * @param prepaymentID Unique identifier for a PrePayment + * @return Prepayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - + public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID) throws IOException { + HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { + public HttpResponse getPrepaymentForHttpResponse( String xeroTenantId, UUID prepaymentID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayment"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + String correctPath = "/Prepayments/{PrepaymentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + String path = "/Prepayments/{PrepaymentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -13239,41 +7280,47 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xero // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); + uriVariables.put("PrepaymentID", prepaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, String contentType, Map params) throws IOException { + /** + * Allows you to retrieve a history records of an Prepayment + *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment + * @param xeroTenantId Xero identifier for Tenant + * @param prepaymentID Unique identifier for a PrePayment + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID) throws IOException { + HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPrepaymentHistoryForHttpResponse( String xeroTenantId, UUID prepaymentID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set + if (prepaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - + String correctPath = "/Prepayments/{PrepaymentID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + String path = "/Prepayments/{PrepaymentID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -13282,151 +7329,127 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String xero // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); + uriVariables.put("PrepaymentID", prepaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachments on CreditNote - *

200 - Success - return response of attachment for Credit Note as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to retrieve Attachments on CreditNote - *

200 - Success - return response of attachment for Credit Note as binary data + * Allows you to retrieve prepayments + *

200 - Success - return response of type Prepayments array for all Prepayment * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return Prepayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - + public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { + public HttpResponse getPrepaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("AttachmentID", attachmentID); + String correctPath = "/Prepayments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType, Map params) throws IOException { + /** + * Allows you to retrieve a specified purchase orders + *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID) throws IOException { + HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPurchaseOrderForHttpResponse( String xeroTenantId, UUID purchaseOrderID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; - + String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; + String path = "/PurchaseOrders/{PurchaseOrderID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -13435,82 +7458,47 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String xeroTenant // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("AttachmentID", attachmentID); + uriVariables.put("PurchaseOrderID", purchaseOrderID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve Attachments for credit notes - *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve Attachments for credit notes - *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note + * Allows you to retrieve history for PurchaseOrder + *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments + * @param purchaseOrderID Unique identifier for a PurchaseOrder + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { - HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID, params); - TypeReference typeRef = new TypeReference() {}; + public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID) throws IOException { + HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { + public HttpResponse getPurchaseOrderHistoryForHttpResponse( String xeroTenantId, UUID purchaseOrderID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments"; + String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments"; + String path = "/PurchaseOrders/{PurchaseOrderID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -13519,34 +7507,138 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("PurchaseOrderID", purchaseOrderID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to retrieve purchase orders + *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param status Filter by purchase order status + * @param dateFrom Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 + * @param dateTo Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 + * @param order Order by an any element + * @param page To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned. + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { + HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getPurchaseOrdersForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/PurchaseOrders"; + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (status != null) { + String key = "Status"; + Object value = status; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (dateFrom != null) { + String key = "DateFrom"; + Object value = dateFrom; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (dateTo != null) { + String key = "DateTo"; + Object value = dateTo; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + /** + * Allows you to retrieve a specified draft expense claim receipts + *

200 - Success - return response of type Receipts array for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts getReceipt(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReceiptForHttpResponse( String xeroTenantId, UUID receiptID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipt"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments"; - + String correctPath = "/Receipts/{ReceiptID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments"; + String path = "/Receipts/{ReceiptID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -13555,81 +7647,115 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse(String xeroTenantId, // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("ReceiptID", receiptID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve a history records of an CreditNote - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note + * Allows you to retrieve Attachments on expense claim receipts by file name + *

200 - Success - return response of attachment for Receipt as binary data * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @return HistoryRecords + * @param receiptID Unique identifier for a Receipt + * @param fileName The name of the file being attached to the Receipt + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public ByteArrayInputStream getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { + HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + + } + + public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("FileName", fileName); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to retrieve a history records of an CreditNote - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note + * Allows you to retrieve Attachments on expense claim receipts by ID + *

200 - Success - return response of attachment for Receipt as binary data * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords + * @param receiptID Unique identifier for a Receipt + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { - HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public ByteArrayInputStream getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + } - public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID) throws IOException { + public HttpResponse getReceiptAttachmentByIdForHttpResponse( String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getReceiptAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/History"; + String correctPath = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/History"; + String path = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -13638,34 +7764,48 @@ public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUI // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("ReceiptID", receiptID); + uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUID creditNoteID, Map params) throws IOException { + /** + * Allows you to retrieve Attachments for expense claim receipts + *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReceiptAttachmentsForHttpResponse( String xeroTenantId, UUID receiptID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/History"; - + String correctPath = "/Receipts/{ReceiptID}/Attachments"; // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/History"; + String path = "/Receipts/{ReceiptID}/Attachments"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -13674,78 +7814,94 @@ public HttpResponse getCreditNoteHistoryForHttpResponse(String xeroTenantId, UUI // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("ReceiptID", receiptID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve any credit notes - *

200 - Success - return response of type Credit Notes array of CreditNote + * Allows you to retrieve a history records of an Receipt + *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note - * @return CreditNotes + * @param receiptID Unique identifier for a Receipt + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); - TypeReference typeRef = new TypeReference() {}; + public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } + public HttpResponse getReceiptHistoryForHttpResponse( String xeroTenantId, UUID receiptID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); + }// verify the required parameter 'receiptID' is set + if (receiptID == null) { + throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + + String correctPath = "/Receipts/{ReceiptID}/History"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/Receipts/{ReceiptID}/History"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ReceiptID", receiptID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + /** - * Allows you to retrieve any credit notes - *

200 - Success - return response of type Credit Notes array of CreditNote + * Allows you to retrieve draft expense claim receipts for any user + *

200 - Success - return response of type Receipts array for all Receipt * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CreditNotes + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts + * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNotes(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; + public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public HttpResponse getReceiptsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes"; + String correctPath = "/Receipts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -13768,9 +7924,9 @@ public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, OffsetDat } else { uriBuilder = uriBuilder.queryParam(key, value); } - } if (page != null) { - String key = "page"; - Object value = page; + } if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } else if (value instanceof Object[]) { @@ -13783,206 +7939,207 @@ public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, OffsetDat String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getCreditNotesForHttpResponse(String xeroTenantId, Map params) throws IOException { + /** + * Allows you to retrieve a specified repeating invoice + *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @return RepeatingInvoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getRepeatingInvoiceForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes"; + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - } - - String url = uriBuilder.build().toString(); + String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve currencies for your organisation - *

200 - Success - return response of type Currencies array with all Currencies - * @param xeroTenantId Xero identifier for Tenant - * @param where Filter by an any element - * @param order Order by an any element - * @return Currencies - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Currencies getCurrencies(String xeroTenantId, String where, String order) throws IOException { - HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve currencies for your organisation - *

200 - Success - return response of type Currencies array with all Currencies + * Allows you to retrieve specified attachment on repeating invoices by file name + *

200 - Success - return response of attachment for Repeating Invoice as binary data * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Currencies + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param fileName The name of the file being attached to a Repeating Invoice + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public Currencies getCurrencies(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public ByteArrayInputStream getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + } - public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, String where, String order) throws IOException { + public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Currencies"; + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - String url = uriBuilder.build().toString(); + String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getCurrenciesForHttpResponse(String xeroTenantId, Map params) throws IOException { + /** + * Allows you to retrieve a specified Attachments on repeating invoices + *

200 - Success - return response of attachment for Repeating Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param attachmentID Unique identifier for a Attachment + * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ByteArrayInputStream getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + + } + + public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'attachmentID' is set + if (attachmentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'contentType' is set + if (contentType == null) { + throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Currencies"; + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); + uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - } - - String url = uriBuilder.build().toString(); + String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve a specific employee used in Xero payrun - *

200 - Success - return response of type Employees array with specified Employee - * @param xeroTenantId Xero identifier for Tenant - * @param employeeID Unique identifier for a Employee - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees getEmployee(String xeroTenantId, UUID employeeID) throws IOException { - HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve a specific employee used in Xero payrun - *

200 - Success - return response of type Employees array with specified Employee + * Allows you to retrieve Attachments on repeating invoice + *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice * @param xeroTenantId Xero identifier for Tenant - * @param employeeID Unique identifier for a Employee - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Employees + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployee(String xeroTenantId, UUID employeeID, Map params) throws IOException { - HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID, params); - TypeReference typeRef = new TypeReference() {}; + public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employeeID) throws IOException { + public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID) 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"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Employees/{EmployeeID}"; + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Employees/{EmployeeID}"; + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -13991,34 +8148,47 @@ public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employe // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("EmployeeID", employeeID); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Map params) throws IOException { + /** + * Allows you to retrieve history for a repeating invoice + *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @return HistoryRecords + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID) 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"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set + if (repeatingInvoiceID == null) { + throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Employees/{EmployeeID}"; - + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Employees/{EmployeeID}"; + String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -14027,77 +8197,43 @@ public HttpResponse getEmployeeForHttpResponse(String xeroTenantId, UUID employe // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("EmployeeID", employeeID); + uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve employees used in Xero payrun - *

200 - Success - return response of type Employees array with all Employee + * Allows you to retrieve any repeating invoices + *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve employees used in Xero payrun - *

200 - Success - return response of type Employees array with all Employee - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Employees + * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployees(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; + public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, where, order); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + public HttpResponse getRepeatingInvoicesForHttpResponse( String xeroTenantId, String where, String order) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Employees"; + String correctPath = "/RepeatingInvoices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -14125,131 +8261,204 @@ public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, OffsetDateT String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getEmployeesForHttpResponse(String xeroTenantId, Map params) throws IOException { + /** + * Allows you to retrieve report for AgedPayablesByContact + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param contactId Unique identifier for a Contact + * @param date The date of the Aged Payables By Contact report + * @param fromDate The from date of the Aged Payables By Contact report + * @param toDate The to date of the Aged Payables By Contact report + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportAgedPayablesByContactForHttpResponse( String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); - } + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); + }// verify the required parameter 'contactId' is set + if (contactId == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); + } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Employees"; + String correctPath = "/Reports/AgedPayablesByContact"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + if (contactId != null) { + String key = "contactId"; + Object value = contactId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (fromDate != null) { + String key = "fromDate"; + Object value = fromDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (toDate != null) { + String key = "toDate"; + Object value = toDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve a specified expense claim - *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID) throws IOException { - HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve a specified expense claim - *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim + * Allows you to retrieve report for AgedReceivablesByContact + *

200 - Success - return response of type ReportWithRows * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ExpenseClaims + * @param contactId Unique identifier for a Contact + * @param date The date of the Aged Receivables By Contact report + * @param fromDate The from date of the Aged Receivables By Contact report + * @param toDate The to date of the Aged Receivables By Contact report + * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { - HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, params); - TypeReference typeRef = new TypeReference() {}; + public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID) throws IOException { + public HttpResponse getReportAgedReceivablesByContactForHttpResponse( String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); + }// verify the required parameter 'contactId' is set + if (contactId == null) { + throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); + String correctPath = "/Reports/AgedReceivablesByContact"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (contactId != null) { + String key = "contactId"; + Object value = contactId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (fromDate != null) { + String key = "fromDate"; + Object value = fromDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (toDate != null) { + String key = "toDate"; + Object value = toDate; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + /** + * Allows you to retrieve report for BAS only valid for AU orgs + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param reportID Unique identifier for a Report + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) throws IOException { + HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportBASorGSTForHttpResponse( String xeroTenantId, String reportID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); + }// verify the required parameter 'reportID' is set + if (reportID == null) { + throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; - + String correctPath = "/Reports/{ReportID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}"; + String path = "/Reports/{ReportID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -14258,201 +8467,195 @@ public HttpResponse getExpenseClaimForHttpResponse(String xeroTenantId, UUID exp // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); + uriVariables.put("ReportID", reportID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve a history records of an ExpenseClaim - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID) throws IOException { - HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve a history records of an ExpenseClaim - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim + * Allows you to retrieve report for BAS only valid for AU orgs + *

200 - Success - return response of type ReportWithRows * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords + * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { - HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, params); - TypeReference typeRef = new TypeReference() {}; + public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws IOException { + HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID) throws IOException { + public HttpResponse getReportBASorGSTListForHttpResponse( String xeroTenantId) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); + String correctPath = "/Reports"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getExpenseClaimHistoryForHttpResponse(String xeroTenantId, UUID expenseClaimID, Map params) throws IOException { + /** + * Allows you to retrieve report for BalanceSheet + *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant + * @param date The date of the Balance Sheet report + * @param periods The number of periods for the Balance Sheet report + * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) + * @param trackingOptionID1 The tracking option 1 for the Balance Sheet report + * @param trackingOptionID2 The tracking option 2 for the Balance Sheet report + * @param standardLayout The standard layout boolean for the Balance Sheet report + * @param paymentsOnly return a cash basis for the Balance Sheet report + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportBalanceSheetForHttpResponse( String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); + String correctPath = "/Reports/BalanceSheet"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (periods != null) { + String key = "periods"; + Object value = periods; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingOptionID1 != null) { + String key = "trackingOptionID1"; + Object value = trackingOptionID1; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (trackingOptionID2 != null) { + String key = "trackingOptionID2"; + Object value = trackingOptionID2; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (standardLayout != null) { + String key = "standardLayout"; + Object value = standardLayout; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve expense claims - *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve expense claims - *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims + * Allows you to retrieve report for BankSummary + *

200 - Success - return response of type ReportWithRows * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ExpenseClaims + * @param date The date for the Bank Summary report e.g. 2018-03-31 + * @param period The number of periods to compare (integer between 1 and 12) + * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) + * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims getExpenseClaims(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; + public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, date, period, timeframe); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + public HttpResponse getReportBankSummaryForHttpResponse( String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims"; + String correctPath = "/Reports/BankSummary"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; + if (date != null) { + String key = "date"; + Object value = date; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } else if (value instanceof Object[]) { @@ -14460,9 +8663,19 @@ public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, OffsetD } else { uriBuilder = uriBuilder.queryParam(key, value); } - } if (order != null) { - String key = "order"; - Object value = order; + } if (period != null) { + String key = "period"; + Object value = period; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } else if (value instanceof Object[]) { @@ -14475,7483 +8688,163 @@ public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, OffsetD String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse getExpenseClaimsForHttpResponse(String xeroTenantId, Map params) throws IOException { + /** + * Allows you to retrieve report for Budget Summary + *

200 - success- return a Report with Rows object + * @param xeroTenantId Xero identifier for Tenant + * @param date The date for the Bank Summary report e.g. 2018-03-31 + * @param period The number of periods to compare (integer between 1 and 12) + * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) + * @return ReportWithRows + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, date, period, timeframe); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getReportBudgetSummaryForHttpResponse( String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims"; + String correctPath = "/Reports/BudgetSummary"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (period != null) { + String key = "period"; + Object value = period; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve a specified sales invoice or purchase bill - *

200 - Success - return response of type Invoices array with specified Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices getInvoice(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve a specified sales invoice or purchase bill - *

200 - Success - return response of type Invoices array with specified Invoices + * Allows you to retrieve report for ExecutiveSummary + *

200 - Success - return response of type ReportWithRows * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Invoices + * @param date The date for the Bank Summary report e.g. 2018-03-31 + * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices getInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID, params); - TypeReference typeRef = new TypeReference() {}; + public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate date) throws IOException { + HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, date); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { + public HttpResponse getReportExecutiveSummaryForHttpResponse( String xeroTenantId, LocalDate date) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); + String correctPath = "/Reports/ExecutiveSummary"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve invoices or purchase bills as PDF files - *

200 - Success - return response of byte array pdf version of specified Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { - HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - /** - * Allows you to retrieve invoices or purchase bills as PDF files - *

200 - Success - return response of byte array pdf version of specified Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType, Map params) throws IOException { - HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/pdf"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/pdf"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getInvoiceAsPdfForHttpResponse(String xeroTenantId, UUID invoiceID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/pdf"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/pdf"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachment on invoices or purchase bills by it's filename - *

200 - Success - return response of attachment for Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the file you are attaching - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { - HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - /** - * Allows you to retrieve Attachment on invoices or purchase bills by it's filename - *

200 - Success - return response of attachment for Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the file you are attaching - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID - *

200 - Success - return response of attachment for Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param attachmentID Unique identifier for an Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - /** - * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID - *

200 - Success - return response of attachment for Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param attachmentID Unique identifier for an Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("AttachmentID", attachmentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("AttachmentID", attachmentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachments on invoices or purchase bills - *

200 - Success - return response of type Attachments array of Attachments for specified Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on invoices or purchase bills - *

200 - Success - return response of type Attachments array of Attachments for specified Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/Attachments"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a history records of an invoice - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an invoice - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getInvoiceHistoryForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve invoice reminder settings - *

200 - Success - return response of Invoice Reminders - * @param xeroTenantId Xero identifier for Tenant - * @return InvoiceReminders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws IOException { - HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve invoice reminder settings - *

200 - Success - return response of Invoice Reminders - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return InvoiceReminders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public InvoiceReminders getInvoiceReminders(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/InvoiceReminders/Settings"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getInvoiceRemindersForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/InvoiceReminders/Settings"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve any sales invoices or purchase bills - *

200 - Success - return response of type Invoices array with all Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param ids Filter by a comma-separated list of InvoicesIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. - * @param invoiceNumbers Filter by a comma-separated list of InvoiceNumbers. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. - * @param contactIDs Filter by a comma-separated list of ContactIDs. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. - * @param statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. - * @param page e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice - * @param includeArchived e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response - * @param createdByMyApp When set to true you'll only retrieve Invoices created by your app - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { - HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any sales invoices or purchase bills - *

200 - Success - return response of type Invoices array with all Invoices - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices getInvoices(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (ids != null) { - String key = "IDs"; - Object value = ids; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (invoiceNumbers != null) { - String key = "InvoiceNumbers"; - Object value = invoiceNumbers; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (contactIDs != null) { - String key = "ContactIDs"; - Object value = contactIDs; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (statuses != null) { - String key = "Statuses"; - Object value = statuses; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (includeArchived != null) { - String key = "includeArchived"; - Object value = includeArchived; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (createdByMyApp != null) { - String key = "createdByMyApp"; - Object value = createdByMyApp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getInvoicesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified item - *

200 - Success - return response of type Items array with specified Item - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items getItem(String xeroTenantId, UUID itemID) throws IOException { - HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified item - *

200 - Success - return response of type Items array with specified Item - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items getItem(String xeroTenantId, UUID itemID, Map params) throws IOException { - HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items/{ItemID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getItemForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items/{ItemID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve history for items - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws IOException { - HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve history for items - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID, Map params) throws IOException { - HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID itemID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItemHistory"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items/{ItemID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getItemHistoryForHttpResponse(String xeroTenantId, UUID itemID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItemHistory"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items/{ItemID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve any items - *

200 - Success - return response of type Items array with all Item - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - HttpResponse response = getItemsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any items - *

200 - Success - return response of type Items array with all Item - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items getItems(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getItemsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getItemsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getItemsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified journals. - *

200 - Success - return response of type Journals array with specified Journal - * @param xeroTenantId Xero identifier for Tenant - * @param journalID Unique identifier for a Journal - * @return Journals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Journals getJournal(String xeroTenantId, UUID journalID) throws IOException { - HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified journals. - *

200 - Success - return response of type Journals array with specified Journal - * @param xeroTenantId Xero identifier for Tenant - * @param journalID Unique identifier for a Journal - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Journals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Journals getJournal(String xeroTenantId, UUID journalID, Map params) throws IOException { - HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournal"); - }// verify the required parameter 'journalID' is set - if (journalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Journals/{JournalID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Journals/{JournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("JournalID", journalID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getJournalForHttpResponse(String xeroTenantId, UUID journalID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournal"); - }// verify the required parameter 'journalID' is set - if (journalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Journals/{JournalID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Journals/{JournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("JournalID", journalID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve any journals. - *

200 - Success - return response of type Journals array with all Journals - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned - * @param paymentsOnly Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. - * @return Journals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { - HttpResponse response = getJournalsForHttpResponse(xeroTenantId, ifModifiedSince, offset, paymentsOnly); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any journals. - *

200 - Success - return response of type Journals array with all Journals - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Journals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Journals getJournals(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getJournalsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getJournalsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Journals"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (offset != null) { - String key = "offset"; - Object value = offset; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (paymentsOnly != null) { - String key = "paymentsOnly"; - Object value = paymentsOnly; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getJournalsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Journals"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { - HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { - HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Retrieve linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. - * @param linkedTransactionID The Xero identifier for an Linked Transaction - * @param sourceTransactionID Filter by the SourceTransactionID. Get all the linked transactions created from a particular ACCPAY invoice - * @param contactID Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. - * @param status Filter by the combination of ContactID and Status. Get all the linked transactions that have been assigned to a particular customer and have a particular status e.g. GET /LinkedTransactions?ContactID=4bb34b03-3378-4bb2-a0ed-6345abf3224e&Status=APPROVED. - * @param targetTransactionID Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { - HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Retrieve linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions getLinkedTransactions(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/LinkedTransactions"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (page != null) { - String key = "page"; - Object value = page; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (linkedTransactionID != null) { - String key = "LinkedTransactionID"; - Object value = linkedTransactionID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (sourceTransactionID != null) { - String key = "SourceTransactionID"; - Object value = sourceTransactionID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (contactID != null) { - String key = "ContactID"; - Object value = contactID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (targetTransactionID != null) { - String key = "TargetTransactionID"; - Object value = targetTransactionID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getLinkedTransactionsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/LinkedTransactions"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified manual journals - *

200 - Success - return response of type ManualJournals array with a specified ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID) throws IOException { - HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified manual journals - *

200 - Success - return response of type ManualJournals array with a specified ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { - HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournal"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournal"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve specified Attachment on ManualJournal by file name - *

200 - Success - return response of attachment for Manual Journal as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName The name of the file being attached to a ManualJournal - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { - HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - /** - * Allows you to retrieve specified Attachment on ManualJournal by file name - *

200 - Success - return response of attachment for Manual Journal as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName The name of the file being attached to a ManualJournal - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve specified Attachment on ManualJournals - *

200 - Success - return response of attachment for Manual Journal as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - /** - * Allows you to retrieve specified Attachment on ManualJournals - *

200 - Success - return response of attachment for Manual Journal as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("AttachmentID", attachmentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("AttachmentID", attachmentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachment for manual journals - *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID) throws IOException { - HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachment for manual journals - *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { - HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenantId, UUID manualJournalID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getManualJournalAttachmentsForHttpResponse(String xeroTenantId, UUID manualJournalID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve any manual journals - *

200 - Success - return response of type ManualJournals array with a all ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any manual journals - *

200 - Success - return response of type ManualJournals array with a all ManualJournals - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals getManualJournals(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getManualJournalsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a URL to an online invoice - *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @return OnlineInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a URL to an online invoice - *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return OnlineInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/OnlineInvoice"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/OnlineInvoice"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getOnlineInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/OnlineInvoice"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/OnlineInvoice"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. - *

200 - Success - return response of type Organisation array with specified Organisation - * @param xeroTenantId Xero identifier for Tenant - * @param organisationID The organisationID parameter - * @return CISOrgSetting - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID) throws IOException { - HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. - *

200 - Success - return response of type Organisation array with specified Organisation - * @param xeroTenantId Xero identifier for Tenant - * @param organisationID The organisationID parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CISOrgSetting - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID, Map params) throws IOException { - HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantId, UUID organisationID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); - }// verify the required parameter 'organisationID' is set - if (organisationID == null) { - throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Organisation/{OrganisationID}/CISSettings"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Organisation/{OrganisationID}/CISSettings"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OrganisationID", organisationID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getOrganisationCISSettingsForHttpResponse(String xeroTenantId, UUID organisationID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); - }// verify the required parameter 'organisationID' is set - if (organisationID == null) { - throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Organisation/{OrganisationID}/CISSettings"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Organisation/{OrganisationID}/CISSettings"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OrganisationID", organisationID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Organisation details - *

200 - Success - return response of type Organisation array with all Organisation - * @param xeroTenantId Xero identifier for Tenant - * @return Organisations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Organisations getOrganisations(String xeroTenantId) throws IOException { - HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Organisation details - *

200 - Success - return response of type Organisation array with all Organisation - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Organisations - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Organisations getOrganisations(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Organisation"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getOrganisationsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Organisation"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified overpayments - *

200 - Success - return response of type Overpayments array with specified Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @return Overpayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID) throws IOException { - HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified overpayments - *

200 - Success - return response of type Overpayments array with specified Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Overpayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { - HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID overpaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayment"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Overpayments/{OverpaymentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getOverpaymentForHttpResponse(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayment"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Overpayments/{OverpaymentID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a history records of an Overpayment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID) throws IOException { - HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an Overpayment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param overpaymentID Unique identifier for a Overpayment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { - HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Overpayments/{OverpaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getOverpaymentHistoryForHttpResponse(String xeroTenantId, UUID overpaymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); - }// verify the required parameter 'overpaymentID' is set - if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Overpayments/{OverpaymentID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("OverpaymentID", overpaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve overpayments - *

200 - Success - return response of type Overpayments array with all Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return Overpayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve overpayments - *

200 - Success - return response of type Overpayments array with all Overpayments - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Overpayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Overpayments getOverpayments(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Overpayments"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getOverpaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Overpayments"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified payment for invoices and credit notes - *

200 - Success - return response of type Payments array for specified Payment - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments getPayment(String xeroTenantId, UUID paymentID) throws IOException { - HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified payment for invoices and credit notes - *

200 - Success - return response of type Payments array for specified Payment - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments getPayment(String xeroTenantId, UUID paymentID, Map params) throws IOException { - HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayment"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Payments/{PaymentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getPaymentForHttpResponse(String xeroTenantId, UUID paymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayment"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Payments/{PaymentID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve history records of a payment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) throws IOException { - HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve history records of a payment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments - * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID, Map params) throws IOException { - HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Payments/{PaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getPaymentHistoryForHttpResponse(String xeroTenantId, UUID paymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Payments/{PaymentID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve payment services - *

200 - Success - return response of type PaymentServices array for all PaymentService - * @param xeroTenantId Xero identifier for Tenant - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices getPaymentServices(String xeroTenantId) throws IOException { - HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve payment services - *

200 - Success - return response of type PaymentServices array for all PaymentService - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PaymentServices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PaymentServices getPaymentServices(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PaymentServices"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getPaymentServicesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PaymentServices"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve payments for invoices and credit notes - *

200 - Success - return response of type Payments array for all Payments - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments getPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve payments for invoices and credit notes - *

200 - Success - return response of type Payments array for all Payments - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Payments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payments getPayments(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Payments"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getPaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Payments"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified prepayments - *

200 - Success - return response of type Prepayments array for a specified Prepayment - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID Unique identifier for a PrePayment - * @return Prepayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID) throws IOException { - HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified prepayments - *

200 - Success - return response of type Prepayments array for a specified Prepayment - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID Unique identifier for a PrePayment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Prepayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { - HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayment"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Prepayments/{PrepaymentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getPrepaymentForHttpResponse(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayment"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Prepayments/{PrepaymentID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a history records of an Prepayment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID Unique identifier for a PrePayment - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID) throws IOException { - HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an Prepayment - *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment - * @param xeroTenantId Xero identifier for Tenant - * @param prepaymentID Unique identifier for a PrePayment - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { - HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Prepayments/{PrepaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getPrepaymentHistoryForHttpResponse(String xeroTenantId, UUID prepaymentID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); - }// verify the required parameter 'prepaymentID' is set - if (prepaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Prepayments/{PrepaymentID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PrepaymentID", prepaymentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve prepayments - *

200 - Success - return response of type Prepayments array for all Prepayment - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return Prepayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve prepayments - *

200 - Success - return response of type Prepayments array for all Prepayment - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Prepayments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Prepayments getPrepayments(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Prepayments"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getPrepaymentsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Prepayments"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified purchase orders - *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID) throws IOException { - HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified purchase orders - *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { - HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getPurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve history for PurchaseOrder - *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID) throws IOException { - HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve history for PurchaseOrder - *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { - HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getPurchaseOrderHistoryForHttpResponse(String xeroTenantId, UUID purchaseOrderID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve purchase orders - *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param status Filter by purchase order status - * @param dateFrom Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 - * @param dateTo Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 - * @param order Order by an any element - * @param page To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned. - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { - HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve purchase orders - *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders getPurchaseOrders(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (status != null) { - String key = "Status"; - Object value = status; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (dateFrom != null) { - String key = "DateFrom"; - Object value = dateFrom; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (dateTo != null) { - String key = "DateTo"; - Object value = dateTo; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getPurchaseOrdersForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified draft expense claim receipts - *

200 - Success - return response of type Receipts array for a specified Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts getReceipt(String xeroTenantId, UUID receiptID) throws IOException { - HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified draft expense claim receipts - *

200 - Success - return response of type Receipts array for a specified Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts getReceipt(String xeroTenantId, UUID receiptID, Map params) throws IOException { - HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipt"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipt"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachments on expense claim receipts by file name - *

200 - Success - return response of attachment for Receipt as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param fileName The name of the file being attached to the Receipt - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { - HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - /** - * Allows you to retrieve Attachments on expense claim receipts by file name - *

200 - Success - return response of attachment for Receipt as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param fileName The name of the file being attached to the Receipt - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachments on expense claim receipts by ID - *

200 - Success - return response of attachment for Receipt as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - /** - * Allows you to retrieve Attachments on expense claim receipts by ID - *

200 - Success - return response of attachment for Receipt as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getReceiptAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("AttachmentID", attachmentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReceiptAttachmentByIdForHttpResponse(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getReceiptAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("AttachmentID", attachmentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachments for expense claim receipts - *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) throws IOException { - HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments for expense claim receipts - *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID, Map params) throws IOException { - HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReceiptAttachmentsForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/Attachments"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a history records of an Receipt - *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) throws IOException { - HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a history records of an Receipt - *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID, Map params) throws IOException { - HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReceiptHistoryForHttpResponse(String xeroTenantId, UUID receiptID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve draft expense claim receipts for any user - *

200 - Success - return response of type Receipts array for all Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned - * @param where Filter by an any element - * @param order Order by an any element - * @param unitdp e.g. unitdp=4 – You can opt in to use four decimal places for unit amounts - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve draft expense claim receipts for any user - *

200 - Success - return response of type Receipts array for all Receipt - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts getReceipts(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReceiptsForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified repeating invoice - *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @return RepeatingInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified repeating invoice - *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return RepeatingInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getRepeatingInvoiceForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve specified attachment on repeating invoices by file name - *

200 - Success - return response of attachment for Repeating Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName The name of the file being attached to a Repeating Invoice - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - /** - * Allows you to retrieve specified attachment on repeating invoices by file name - *

200 - Success - return response of attachment for Repeating Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName The name of the file being attached to a Repeating Invoice - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType, Map params) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified Attachments on repeating invoices - *

200 - Success - return response of attachment for Repeating Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - /** - * Allows you to retrieve a specified Attachments on repeating invoices - *

200 - Success - return response of attachment for Repeating Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param attachmentID Unique identifier for a Attachment - * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return File - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ByteArrayInputStream getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType, Map params) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType, params); - InputStream is = response.getContent(); - byte[] bytes = IOUtils.toByteArray(is); - try { - // Process the input stream.. - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } finally { - is.close(); - } - - } - - public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("AttachmentID", attachmentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'attachmentID' is set - if (attachmentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'attachmentID' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'contentType' is set - if (contentType == null) { - throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("AttachmentID", attachmentID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Attachments on repeating invoice - *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Attachments on repeating invoice - *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve history for a repeating invoice - *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve history for a repeating invoice - *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve any repeating invoices - *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param where Filter by an any element - * @param order Order by an any element - * @return RepeatingInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, String order) throws IOException { - HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve any repeating invoices - *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return RepeatingInvoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (order != null) { - String key = "order"; - Object value = order; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getRepeatingInvoicesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve report for AgedPayablesByContact - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param contactId Unique identifier for a Contact - * @param date The date of the Aged Payables By Contact report - * @param fromDate The from date of the Aged Payables By Contact report - * @param toDate The to date of the Aged Payables By Contact report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for AgedPayablesByContact - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param contactId Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { - HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); - }// verify the required parameter 'contactId' is set - if (contactId == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/AgedPayablesByContact"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (contactId != null) { - String key = "contactId"; - Object value = contactId; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (fromDate != null) { - String key = "fromDate"; - Object value = fromDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (toDate != null) { - String key = "toDate"; - Object value = toDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReportAgedPayablesByContactForHttpResponse(String xeroTenantId, UUID contactId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); - }// verify the required parameter 'contactId' is set - if (contactId == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/AgedPayablesByContact"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - // Add the required query param 'contactId' to the map of query params - allParams.put("contactId", contactId); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve report for AgedReceivablesByContact - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param contactId Unique identifier for a Contact - * @param date The date of the Aged Receivables By Contact report - * @param fromDate The from date of the Aged Receivables By Contact report - * @param toDate The to date of the Aged Receivables By Contact report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for AgedReceivablesByContact - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param contactId Unique identifier for a Contact - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, Map params) throws IOException { - HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); - }// verify the required parameter 'contactId' is set - if (contactId == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/AgedReceivablesByContact"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (contactId != null) { - String key = "contactId"; - Object value = contactId; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (fromDate != null) { - String key = "fromDate"; - Object value = fromDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (toDate != null) { - String key = "toDate"; - Object value = toDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String xeroTenantId, UUID contactId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); - }// verify the required parameter 'contactId' is set - if (contactId == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/AgedReceivablesByContact"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - // Add the required query param 'contactId' to the map of query params - allParams.put("contactId", contactId); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve report for BAS only valid for AU orgs - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param reportID Unique identifier for a Report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) throws IOException { - HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for BAS only valid for AU orgs - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param reportID Unique identifier for a Report - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID, Map params) throws IOException { - HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String reportID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); - }// verify the required parameter 'reportID' is set - if (reportID == null) { - throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/{ReportID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Reports/{ReportID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReportID", reportID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReportBASorGSTForHttpResponse(String xeroTenantId, String reportID, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); - }// verify the required parameter 'reportID' is set - if (reportID == null) { - throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/{ReportID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Reports/{ReportID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReportID", reportID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve report for BAS only valid for AU orgs - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws IOException { - HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for BAS only valid for AU orgs - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBASorGSTList(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReportBASorGSTListForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve report for BalanceSheet - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param date The date of the Balance Sheet report - * @param periods The number of periods for the Balance Sheet report - * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) - * @param trackingOptionID1 The tracking option 1 for the Balance Sheet report - * @param trackingOptionID2 The tracking option 2 for the Balance Sheet report - * @param standardLayout The standard layout boolean for the Balance Sheet report - * @param paymentsOnly return a cash basis for the Balance Sheet report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for BalanceSheet - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBalanceSheet(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/BalanceSheet"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (periods != null) { - String key = "periods"; - Object value = periods; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (timeframe != null) { - String key = "timeframe"; - Object value = timeframe; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingOptionID1 != null) { - String key = "trackingOptionID1"; - Object value = trackingOptionID1; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingOptionID2 != null) { - String key = "trackingOptionID2"; - Object value = trackingOptionID2; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (standardLayout != null) { - String key = "standardLayout"; - Object value = standardLayout; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (paymentsOnly != null) { - String key = "paymentsOnly"; - Object value = paymentsOnly; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReportBalanceSheetForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/BalanceSheet"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve report for BankSummary - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param date The date for the Bank Summary report e.g. 2018-03-31 - * @param period The number of periods to compare (integer between 1 and 12) - * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, date, period, timeframe); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for BankSummary - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBankSummary(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/BankSummary"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (period != null) { - String key = "period"; - Object value = period; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (timeframe != null) { - String key = "timeframe"; - Object value = timeframe; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReportBankSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/BankSummary"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve report for Budget Summary - *

200 - success- return a Report with Rows object - * @param xeroTenantId Xero identifier for Tenant - * @param date The date for the Bank Summary report e.g. 2018-03-31 - * @param period The number of periods to compare (integer between 1 and 12) - * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, date, period, timeframe); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for Budget Summary - *

200 - success- return a Report with Rows object - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportBudgetSummary(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/BudgetSummary"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (period != null) { - String key = "period"; - Object value = period; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (timeframe != null) { - String key = "timeframe"; - Object value = timeframe; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReportBudgetSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/BudgetSummary"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve report for ExecutiveSummary - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param date The date for the Bank Summary report e.g. 2018-03-31 - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate date) throws IOException { - HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, date); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for ExecutiveSummary - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportExecutiveSummary(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId, LocalDate date) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/ExecutiveSummary"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReportExecutiveSummaryForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/ExecutiveSummary"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve report for ProfitAndLoss - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param fromDate The from date for the ProfitAndLoss report e.g. 2018-03-31 - * @param toDate The to date for the ProfitAndLoss report e.g. 2018-03-31 - * @param periods The number of periods to compare (integer between 1 and 12) - * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) - * @param trackingCategoryID The trackingCategory 1 for the ProfitAndLoss report - * @param trackingCategoryID2 The trackingCategory 2 for the ProfitAndLoss report - * @param trackingOptionID The tracking option 1 for the ProfitAndLoss report - * @param trackingOptionID2 The tracking option 2 for the ProfitAndLoss report - * @param standardLayout Return the standard layout for the ProfitAndLoss report - * @param paymentsOnly Return cash only basis for the ProfitAndLoss report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for ProfitAndLoss - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportProfitAndLoss(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/ProfitAndLoss"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (fromDate != null) { - String key = "fromDate"; - Object value = fromDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (toDate != null) { - String key = "toDate"; - Object value = toDate; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (periods != null) { - String key = "periods"; - Object value = periods; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (timeframe != null) { - String key = "timeframe"; - Object value = timeframe; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingCategoryID != null) { - String key = "trackingCategoryID"; - Object value = trackingCategoryID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingCategoryID2 != null) { - String key = "trackingCategoryID2"; - Object value = trackingCategoryID2; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingOptionID != null) { - String key = "trackingOptionID"; - Object value = trackingOptionID; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (trackingOptionID2 != null) { - String key = "trackingOptionID2"; - Object value = trackingOptionID2; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (standardLayout != null) { - String key = "standardLayout"; - Object value = standardLayout; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (paymentsOnly != null) { - String key = "paymentsOnly"; - Object value = paymentsOnly; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReportProfitAndLossForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/ProfitAndLoss"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve report for TenNinetyNine - *

200 - Success - return response of type Reports - * @param xeroTenantId Xero identifier for Tenant - * @param reportYear The year of the 1099 report - * @return Reports - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) throws IOException { - HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, reportYear); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve report for TenNinetyNine - *

200 - Success - return response of type Reports - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Reports - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Reports getReportTenNinetyNine(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, String reportYear) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/TenNinetyNine"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (reportYear != null) { - String key = "reportYear"; - Object value = reportYear; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReportTenNinetyNineForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/TenNinetyNine"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - } + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve report for TrialBalance - *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant - * @param date The date for the Trial Balance report e.g. 2018-03-31 - * @param paymentsOnly Return cash only basis for the Trial Balance report - * @return ReportWithRows - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, date, paymentsOnly); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve report for TrialBalance + * Allows you to retrieve report for ProfitAndLoss *

200 - Success - return response of type ReportWithRows * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @param fromDate The from date for the ProfitAndLoss report e.g. 2018-03-31 + * @param toDate The to date for the ProfitAndLoss report e.g. 2018-03-31 + * @param periods The number of periods to compare (integer between 1 and 12) + * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) + * @param trackingCategoryID The trackingCategory 1 for the ProfitAndLoss report + * @param trackingCategoryID2 The trackingCategory 2 for the ProfitAndLoss report + * @param trackingOptionID The tracking option 1 for the ProfitAndLoss report + * @param trackingOptionID2 The tracking option 2 for the ProfitAndLoss report + * @param standardLayout Return the standard layout for the ProfitAndLoss report + * @param paymentsOnly Return cash only basis for the ProfitAndLoss report * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportTrialBalance(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, params); + public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { + public HttpResponse getReportProfitAndLossForHttpResponse( String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports/TrialBalance"; + String correctPath = "/Reports/ProfitAndLoss"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (date != null) { - String key = "date"; - Object value = date; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } if (paymentsOnly != null) { - String key = "paymentsOnly"; - Object value = paymentsOnly; + if (fromDate != null) { + String key = "fromDate"; + Object value = fromDate; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } else if (value instanceof Object[]) { @@ -21959,101 +8852,9 @@ public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Lo } else { uriBuilder = uriBuilder.queryParam(key, value); } - } - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getReportTrialBalanceForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Reports/TrialBalance"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve Tax Rates - *

200 - Success - return response of type TaxRates array with TaxRates - * @param xeroTenantId Xero identifier for Tenant - * @param where Filter by an any element - * @param order Order by an any element - * @param taxType Filter by tax type - * @return TaxRates - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TaxRates getTaxRates(String xeroTenantId, String where, String order, String taxType) throws IOException { - HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, where, order, taxType); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve Tax Rates - *

200 - Success - return response of type TaxRates array with TaxRates - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TaxRates - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TaxRates getTaxRates(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, String where, String order, String taxType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TaxRates"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; + } if (toDate != null) { + String key = "toDate"; + Object value = toDate; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } else if (value instanceof Object[]) { @@ -22061,9 +8862,9 @@ public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, String where } else { uriBuilder = uriBuilder.queryParam(key, value); } - } if (order != null) { - String key = "order"; - Object value = order; + } if (periods != null) { + String key = "periods"; + Object value = periods; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } else if (value instanceof Object[]) { @@ -22071,111 +8872,19 @@ public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, String where } else { uriBuilder = uriBuilder.queryParam(key, value); } - } if (taxType != null) { - String key = "TaxType"; - Object value = taxType; + } if (timeframe != null) { + String key = "timeframe"; + Object value = timeframe; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getTaxRatesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TaxRates"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve tracking categories and options - *

200 - Success - return response of type TrackingCategories array of TrackingCategory - * @param xeroTenantId Xero identifier for Tenant - * @param where Filter by an any element - * @param order Order by an any element - * @param includeArchived e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories getTrackingCategories(String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { - HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, where, order, includeArchived); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve tracking categories and options - *

200 - Success - return response of type TrackingCategories array of TrackingCategory - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories getTrackingCategories(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TrackingCategories"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (where != null) { - String key = "where"; - Object value = where; + } + } if (trackingCategoryID != null) { + String key = "trackingCategoryID"; + Object value = trackingCategoryID; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } else if (value instanceof Object[]) { @@ -22183,9 +8892,9 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, St } else { uriBuilder = uriBuilder.queryParam(key, value); } - } if (order != null) { - String key = "order"; - Object value = order; + } if (trackingCategoryID2 != null) { + String key = "trackingCategoryID2"; + Object value = trackingCategoryID2; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } else if (value instanceof Object[]) { @@ -22193,9 +8902,9 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, St } else { uriBuilder = uriBuilder.queryParam(key, value); } - } if (includeArchived != null) { - String key = "includeArchived"; - Object value = includeArchived; + } if (trackingOptionID != null) { + String key = "trackingOptionID"; + Object value = trackingOptionID; if (value instanceof Collection) { uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); } else if (value instanceof Object[]) { @@ -22203,334 +8912,175 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, St } else { uriBuilder = uriBuilder.queryParam(key, value); } - } - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getTrackingCategoriesForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TrackingCategories"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + } if (trackingOptionID2 != null) { + String key = "trackingOptionID2"; + Object value = trackingOptionID2; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (standardLayout != null) { + String key = "standardLayout"; + Object value = standardLayout; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve tracking categories and options for specified category - *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { - HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve tracking categories and options for specified category - *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory + * Allows you to retrieve report for TenNinetyNine + *

200 - Success - return response of type Reports * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingCategories + * @param reportYear The year of the 1099 report + * @return Reports * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { - HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, params); - TypeReference typeRef = new TypeReference() {}; + public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) throws IOException { + HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, reportYear); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, Map params) throws IOException { + public HttpResponse getReportTenNinetyNineForHttpResponse( String xeroTenantId, String reportYear) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); + String correctPath = "/Reports/TenNinetyNine"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + if (reportYear != null) { + String key = "reportYear"; + Object value = reportYear; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to retrieve a specified user - *

200 - Success - return response of type Users array of specified User - * @param xeroTenantId Xero identifier for Tenant - * @param userID Unique identifier for a User - * @return Users - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Users getUser(String xeroTenantId, UUID userID) throws IOException { - HttpResponse response = getUserForHttpResponse(xeroTenantId, userID); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to retrieve a specified user - *

200 - Success - return response of type Users array of specified User + * Allows you to retrieve report for TrialBalance + *

200 - Success - return response of type ReportWithRows * @param xeroTenantId Xero identifier for Tenant - * @param userID Unique identifier for a User - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Users + * @param date The date for the Trial Balance report e.g. 2018-03-31 + * @param paymentsOnly Return cash only basis for the Trial Balance report + * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUser(String xeroTenantId, UUID userID, Map params) throws IOException { - HttpResponse response = getUserForHttpResponse(xeroTenantId, userID, params); - TypeReference typeRef = new TypeReference() {}; + public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, date, paymentsOnly); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUser"); - }// verify the required parameter 'userID' is set - if (userID == null) { - throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Users/{UserID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Users/{UserID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("UserID", userID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getUserForHttpResponse(String xeroTenantId, UUID userID, Map params) throws IOException { + public HttpResponse getReportTrialBalanceForHttpResponse( String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUser"); - }// verify the required parameter 'userID' is set - if (userID == null) { - throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Users/{UserID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Users/{UserID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("UserID", userID); + String correctPath = "/Reports/TrialBalance"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + if (date != null) { + String key = "date"; + Object value = date; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (paymentsOnly != null) { + String key = "paymentsOnly"; + Object value = paymentsOnly; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - /** - * Allows you to retrieve users - *

200 - Success - return response of type Users array of all User + * Allows you to retrieve Tax Rates + *

200 - Success - return response of type TaxRates array with TaxRates * @param xeroTenantId Xero identifier for Tenant - * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element - * @return Users - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getUsersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve users - *

200 - Success - return response of type Users array of all User - * @param xeroTenantId Xero identifier for Tenant - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Users + * @param taxType Filter by tax type + * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUsers(String xeroTenantId, Map params) throws IOException { - HttpResponse response = getUsersForHttpResponse(xeroTenantId, params); - TypeReference typeRef = new TypeReference() {}; + public TaxRates getTaxRates(String xeroTenantId, String where, String order, String taxType) throws IOException { + HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, where, order, taxType); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getUsersForHttpResponse(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + public HttpResponse getTaxRatesForHttpResponse( String xeroTenantId, String where, String order, String taxType) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Users"; + String correctPath = "/TaxRates"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -22553,547 +9103,284 @@ public HttpResponse getUsersForHttpResponse(String xeroTenantId, OffsetDateTime } else { uriBuilder = uriBuilder.queryParam(key, value); } - } - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = null; - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse getUsersForHttpResponse(String xeroTenantId, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Users"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + } if (taxType != null) { + String key = "TaxType"; + Object value = taxType; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); - HttpContent content = null; - + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to update a chart of accounts - *

200 - Success - update existing Account and return response of type Accounts array with updated Account - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @param accounts Request of type Accounts array with one Account - * @return Accounts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { - HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to update a chart of accounts - *

200 - Success - update existing Account and return response of type Accounts array with updated Account - *

400 - Validation Error - some data was incorrect returns response of type Error + * Allows you to retrieve tracking categories and options + *

200 - Success - return response of type TrackingCategories array of TrackingCategory * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for retrieving single object - * @param accounts Request of type Accounts array with one Account - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Accounts + * @param where Filter by an any element + * @param order Order by an any element + * @param includeArchived e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response + * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts, Map params) throws IOException { - HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts, params); - TypeReference typeRef = new TypeReference() {}; + public TrackingCategories getTrackingCategories(String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { + HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, where, order, includeArchived); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); - }// verify the required parameter 'accounts' is set - if (accounts == null) { - throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Accounts/{AccountID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, java.io.InputStream accounts, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); - }// verify the required parameter 'accounts' is set - if (accounts == null) { - throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Accounts/{AccountID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = accounts == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, accounts); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateAccountForHttpResponse(String xeroTenantId, UUID accountID, Accounts accounts, Map params) throws IOException { + public HttpResponse getTrackingCategoriesForHttpResponse( String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); - }// verify the required parameter 'accounts' is set - if (accounts == null) { - throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); + String correctPath = "/TrackingCategories"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (includeArchived != null) { + String key = "includeArchived"; + Object value = includeArchived; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to update Attachment on Account by Filename - *

200 - Success - return response of type Attachments array of Attachment - *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to update Attachment on Account by Filename - *

200 - Success - return response of type Attachments array of Attachment - *

400 - Validation Error - some data was incorrect returns response of type Error + * Allows you to retrieve tracking categories and options for specified category + *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; + public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { + HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body) throws IOException { + public HttpResponse getTrackingCategoryForHttpResponse( String xeroTenantId, UUID trackingCategoryID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String path = "/TrackingCategories/{TrackingCategoryID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + /** + * Allows you to retrieve a specified user + *

200 - Success - return response of type Users array of specified User + * @param xeroTenantId Xero identifier for Tenant + * @param userID Unique identifier for a User + * @return Users + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Users getUser(String xeroTenantId, UUID userID) throws IOException { + HttpResponse response = getUserForHttpResponse(xeroTenantId, userID); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID accountID, String fileName, byte[] body, Map params) throws IOException { + public HttpResponse getUserForHttpResponse( String xeroTenantId, UUID userID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUser"); + }// verify the required parameter 'userID' is set + if (userID == null) { + throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; - + String correctPath = "/Users/{UserID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; + String path = "/Users/{UserID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); - // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); + uriVariables.put("UserID", userID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to update a single spend or receive money transaction - *

200 - Success - return response of type BankTransactions array with updated BankTransaction - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param bankTransactions The bankTransactions parameter - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { - HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** - * Allows you to update a single spend or receive money transaction - *

200 - Success - return response of type BankTransactions array with updated BankTransaction - *

400 - A failed request due to validation error + * Allows you to retrieve users + *

200 - Success - return response of type Users array of all User * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param bankTransactions The bankTransactions parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return BankTransactions + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @return Users * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions, Map params) throws IOException { - HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions, params); - TypeReference typeRef = new TypeReference() {}; + public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getUsersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { + public HttpResponse getUsersForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); + String correctPath = "/Users"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + /** + * Allows you to update a chart of accounts + *

200 - Success - update existing Account and return response of type Accounts array with updated Account + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param accountID Unique identifier for retrieving single object + * @param accounts Request of type Accounts array with one Account + * @return Accounts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { + HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, java.io.InputStream bankTransactions, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransactions/{BankTransactionID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = bankTransactions == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, bankTransactions); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions, Map params) throws IOException { + public HttpResponse updateAccountForHttpResponse( String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); + }// verify the required parameter 'accounts' is set + if (accounts == null) { + throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}"; - + String correctPath = "/Accounts/{AccountID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}"; + String path = "/Accounts/{AccountID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -23102,93 +9389,58 @@ public HttpResponse updateBankTransactionForHttpResponse(String xeroTenantId, UU // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("AccountID", accountID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); - + + + HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to update an Attachment on BankTransaction by Filename - *

200 - Success - return response of Attachments array of Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName The name of the file being attached - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - * Allows you to update an Attachment on BankTransaction by Filename - *

200 - Success - return response of Attachments array of Attachment - *

400 - A failed request due to validation error + * Allows you to update Attachment on Account by Filename + *

200 - Success - return response of type Attachments array of Attachment + *

400 - Validation Error - some data was incorrect returns response of type Error * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName The name of the file being attached + * @param accountID Unique identifier for Account object + * @param fileName Name of the attachment * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body, params); + public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { + HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body) throws IOException { + public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set + if (accountID == null) { + throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); }// verify the required parameter 'fileName' is set if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateAccountAttachmentByFileName"); }// verify the required parameter 'body' is set if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String path = "/Accounts/{AccountID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -23196,11 +9448,11 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("AccountID", accountID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -23208,175 +9460,109 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - + + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransactionID, String fileName, byte[] body, Map params) throws IOException { + /** + * Allows you to update a single spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with updated BankTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param bankTransactions The bankTransactions parameter + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { + HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateBankTransactionForHttpResponse( String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); }// verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - + String correctPath = "/BankTransactions/{BankTransactionID}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + String path = "/BankTransactions/{BankTransactionID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); - // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - + + + HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - - /** - *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName The name of the file being attached to a Bank Transfer - * @param body Byte array of file in body of request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { - HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** - *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + * Allows you to update an Attachment on BankTransaction by Filename + *

200 - Success - return response of Attachments array of Attachment *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName The name of the file being attached to a Bank Transfer + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param fileName The name of the file being attached * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body, params); + public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { + HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body) throws IOException { + public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); }// verify the required parameter 'fileName' is set if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransactionAttachmentByFileName"); }// verify the required parameter 'body' is set if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); @@ -23384,11 +9570,11 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("BankTransactionID", bankTransactionID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -23396,57 +9582,32 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - + + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID bankTransferID, String fileName, byte[] body, Map params) throws IOException { + /** + *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param fileName The name of the file being attached to a Bank Transfer + * @param body Byte array of file in body of request + * @return Attachments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { + HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); @@ -23465,7 +9626,6 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String headers.setAccept("application/json"); String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; String type = "/pdf"; @@ -23475,7 +9635,7 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23484,33 +9644,18 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - + + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** *

200 - Success - return response of type Contacts array with an updated Contact *

400 - A failed request due to validation error @@ -23526,23 +9671,7 @@ public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts con return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - *

200 - Success - return response of type Contacts array with an updated Contact - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param contacts an array of Contacts containing single Contact object with properties to update - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts, Map params) throws IOException { - HttpResponse response = updateContactForHttpResponse(xeroTenantId, contactID, contacts, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { + public HttpResponse updateContactForHttpResponse( String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); @@ -23575,110 +9704,13 @@ public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID conta String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, java.io.InputStream contacts, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); - }// verify the required parameter 'contacts' is set - if (contacts == null) { - throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Contacts/{ContactID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = contacts == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contacts); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID contactID, Contacts contacts, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); - }// verify the required parameter 'contacts' is set - if (contacts == null) { - throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Contacts/{ContactID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** *

200 - Success - return response of type Attachments array with an updated Attachment *

400 - A failed request due to validation error @@ -23689,30 +9721,13 @@ public HttpResponse updateContactForHttpResponse(String xeroTenantId, UUID conta * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - *

200 - Success - return response of type Attachments array with an updated Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name for the file you are attaching - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body) throws IOException { + public HttpResponse updateContactAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); @@ -23740,7 +9755,7 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xero } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23752,234 +9767,32 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID contactID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to update a Contract Group - *

200 - Success - return response of type Contact Groups array of updated Contact Group - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contactGroups an array of Contact groups with Name of specific group to update - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { - HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** * Allows you to update a Contract Group *

200 - Success - return response of type Contact Groups array of updated Contact Group *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group - * @param contactGroups an array of Contact groups with Name of specific group to update - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups, Map params) throws IOException { - HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); - }// verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ContactGroups/{ContactGroupID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + * @param contactGroups an array of Contact groups with Name of specific group to update + * @return ContactGroups + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { + HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, java.io.InputStream contactGroups, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); - }// verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); - }// verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ContactGroups/{ContactGroupID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = contactGroups == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, contactGroups); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups, Map params) throws IOException { + public HttpResponse updateContactGroupForHttpResponse( String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); @@ -23995,7 +9808,6 @@ public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID headers.setAccept("application/json"); String correctPath = "/ContactGroups/{ContactGroupID}"; - // Hacky path manipulation to support different return types from same endpoint String path = "/ContactGroups/{ContactGroupID}"; String type = "/pdf"; @@ -24010,33 +9822,16 @@ public HttpResponse updateContactGroupForHttpResponse(String xeroTenantId, UUID UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); - + + + HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update a specific credit note *

200 - Success - return response of type Credit Notes array with updated CreditNote @@ -24053,24 +9848,7 @@ public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, Cre return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update a specific credit note - *

200 - Success - return response of type Credit Notes array with updated CreditNote - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param creditNotes an array of Credit Notes containing credit note details to update - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes, Map params) throws IOException { - HttpResponse response = updateCreditNoteForHttpResponse(xeroTenantId, creditNoteID, creditNotes, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { + public HttpResponse updateCreditNoteForHttpResponse( String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); @@ -24103,110 +9881,13 @@ public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID cr String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, java.io.InputStream creditNotes, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); - }// verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes/{CreditNoteID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = creditNotes == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creditNotes); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); - }// verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes/{CreditNoteID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update Attachments on CreditNote by file name *

200 - Success - return response of type Attachments array with updated Attachment for specific Credit Note @@ -24218,31 +9899,13 @@ public HttpResponse updateCreditNoteForHttpResponse(String xeroTenantId, UUID cr * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update Attachments on CreditNote by file name - *

200 - Success - return response of type Attachments array with updated Attachment for specific Credit Note - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the file you are attaching to Credit Note - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body) throws IOException { + public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); @@ -24270,7 +9933,7 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String x } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -24282,121 +9945,15 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String x String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID creditNoteID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update a specific employee used in Xero payrun *

200 - Success - return response of type Employees array with updated Employee @@ -24413,24 +9970,7 @@ public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update a specific employee used in Xero payrun - *

200 - Success - return response of type Employees array with updated Employee - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param employeeID Unique identifier for a Employee - * @param employees The employees parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees, Map params) throws IOException { - HttpResponse response = updateEmployeeForHttpResponse(xeroTenantId, employeeID, employees, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Employees employees) throws IOException { + public HttpResponse updateEmployeeForHttpResponse( String xeroTenantId, UUID employeeID, Employees employees) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateEmployee"); @@ -24463,223 +10003,30 @@ public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID empl String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, java.io.InputStream employees, String mediaType) 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 'employees' is set - if (employees == null) { - throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Employees/{EmployeeID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Employees/{EmployeeID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("EmployeeID", employeeID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = employees == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, employees); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateEmployeeForHttpResponse(String xeroTenantId, UUID employeeID, Employees employees, Map params) 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 'employees' is set - if (employees == null) { - throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Employees/{EmployeeID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Employees/{EmployeeID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("EmployeeID", employeeID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(employees); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to update specified expense claims - *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param expenseClaims The expenseClaims parameter - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { - HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to update specified expense claims - *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param expenseClaims The expenseClaims parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ExpenseClaims - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims, Map params) throws IOException { - HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - + HttpContent content = apiClient.new JacksonJsonHttpContent(employees); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, java.io.InputStream expenseClaims, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); - }// verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = expenseClaims == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, expenseClaims); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims, Map params) throws IOException { + /** + * Allows you to update specified expense claims + *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param expenseClaims The expenseClaims parameter + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { + HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateExpenseClaimForHttpResponse( String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); @@ -24695,7 +10042,6 @@ public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID headers.setAccept("application/json"); String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; - // Hacky path manipulation to support different return types from same endpoint String path = "/ExpenseClaims/{ExpenseClaimID}"; String type = "/pdf"; @@ -24710,33 +10056,16 @@ public HttpResponse updateExpenseClaimForHttpResponse(String xeroTenantId, UUID UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); - + + + HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update a specified sales invoices or purchase bills *

200 - Success - return response of type Invoices array with updated Invoice @@ -24753,24 +10082,7 @@ public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices inv return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update a specified sales invoices or purchase bills - *

200 - Success - return response of type Invoices array with updated Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param invoices The invoices parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Invoices - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices, Map params) throws IOException { - HttpResponse response = updateInvoiceForHttpResponse(xeroTenantId, invoiceID, invoices, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { + public HttpResponse updateInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); @@ -24803,110 +10115,13 @@ public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoi String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, java.io.InputStream invoices, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); - }// verify the required parameter 'invoices' is set - if (invoices == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = invoices == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, invoices); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoiceID, Invoices invoices, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); - }// verify the required parameter 'invoices' is set - if (invoices == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of type Attachments array with updated Attachment @@ -24918,31 +10133,13 @@ public HttpResponse updateInvoiceForHttpResponse(String xeroTenantId, UUID invoi * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update Attachment on invoices or purchase bills by it's filename - *

200 - Success - return response of type Attachments array with updated Attachment - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the file you are attaching - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body) throws IOException { + public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); @@ -24970,7 +10167,7 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xero } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -24982,121 +10179,15 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID invoiceID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to udpate a specified item *

200 - Success - return response of type Items array with updated Item @@ -25113,24 +10204,7 @@ public Items updateItem(String xeroTenantId, UUID itemID, Items items) throws I return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to udpate a specified item - *

200 - Success - return response of type Items array with updated Item - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param items The items parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Items updateItem(String xeroTenantId, UUID itemID, Items items, Map params) throws IOException { - HttpResponse response = updateItemForHttpResponse(xeroTenantId, itemID, items, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, Items items) throws IOException { + public HttpResponse updateItemForHttpResponse( String xeroTenantId, UUID itemID, Items items) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); @@ -25163,126 +10237,13 @@ public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(items); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, java.io.InputStream items, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); - }// verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items/{ItemID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = items == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, items); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateItemForHttpResponse(String xeroTenantId, UUID itemID, Items items, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); - }// verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); - }// verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Items/{ItemID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(items); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - - /** - * Allows you to update a specified linked transactions (billable expenses) - *

200 - Success - return response of type LinkedTransactions array with updated LinkedTransaction - *

400 - Success - return response of type LinkedTransactions array with updated LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @param linkedTransactions The linkedTransactions parameter - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { - HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - /** * Allows you to update a specified linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with updated LinkedTransaction @@ -25290,96 +10251,16 @@ public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID lin * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactionID Unique identifier for a LinkedTransaction * @param linkedTransactions The linkedTransactions parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions, Map params) throws IOException { - HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); - }// verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { + HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, java.io.InputStream linkedTransactions, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); - }// verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = linkedTransactions == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, linkedTransactions); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions, Map params) throws IOException { + public HttpResponse updateLinkedTransactionForHttpResponse( String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); @@ -25395,7 +10276,6 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, headers.setAccept("application/json"); String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint String path = "/LinkedTransactions/{LinkedTransactionID}"; String type = "/pdf"; @@ -25410,33 +10290,16 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String xeroTenantId, UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - + + + HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update a specified manual journal *

200 - Success - return response of type ManualJournals array with an updated ManualJournal @@ -25453,24 +10316,7 @@ public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJourn return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update a specified manual journal - *

200 - Success - return response of type ManualJournals array with an updated ManualJournal - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param manualJournals The manualJournals parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals, Map params) throws IOException { - HttpResponse response = updateManualJournalForHttpResponse(xeroTenantId, manualJournalID, manualJournals, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { + public HttpResponse updateManualJournalForHttpResponse( String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); @@ -25503,110 +10349,13 @@ public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, java.io.InputStream manualJournals, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); - }// verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = manualJournals == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, manualJournals); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); - }// verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update a specified Attachment on ManualJournal by file name *

200 - Success - return response of type Attachments array with an update Attachment for a ManualJournals @@ -25618,31 +10367,13 @@ public HttpResponse updateManualJournalForHttpResponse(String xeroTenantId, UUID * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update a specified Attachment on ManualJournal by file name - *

200 - Success - return response of type Attachments array with an update Attachment for a ManualJournals - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName The name of the file being attached to a ManualJournal - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body) throws IOException { + public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); @@ -25670,7 +10401,7 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -25682,121 +10413,15 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID manualJournalID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update a specified purchase order *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder @@ -25813,103 +10438,7 @@ public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrd return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update a specified purchase order - *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for a PurchaseOrder - * @param purchaseOrders The purchaseOrders parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders, Map params) throws IOException { - HttpResponse response = updatePurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, purchaseOrders, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, java.io.InputStream purchaseOrders, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); - }// verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = purchaseOrders == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, purchaseOrders); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders, Map params) throws IOException { + public HttpResponse updatePurchaseOrderForHttpResponse( String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); @@ -25925,7 +10454,6 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID headers.setAccept("application/json"); String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; - // Hacky path manipulation to support different return types from same endpoint String path = "/PurchaseOrders/{PurchaseOrderID}"; String type = "/pdf"; @@ -25940,146 +10468,33 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String xeroTenantId, UUID UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - - /** - * Allows you to retrieve a specified draft expense claim receipts - *

200 - Success - return response of type Receipts array for updated Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param receipts The receipts parameter - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { - HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - /** - * Allows you to retrieve a specified draft expense claim receipts - *

200 - Success - return response of type Receipts array for updated Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param receipts The receipts parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Receipts - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts, Map params) throws IOException { - HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); - }// verify the required parameter 'receipts' is set - if (receipts == null) { - throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, java.io.InputStream receipts, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); - }// verify the required parameter 'receipts' is set - if (receipts == null) { - throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = receipts == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, receipts); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID receiptID, Receipts receipts, Map params) throws IOException { + /** + * Allows you to retrieve a specified draft expense claim receipts + *

200 - Success - return response of type Receipts array for updated Receipt + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param receiptID Unique identifier for a Receipt + * @param receipts The receipts parameter + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { + HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateReceiptForHttpResponse( String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); @@ -26095,7 +10510,6 @@ public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID recei headers.setAccept("application/json"); String correctPath = "/Receipts/{ReceiptID}"; - // Hacky path manipulation to support different return types from same endpoint String path = "/Receipts/{ReceiptID}"; String type = "/pdf"; @@ -26110,33 +10524,16 @@ public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID recei UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); - + + + HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update Attachment on expense claim receipts by file name *

200 - Success - return response of type Attachments array with updated Attachment for a specified Receipt @@ -26148,31 +10545,13 @@ public HttpResponse updateReceiptForHttpResponse(String xeroTenantId, UUID recei * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update Attachment on expense claim receipts by file name - *

200 - Success - return response of type Attachments array with updated Attachment for a specified Receipt - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param fileName The name of the file being attached to the Receipt - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body) throws IOException { + public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); @@ -26200,7 +10579,7 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xero } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -26212,121 +10591,15 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID receiptID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update specified attachment on repeating invoices by file name *

200 - Success - return response of type Attachments array with specified Attachment for a specified Repeating Invoice @@ -26338,31 +10611,13 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String xero * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update specified attachment on repeating invoices by file name - *

200 - Success - return response of type Attachments array with specified Attachment for a specified Repeating Invoice - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName The name of the file being attached to a Repeating Invoice - * @param body Byte array of file in body of request - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { - HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body) throws IOException { + public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); @@ -26390,7 +10645,7 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St } // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -26402,121 +10657,15 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, java.io.InputStream body, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = body == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(String xeroTenantId, UUID repeatingInvoiceID, String fileName, byte[] body, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // Set ContentType for Binary data - headers.setContentType("application/octet-stream"); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); + HttpContent content = new FileContent(mimeType, body); + - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(body); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update Tax Rates *

200 - Success - return response of type TaxRates array updated TaxRate @@ -26532,23 +10681,7 @@ public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates) throws IO return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update Tax Rates - *

200 - Success - return response of type TaxRates array updated TaxRate - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param taxRates The taxRates parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TaxRates - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { - HttpResponse response = updateTaxRateForHttpResponse(xeroTenantId, taxRates, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates) throws IOException { + public HttpResponse updateTaxRateForHttpResponse( String xeroTenantId, TaxRates taxRates) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); @@ -26567,80 +10700,13 @@ public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates t String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, java.io.InputStream taxRates, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); - }// verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TaxRates"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = taxRates == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, taxRates); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateTaxRateForHttpResponse(String xeroTenantId, TaxRates taxRates, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); - }// verify the required parameter 'taxRates' is set - if (taxRates == null) { - throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TaxRates"; - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); - + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - /** * Allows you to update tracking categories *

200 - Success - return response of type TrackingCategories array of updated TrackingCategory @@ -26657,24 +10723,7 @@ public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trac return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - /** - * Allows you to update tracking categories - *

200 - Success - return response of type TrackingCategories array of updated TrackingCategory - *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant - * @param trackingCategoryID Unique identifier for a TrackingCategory - * @param trackingCategory The trackingCategory parameter - * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. - * @return TrackingCategories - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory, Map params) throws IOException { - HttpResponse response = updateTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, trackingCategory, params); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } - - public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { + public HttpResponse updateTrackingCategoryForHttpResponse( String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); @@ -26707,111 +10756,14 @@ public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, U String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, java.io.InputStream trackingCategory, String mediaType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); - }// verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); - } - - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - HttpContent content = trackingCategory == null ? - apiClient.new JacksonJsonHttpContent(null) : - new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, trackingCategory); - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - public HttpResponse updateTrackingCategoryForHttpResponse(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory, Map params) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set - if (trackingCategoryID == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); - }// verify the required parameter 'trackingCategory' is set - if (trackingCategory == null) { - throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; - - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("TrackingCategoryID", trackingCategoryID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - - // Copy the params argument if present, to allow passing in immutable maps - Map allParams = params == null ? new HashMap() : new HashMap(params); - - for (Map.Entry entry: allParams.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - - if (key != null && value != null) { - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); - - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - public ByteArrayInputStream convertInputToByteArray(InputStream is) throws IOException { byte[] bytes = IOUtils.toByteArray(is); try { From dc8c7c2b48009ab07cec8ffe4ae2963df05929e3 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Fri, 14 Jun 2019 09:31:04 -0700 Subject: [PATCH 09/76] updating with new example --- .../com/xero/api/client/AccountingApi.java | 2492 +++++++---------- .../xero/example/AuthenticatedResource.java | 2130 ++++++++++++++ .../java/com/xero/example/Authorization.java | 20 +- src/main/java/com/xero/example/Callback.java | 41 +- 4 files changed, 3249 insertions(+), 1434 deletions(-) create mode 100755 src/main/java/com/xero/example/AuthenticatedResource.java diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index 17ef9831..899615c6 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -54,15 +54,15 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpContent; -import com.google.api.client.http.InputStreamContent; import com.google.api.client.http.HttpMethods; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpResponse; -import com.google.api.client.json.Json; +import com.google.api.client.http.FileContent; import javax.ws.rs.core.UriBuilder; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; import java.io.ByteArrayInputStream; import java.util.Collection; @@ -119,17 +119,19 @@ public HttpResponse createAccountForHttpResponse( String xeroTenantId, Account HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(account); + - HttpContent content = apiClient.new JacksonJsonHttpContent(account); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -168,18 +170,7 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -187,14 +178,18 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( String xer uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -227,9 +222,7 @@ public HttpResponse createBankTransactionForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; @@ -242,13 +235,17 @@ public HttpResponse createBankTransactionForHttpResponse( String xeroTenantId, uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(bankTransactions); + - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -287,18 +284,7 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( St HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -306,14 +292,18 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( St uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -349,28 +339,24 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse( String xe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -401,17 +387,19 @@ public HttpResponse createBankTransferForHttpResponse( String xeroTenantId, Ban HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(bankTransfers); + - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransfers); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -449,18 +437,7 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( Strin HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -468,14 +445,18 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( Strin uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -510,28 +491,24 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse( String xeroT HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -562,17 +539,19 @@ public HttpResponse createBatchPaymentForHttpResponse( String xeroTenantId, Bat HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BatchPayments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(batchPayments); + - HttpContent content = apiClient.new JacksonJsonHttpContent(batchPayments); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -607,28 +586,24 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( String xeroT HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BatchPayments/{BatchPaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BatchPayments/{BatchPaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BatchPaymentID", batchPaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -663,28 +638,24 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse( String xe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BrandingThemeID", brandingThemeID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(paymentService); + - HttpContent content = apiClient.new JacksonJsonHttpContent(paymentService); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -714,17 +685,19 @@ public HttpResponse createContactForHttpResponse( String xeroTenantId, Contact HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(contact); + - HttpContent content = apiClient.new JacksonJsonHttpContent(contact); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -762,18 +735,7 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -781,14 +743,18 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( String xer uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -820,17 +786,19 @@ public HttpResponse createContactGroupForHttpResponse( String xeroTenantId, Con HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(contactGroups); + - HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -865,28 +833,24 @@ public HttpResponse createContactGroupContactsForHttpResponse( String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(contacts); + - HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -921,28 +885,24 @@ public HttpResponse createContactHistoryForHttpResponse( String xeroTenantId, U HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -974,9 +934,7 @@ public HttpResponse createCreditNoteForHttpResponse( String xeroTenantId, Credi HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; @@ -989,13 +947,17 @@ public HttpResponse createCreditNoteForHttpResponse( String xeroTenantId, Credi uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(creditNotes); + - HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1030,28 +992,24 @@ public HttpResponse createCreditNoteAllocationForHttpResponse( String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Allocations"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Allocations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(allocations); + - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1090,18 +1048,7 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( String HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1109,14 +1056,18 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( String uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1152,28 +1103,24 @@ public HttpResponse createCreditNoteHistoryForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1202,17 +1149,19 @@ public HttpResponse createCurrencyForHttpResponse( String xeroTenantId, Currenc HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Currencies"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(currencies); + - HttpContent content = apiClient.new JacksonJsonHttpContent(currencies); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1243,17 +1192,19 @@ public HttpResponse createEmployeeForHttpResponse( String xeroTenantId, Employe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Employees"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(employees); + - HttpContent content = apiClient.new JacksonJsonHttpContent(employees); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1285,9 +1236,7 @@ public HttpResponse createExpenseClaimForHttpResponse( String xeroTenantId, Exp HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; @@ -1300,13 +1249,17 @@ public HttpResponse createExpenseClaimForHttpResponse( String xeroTenantId, Exp uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(expenseClaims); + - HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1340,28 +1293,24 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse( String xeroTenantI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1393,9 +1342,7 @@ public HttpResponse createInvoiceForHttpResponse( String xeroTenantId, Invoices HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; @@ -1408,13 +1355,17 @@ public HttpResponse createInvoiceForHttpResponse( String xeroTenantId, Invoices uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(invoices); + - HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1453,18 +1404,7 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1472,14 +1412,18 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( String xer uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1515,28 +1459,24 @@ public HttpResponse createInvoiceHistoryForHttpResponse( String xeroTenantId, U HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1567,17 +1507,19 @@ public HttpResponse createItemForHttpResponse( String xeroTenantId, Items items HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Items"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(items); + - HttpContent content = apiClient.new JacksonJsonHttpContent(items); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1611,28 +1553,24 @@ public HttpResponse createItemHistoryForHttpResponse( String xeroTenantId, UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Items/{ItemID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1663,17 +1601,19 @@ public HttpResponse createLinkedTransactionForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/LinkedTransactions"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + - HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1704,17 +1644,19 @@ public HttpResponse createManualJournalForHttpResponse( String xeroTenantId, Ma HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ManualJournals"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(manualJournals); + - HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1753,18 +1695,7 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( Stri HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1772,14 +1703,18 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( Stri uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1815,28 +1750,24 @@ public HttpResponse createOverpaymentAllocationForHttpResponse( String xeroTenan HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Overpayments/{OverpaymentID}/Allocations"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/Allocations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(allocations); + - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1871,28 +1802,24 @@ public HttpResponse createOverpaymentHistoryForHttpResponse( String xeroTenantId HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Overpayments/{OverpaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1923,17 +1850,19 @@ public HttpResponse createPaymentForHttpResponse( String xeroTenantId, Payments HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Payments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(payments); + - HttpContent content = apiClient.new JacksonJsonHttpContent(payments); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -1968,28 +1897,24 @@ public HttpResponse createPaymentHistoryForHttpResponse( String xeroTenantId, U HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Payments/{PaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2020,17 +1945,19 @@ public HttpResponse createPaymentServiceForHttpResponse( String xeroTenantId, P HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/PaymentServices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(paymentServices); + - HttpContent content = apiClient.new JacksonJsonHttpContent(paymentServices); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2065,28 +1992,24 @@ public HttpResponse createPrepaymentAllocationForHttpResponse( String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Prepayments/{PrepaymentID}/Allocations"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/Allocations"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(allocations); + - HttpContent content = apiClient.new JacksonJsonHttpContent(allocations); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2121,28 +2044,24 @@ public HttpResponse createPrepaymentHistoryForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Prepayments/{PrepaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2174,9 +2093,7 @@ public HttpResponse createPurchaseOrderForHttpResponse( String xeroTenantId, Pu HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/PurchaseOrders"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { String key = "SummarizeErrors"; @@ -2189,13 +2106,17 @@ public HttpResponse createPurchaseOrderForHttpResponse( String xeroTenantId, Pu uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + - HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2230,28 +2151,24 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse( String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2282,17 +2199,19 @@ public HttpResponse createReceiptForHttpResponse( String xeroTenantId, Receipts HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Receipts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(receipts); + - HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2331,18 +2250,7 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2350,14 +2258,18 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( String xer uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2393,28 +2305,24 @@ public HttpResponse createReceiptHistoryForHttpResponse( String xeroTenantId, U HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Receipts/{ReceiptID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2453,18 +2361,7 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( S HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2472,14 +2369,18 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( S uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2515,28 +2416,24 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( String xeroTen HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(historyRecords); + - HttpContent content = apiClient.new JacksonJsonHttpContent(historyRecords); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2567,17 +2464,19 @@ public HttpResponse createTaxRateForHttpResponse( String xeroTenantId, TaxRates HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TaxRates"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(taxRates); + - HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2608,17 +2507,19 @@ public HttpResponse createTrackingCategoryForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(trackingCategory); + - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2653,28 +2554,24 @@ public HttpResponse createTrackingOptionsForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}/Options"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(trackingOption); + - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingOption); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } @@ -2705,26 +2602,22 @@ public HttpResponse deleteAccountForHttpResponse( String xeroTenantId, UUID acc HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -2756,15 +2649,7 @@ public HttpResponse deleteContactGroupContactForHttpResponse( String xeroTenantI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); @@ -2772,11 +2657,15 @@ public HttpResponse deleteContactGroupContactForHttpResponse( String xeroTenantI uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -2803,26 +2692,22 @@ public HttpResponse deleteContactGroupContactsForHttpResponse( String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}/Contacts"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -2850,26 +2735,22 @@ public HttpResponse deleteItemForHttpResponse( String xeroTenantId, UUID itemID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Items/{ItemID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -2897,26 +2778,22 @@ public HttpResponse deleteLinkedTransactionForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("LinkedTransactionID", linkedTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -2951,28 +2828,24 @@ public HttpResponse deletePaymentForHttpResponse( String xeroTenantId, UUID pay HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Payments/{PaymentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(payments); + - HttpContent content = apiClient.new JacksonJsonHttpContent(payments); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -3003,26 +2876,22 @@ public HttpResponse deleteTrackingCategoryForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -3057,15 +2926,7 @@ public HttpResponse deleteTrackingOptionsForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); @@ -3073,11 +2934,15 @@ public HttpResponse deleteTrackingOptionsForHttpResponse( String xeroTenantId, uriVariables.put("TrackingOptionID", trackingOptionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } @@ -3109,28 +2974,24 @@ public HttpResponse emailInvoiceForHttpResponse( String xeroTenantId, UUID invo HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/Email"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Email"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(requestEmpty); + - HttpContent content = apiClient.new JacksonJsonHttpContent(requestEmpty); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -3160,26 +3021,22 @@ public HttpResponse getAccountForHttpResponse( String xeroTenantId, UUID accoun HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3218,27 +3075,30 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse( String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/Accounts/{AccountID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3277,27 +3137,30 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse( String xeroTenantId HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3327,26 +3190,22 @@ public HttpResponse getAccountAttachmentsForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3375,9 +3234,7 @@ public HttpResponse getAccountsForHttpResponse( String xeroTenantId, OffsetDate HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -3400,11 +3257,15 @@ public HttpResponse getAccountsForHttpResponse( String xeroTenantId, OffsetDate uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3434,26 +3295,22 @@ public HttpResponse getBankTransactionForHttpResponse( String xeroTenantId, UUI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3492,27 +3349,30 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( Strin HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3551,27 +3411,30 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( String xero HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3601,26 +3464,22 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse( String xeroTen HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3651,9 +3510,7 @@ public HttpResponse getBankTransactionsForHttpResponse( String xeroTenantId, Of HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -3696,11 +3553,15 @@ public HttpResponse getBankTransactionsForHttpResponse( String xeroTenantId, Of uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3730,26 +3591,22 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse( String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3779,26 +3636,22 @@ public HttpResponse getBankTransferForHttpResponse( String xeroTenantId, UUID b HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3837,27 +3690,30 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( String x HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3896,27 +3752,30 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse( String xeroTen HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3946,26 +3805,22 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse( String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -3995,26 +3850,22 @@ public HttpResponse getBankTransferHistoryForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4043,9 +3894,7 @@ public HttpResponse getBankTransfersForHttpResponse( String xeroTenantId, Offse HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -4068,11 +3917,15 @@ public HttpResponse getBankTransfersForHttpResponse( String xeroTenantId, Offse uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4102,26 +3955,22 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BatchPayments/{BatchPaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BatchPayments/{BatchPaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BatchPaymentID", batchPaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4150,9 +3999,7 @@ public HttpResponse getBatchPaymentsForHttpResponse( String xeroTenantId, Offse HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BatchPayments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -4175,11 +4022,15 @@ public HttpResponse getBatchPaymentsForHttpResponse( String xeroTenantId, Offse uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4209,26 +4060,22 @@ public HttpResponse getBrandingThemeForHttpResponse( String xeroTenantId, UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BrandingThemes/{BrandingThemeID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BrandingThemeID", brandingThemeID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4258,26 +4105,22 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse( String xeroT HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BrandingThemeID", brandingThemeID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4303,15 +4146,17 @@ public HttpResponse getBrandingThemesForHttpResponse( String xeroTenantId) throw HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BrandingThemes"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4341,26 +4186,22 @@ public HttpResponse getContactForHttpResponse( String xeroTenantId, UUID contac HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4399,27 +4240,30 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse( String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/Contacts/{ContactID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4458,27 +4302,30 @@ public HttpResponse getContactAttachmentByIdForHttpResponse( String xeroTenantId HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4508,26 +4355,22 @@ public HttpResponse getContactAttachmentsForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4557,28 +4400,24 @@ public HttpResponse getContactCISSettingsForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/CISSettings"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/CISSettings"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } /** @@ -4606,26 +4445,22 @@ public HttpResponse getContactGroupForHttpResponse( String xeroTenantId, UUID c HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups/{ContactGroupID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4653,9 +4488,7 @@ public HttpResponse getContactGroupsForHttpResponse( String xeroTenantId, Strin HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -4678,11 +4511,15 @@ public HttpResponse getContactGroupsForHttpResponse( String xeroTenantId, Strin uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4712,26 +4549,22 @@ public HttpResponse getContactHistoryForHttpResponse( String xeroTenantId, UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4763,9 +4596,7 @@ public HttpResponse getContactsForHttpResponse( String xeroTenantId, OffsetDate HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -4818,11 +4649,15 @@ public HttpResponse getContactsForHttpResponse( String xeroTenantId, OffsetDate uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4852,26 +4687,22 @@ public HttpResponse getCreditNoteForHttpResponse( String xeroTenantId, UUID cre HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4906,26 +4737,29 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse( String xeroTenantId, UUI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/pdf"; + // Hacky path manipulation to support different return types from same endpoint String path = "/CreditNotes/{CreditNoteID}/pdf"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -4964,27 +4798,30 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5023,27 +4860,30 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( String xeroTenan HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5073,26 +4913,22 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse( String xeroTenantId HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5122,26 +4958,22 @@ public HttpResponse getCreditNoteHistoryForHttpResponse( String xeroTenantId, U HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5171,9 +5003,7 @@ public HttpResponse getCreditNotesForHttpResponse( String xeroTenantId, OffsetD HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -5206,11 +5036,15 @@ public HttpResponse getCreditNotesForHttpResponse( String xeroTenantId, OffsetD uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5238,9 +5072,7 @@ public HttpResponse getCurrenciesForHttpResponse( String xeroTenantId, String w HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Currencies"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -5263,11 +5095,15 @@ public HttpResponse getCurrenciesForHttpResponse( String xeroTenantId, String w uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5297,26 +5133,22 @@ public HttpResponse getEmployeeForHttpResponse( String xeroTenantId, UUID emplo HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Employees/{EmployeeID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Employees/{EmployeeID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("EmployeeID", employeeID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5345,9 +5177,7 @@ public HttpResponse getEmployeesForHttpResponse( String xeroTenantId, OffsetDat HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Employees"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -5370,11 +5200,15 @@ public HttpResponse getEmployeesForHttpResponse( String xeroTenantId, OffsetDat uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5404,26 +5238,22 @@ public HttpResponse getExpenseClaimForHttpResponse( String xeroTenantId, UUID e HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5453,26 +5283,22 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5501,9 +5327,7 @@ public HttpResponse getExpenseClaimsForHttpResponse( String xeroTenantId, Offse HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -5526,11 +5350,15 @@ public HttpResponse getExpenseClaimsForHttpResponse( String xeroTenantId, Offse uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5560,26 +5388,22 @@ public HttpResponse getInvoiceForHttpResponse( String xeroTenantId, UUID invoic HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5614,26 +5438,29 @@ public HttpResponse getInvoiceAsPdfForHttpResponse( String xeroTenantId, UUID i HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/pdf"; + // Hacky path manipulation to support different return types from same endpoint String path = "/Invoices/{InvoiceID}/pdf"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5672,27 +5499,30 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5731,27 +5561,30 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse( String xeroTenantId HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5781,26 +5614,22 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5830,26 +5659,22 @@ public HttpResponse getInvoiceHistoryForHttpResponse( String xeroTenantId, UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5875,15 +5700,17 @@ public HttpResponse getInvoiceRemindersForHttpResponse( String xeroTenantId) thr HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/InvoiceReminders/Settings"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -5920,9 +5747,7 @@ public HttpResponse getInvoicesForHttpResponse( String xeroTenantId, OffsetDate HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -6025,11 +5850,15 @@ public HttpResponse getInvoicesForHttpResponse( String xeroTenantId, OffsetDate uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6059,26 +5888,22 @@ public HttpResponse getItemForHttpResponse( String xeroTenantId, UUID itemID) t HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Items/{ItemID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6108,26 +5933,22 @@ public HttpResponse getItemHistoryForHttpResponse( String xeroTenantId, UUID it HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Items/{ItemID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6157,9 +5978,7 @@ public HttpResponse getItemsForHttpResponse( String xeroTenantId, OffsetDateTim HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Items"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -6192,11 +6011,15 @@ public HttpResponse getItemsForHttpResponse( String xeroTenantId, OffsetDateTim uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6226,26 +6049,22 @@ public HttpResponse getJournalForHttpResponse( String xeroTenantId, UUID journa HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Journals/{JournalID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Journals/{JournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("JournalID", journalID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6274,9 +6093,7 @@ public HttpResponse getJournalsForHttpResponse( String xeroTenantId, OffsetDate HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Journals"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (offset != null) { String key = "offset"; @@ -6299,11 +6116,15 @@ public HttpResponse getJournalsForHttpResponse( String xeroTenantId, OffsetDate uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6333,26 +6154,22 @@ public HttpResponse getLinkedTransactionForHttpResponse( String xeroTenantId, U HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("LinkedTransactionID", linkedTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6384,9 +6201,7 @@ public HttpResponse getLinkedTransactionsForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/LinkedTransactions"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (page != null) { String key = "page"; @@ -6449,11 +6264,15 @@ public HttpResponse getLinkedTransactionsForHttpResponse( String xeroTenantId, uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6483,26 +6302,22 @@ public HttpResponse getManualJournalForHttpResponse( String xeroTenantId, UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ManualJournals/{ManualJournalID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6541,27 +6356,30 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( String HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6600,27 +6418,30 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse( String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6650,26 +6471,22 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse( String xeroTenan HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6699,9 +6516,7 @@ public HttpResponse getManualJournalsForHttpResponse( String xeroTenantId, Offs HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ManualJournals"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -6734,11 +6549,15 @@ public HttpResponse getManualJournalsForHttpResponse( String xeroTenantId, Offs uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6768,26 +6587,22 @@ public HttpResponse getOnlineInvoiceForHttpResponse( String xeroTenantId, UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/OnlineInvoice"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/OnlineInvoice"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6817,26 +6632,22 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse( String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Organisation/{OrganisationID}/CISSettings"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Organisation/{OrganisationID}/CISSettings"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OrganisationID", organisationID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6862,15 +6673,17 @@ public HttpResponse getOrganisationsForHttpResponse( String xeroTenantId) throws HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Organisation"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6900,26 +6713,22 @@ public HttpResponse getOverpaymentForHttpResponse( String xeroTenantId, UUID ov HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Overpayments/{OverpaymentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6949,26 +6758,22 @@ public HttpResponse getOverpaymentHistoryForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Overpayments/{OverpaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Overpayments/{OverpaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("OverpaymentID", overpaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -6999,9 +6804,7 @@ public HttpResponse getOverpaymentsForHttpResponse( String xeroTenantId, Offset HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Overpayments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -7044,11 +6847,15 @@ public HttpResponse getOverpaymentsForHttpResponse( String xeroTenantId, Offset uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7078,26 +6885,22 @@ public HttpResponse getPaymentForHttpResponse( String xeroTenantId, UUID paymen HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Payments/{PaymentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7127,26 +6930,22 @@ public HttpResponse getPaymentHistoryForHttpResponse( String xeroTenantId, UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Payments/{PaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Payments/{PaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PaymentID", paymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7172,15 +6971,17 @@ public HttpResponse getPaymentServicesForHttpResponse( String xeroTenantId) thro HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/PaymentServices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7209,9 +7010,7 @@ public HttpResponse getPaymentsForHttpResponse( String xeroTenantId, OffsetDate HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Payments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -7234,11 +7033,15 @@ public HttpResponse getPaymentsForHttpResponse( String xeroTenantId, OffsetDate uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7268,26 +7071,22 @@ public HttpResponse getPrepaymentForHttpResponse( String xeroTenantId, UUID pre HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Prepayments/{PrepaymentID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7317,26 +7116,22 @@ public HttpResponse getPrepaymentHistoryForHttpResponse( String xeroTenantId, U HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Prepayments/{PrepaymentID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Prepayments/{PrepaymentID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PrepaymentID", prepaymentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7367,9 +7162,7 @@ public HttpResponse getPrepaymentsForHttpResponse( String xeroTenantId, OffsetD HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Prepayments"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -7412,11 +7205,15 @@ public HttpResponse getPrepaymentsForHttpResponse( String xeroTenantId, OffsetD uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7446,26 +7243,22 @@ public HttpResponse getPurchaseOrderForHttpResponse( String xeroTenantId, UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7495,26 +7288,22 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7546,9 +7335,7 @@ public HttpResponse getPurchaseOrdersForHttpResponse( String xeroTenantId, Offs HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/PurchaseOrders"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (status != null) { String key = "Status"; @@ -7601,11 +7388,15 @@ public HttpResponse getPurchaseOrdersForHttpResponse( String xeroTenantId, Offs uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7635,26 +7426,22 @@ public HttpResponse getReceiptForHttpResponse( String xeroTenantId, UUID receip HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Receipts/{ReceiptID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7693,27 +7480,30 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7752,27 +7542,30 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse( String xeroTenantId HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7802,26 +7595,22 @@ public HttpResponse getReceiptAttachmentsForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Receipts/{ReceiptID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7851,26 +7640,22 @@ public HttpResponse getReceiptHistoryForHttpResponse( String xeroTenantId, UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Receipts/{ReceiptID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7900,9 +7685,7 @@ public HttpResponse getReceiptsForHttpResponse( String xeroTenantId, OffsetDate HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Receipts"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -7935,11 +7718,15 @@ public HttpResponse getReceiptsForHttpResponse( String xeroTenantId, OffsetDate uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -7969,26 +7756,22 @@ public HttpResponse getRepeatingInvoiceForHttpResponse( String xeroTenantId, UU HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8027,27 +7810,30 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( Stri HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8086,27 +7872,30 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; + // Hacky path manipulation to support different return types from same endpoint String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; String type = "/pdf"; if(path.toLowerCase().contains(type.toLowerCase())) { correctPath = path.replace("/pdf",""); headers.setAccept("application/pdf"); - } - + } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); uriVariables.put("AttachmentID", attachmentID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8136,26 +7925,22 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8185,26 +7970,22 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8232,9 +8013,7 @@ public HttpResponse getRepeatingInvoicesForHttpResponse( String xeroTenantId, S HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/RepeatingInvoices"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -8257,11 +8036,15 @@ public HttpResponse getRepeatingInvoicesForHttpResponse( String xeroTenantId, S uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8294,9 +8077,7 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse( String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports/AgedPayablesByContact"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (contactId != null) { String key = "contactId"; @@ -8339,11 +8120,15 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse( String xeroTe uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8376,9 +8161,7 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse( String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports/AgedReceivablesByContact"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (contactId != null) { String key = "contactId"; @@ -8421,11 +8204,15 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse( String xer uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8455,26 +8242,22 @@ public HttpResponse getReportBASorGSTForHttpResponse( String xeroTenantId, Stri HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports/{ReportID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Reports/{ReportID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReportID", reportID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8500,15 +8283,17 @@ public HttpResponse getReportBASorGSTListForHttpResponse( String xeroTenantId) t HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8541,9 +8326,7 @@ public HttpResponse getReportBalanceSheetForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports/BalanceSheet"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { String key = "date"; @@ -8616,11 +8399,15 @@ public HttpResponse getReportBalanceSheetForHttpResponse( String xeroTenantId, uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8649,9 +8436,7 @@ public HttpResponse getReportBankSummaryForHttpResponse( String xeroTenantId, L HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports/BankSummary"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { String key = "date"; @@ -8684,11 +8469,15 @@ public HttpResponse getReportBankSummaryForHttpResponse( String xeroTenantId, L uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8717,9 +8506,7 @@ public HttpResponse getReportBudgetSummaryForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports/BudgetSummary"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { String key = "date"; @@ -8752,11 +8539,15 @@ public HttpResponse getReportBudgetSummaryForHttpResponse( String xeroTenantId, uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8783,9 +8574,7 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse( String xeroTenantI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports/ExecutiveSummary"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { String key = "date"; @@ -8798,11 +8587,15 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse( String xeroTenantI uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8838,9 +8631,7 @@ public HttpResponse getReportProfitAndLossForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports/ProfitAndLoss"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (fromDate != null) { String key = "fromDate"; @@ -8943,11 +8734,15 @@ public HttpResponse getReportProfitAndLossForHttpResponse( String xeroTenantId, uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -8974,9 +8769,7 @@ public HttpResponse getReportTenNinetyNineForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports/TenNinetyNine"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (reportYear != null) { String key = "reportYear"; @@ -8989,11 +8782,15 @@ public HttpResponse getReportTenNinetyNineForHttpResponse( String xeroTenantId, uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9021,9 +8818,7 @@ public HttpResponse getReportTrialBalanceForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Reports/TrialBalance"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { String key = "date"; @@ -9046,11 +8841,15 @@ public HttpResponse getReportTrialBalanceForHttpResponse( String xeroTenantId, uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9079,9 +8878,7 @@ public HttpResponse getTaxRatesForHttpResponse( String xeroTenantId, String whe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TaxRates"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -9114,11 +8911,15 @@ public HttpResponse getTaxRatesForHttpResponse( String xeroTenantId, String whe uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9147,9 +8948,7 @@ public HttpResponse getTrackingCategoriesForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -9182,11 +8981,15 @@ public HttpResponse getTrackingCategoriesForHttpResponse( String xeroTenantId, uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9216,26 +9019,22 @@ public HttpResponse getTrackingCategoryForHttpResponse( String xeroTenantId, UU HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9265,26 +9064,22 @@ public HttpResponse getUserForHttpResponse( String xeroTenantId, UUID userID) t HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Users/{UserID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Users/{UserID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("UserID", userID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9313,9 +9108,7 @@ public HttpResponse getUsersForHttpResponse( String xeroTenantId, OffsetDateTim HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Users"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -9338,11 +9131,15 @@ public HttpResponse getUsersForHttpResponse( String xeroTenantId, OffsetDateTim uriBuilder = uriBuilder.queryParam(key, value); } } - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } @@ -9377,28 +9174,24 @@ public HttpResponse updateAccountForHttpResponse( String xeroTenantId, UUID acc HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("AccountID", accountID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(accounts); + - HttpContent content = apiClient.new JacksonJsonHttpContent(accounts); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -9437,18 +9230,7 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Accounts/{AccountID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -9456,14 +9238,18 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( String xer uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -9499,28 +9285,24 @@ public HttpResponse updateBankTransactionForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(bankTransactions); + - HttpContent content = apiClient.new JacksonJsonHttpContent(bankTransactions); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -9559,18 +9341,7 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( St HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -9578,14 +9349,18 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( St uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -9624,18 +9399,7 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( Strin HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -9643,14 +9407,18 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( Strin uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -9685,28 +9453,24 @@ public HttpResponse updateContactForHttpResponse( String xeroTenantId, UUID con HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactID", contactID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(contacts); + - HttpContent content = apiClient.new JacksonJsonHttpContent(contacts); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -9744,18 +9508,7 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Contacts/{ContactID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -9763,14 +9516,18 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( String xer uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -9806,28 +9563,24 @@ public HttpResponse updateContactGroupForHttpResponse( String xeroTenantId, UUI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ContactGroups/{ContactGroupID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ContactGroups/{ContactGroupID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ContactGroupID", contactGroupID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(contactGroups); + - HttpContent content = apiClient.new JacksonJsonHttpContent(contactGroups); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -9862,28 +9615,24 @@ public HttpResponse updateCreditNoteForHttpResponse( String xeroTenantId, UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(creditNotes); + - HttpContent content = apiClient.new JacksonJsonHttpContent(creditNotes); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -9922,18 +9671,7 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( String HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -9941,14 +9679,18 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( String uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -9984,28 +9726,24 @@ public HttpResponse updateEmployeeForHttpResponse( String xeroTenantId, UUID em HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Employees/{EmployeeID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Employees/{EmployeeID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("EmployeeID", employeeID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(employees); + - HttpContent content = apiClient.new JacksonJsonHttpContent(employees); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -10040,28 +9778,24 @@ public HttpResponse updateExpenseClaimForHttpResponse( String xeroTenantId, UUI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ExpenseClaims/{ExpenseClaimID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ExpenseClaimID", expenseClaimID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(expenseClaims); + - HttpContent content = apiClient.new JacksonJsonHttpContent(expenseClaims); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -10096,28 +9830,24 @@ public HttpResponse updateInvoiceForHttpResponse( String xeroTenantId, UUID inv HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(invoices); + - HttpContent content = apiClient.new JacksonJsonHttpContent(invoices); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -10156,18 +9886,7 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Invoices/{InvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10175,14 +9894,18 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( String xer uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -10218,28 +9941,24 @@ public HttpResponse updateItemForHttpResponse( String xeroTenantId, UUID itemID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Items/{ItemID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Items/{ItemID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ItemID", itemID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(items); + - HttpContent content = apiClient.new JacksonJsonHttpContent(items); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -10274,28 +9993,24 @@ public HttpResponse updateLinkedTransactionForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/LinkedTransactions/{LinkedTransactionID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("LinkedTransactionID", linkedTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + - HttpContent content = apiClient.new JacksonJsonHttpContent(linkedTransactions); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -10330,28 +10045,24 @@ public HttpResponse updateManualJournalForHttpResponse( String xeroTenantId, UU HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ManualJournals/{ManualJournalID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(manualJournals); + - HttpContent content = apiClient.new JacksonJsonHttpContent(manualJournals); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -10390,18 +10101,7 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( Stri HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10409,14 +10109,18 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( Stri uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -10452,28 +10156,24 @@ public HttpResponse updatePurchaseOrderForHttpResponse( String xeroTenantId, UU HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/PurchaseOrders/{PurchaseOrderID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + - HttpContent content = apiClient.new JacksonJsonHttpContent(purchaseOrders); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -10508,28 +10208,24 @@ public HttpResponse updateReceiptForHttpResponse( String xeroTenantId, UUID rec HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Receipts/{ReceiptID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(receipts); + - HttpContent content = apiClient.new JacksonJsonHttpContent(receipts); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -10568,18 +10264,7 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/Receipts/{ReceiptID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10587,14 +10272,18 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( String xer uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -10634,18 +10323,7 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( S HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } - - // Set ContentType for Binary data - //headers.setContentType("application/octet-stream"); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10653,14 +10331,18 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( S uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = new FileContent(mimeType, body); + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + content = new FileContent(mimeType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -10692,17 +10374,19 @@ public HttpResponse updateTaxRateForHttpResponse( String xeroTenantId, TaxRates HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TaxRates"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(taxRates); + - HttpContent content = apiClient.new JacksonJsonHttpContent(taxRates); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } @@ -10737,28 +10421,24 @@ public HttpResponse updateTrackingCategoryForHttpResponse( String xeroTenantId, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - String correctPath = "/TrackingCategories/{TrackingCategoryID}"; - // Hacky path manipulation to support different return types from same endpoint - String path = "/TrackingCategories/{TrackingCategoryID}"; - String type = "/pdf"; - if(path.toLowerCase().contains(type.toLowerCase())) { - correctPath = path.replace("/pdf",""); - headers.setAccept("application/pdf"); - } // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("TrackingCategoryID", trackingCategoryID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(trackingCategory); + - HttpContent content = apiClient.new JacksonJsonHttpContent(trackingCategory); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } diff --git a/src/main/java/com/xero/example/AuthenticatedResource.java b/src/main/java/com/xero/example/AuthenticatedResource.java new file mode 100755 index 00000000..93d8314e --- /dev/null +++ b/src/main/java/com/xero/example/AuthenticatedResource.java @@ -0,0 +1,2130 @@ +package com.xero.example; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.URLConnection; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.googleapis.util.Utils; +import com.google.api.client.http.GenericUrl; +import com.google.api.client.http.HttpHeaders; +import com.google.api.client.http.HttpRequest; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpRequestInitializer; +import com.google.api.client.http.HttpResponse; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.xero.api.*; +import com.xero.models.accounting.*; +import com.xero.models.accounting.Phone.PhoneTypeEnum; +import com.xero.models.accounting.TaxRate.ReportTaxTypeEnum; +import com.xero.api.client.AccountingApi; + +import org.apache.commons.io.IOUtils; +//import java.time.LocalDate; +import org.threeten.bp.*; + +@WebServlet("/AuthenticatedResource") +public class AuthenticatedResource extends HttpServlet +{ + private static final long serialVersionUID = 1L; + //private Config config = null; + //final static Logger logger = LogManager.getLogger(OAuthRequestResource.class); + + private String htmlString = "" + + "" + + "" + + "

Xero API - JAVA

" + + "
" + + "Logout" + + "
" + + "
" + + "
" + + "" + + "" + + "
" + + "
" + + "" + + "
" + + "
"; + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + { + PrintWriter respWriter = response.getWriter(); + response.setStatus(200); + response.setContentType("text/html"); + respWriter.println(htmlString); + } + + @SuppressWarnings("null") + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + { + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + boolean summarizeErrors = false; + String ids= null; + boolean includeArchived = false; + String invoiceNumbers = null; + String contactIDs = null; + String statuses = null; + boolean createdByMyApp = false; + int unitDp = 2; + Calendar now = Calendar.getInstance(); + int day = now.get(Calendar.DATE); + int year = now.get(Calendar.YEAR); + int lastMonth = now.get(Calendar.MONTH) - 1; + int nextMonth = now.get(Calendar.MONTH) + 1; + if (lastMonth == 0) { + lastMonth = 1; + } + if (lastMonth == -1) { + lastMonth = 12; + year = year -1; + } + if (nextMonth == 13) { + nextMonth = 1; + year = year + 1; + } + if (day > 28) { + day = 28; + } + + PrintWriter respWriter = response.getWriter(); + response.setStatus(200); + response.setContentType("text/html"); + respWriter.println(htmlString); + respWriter.println("

begin processing request
"); + + String object = request.getParameter("object"); + ArrayList messages = new ArrayList(); + + // Set Access Token from Storage + TokenStorage store = new TokenStorage(); + String accessToken = store.get(request, "access_token"); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + ApiClient defaultClient = new ApiClient(null,null,null,null,requestFactory); + AccountingApi accountingApi = new AccountingApi(defaultClient); + + // Static Xero Tenant ID + // TODO: getConnections + String xeroTenantId = "--You-need-to-get-from-connections-endpoint--"; + + if (object.equals("Files")) { + // FILES + + } else if (object.equals("Accounts")) { + // ACCOUNTS + try { + // GET all accounts + Accounts accounts = accountingApi.getAccounts(xeroTenantId, null, null, null); + messages.add("Get a all Accounts - total : " + accounts.getAccounts().size()); + + // GET one account + Accounts oneAccount = accountingApi.getAccount(xeroTenantId, accounts.getAccounts().get(0).getAccountID()); + messages.add("Get a one Account - name : " + oneAccount.getAccounts().get(0).getName()); + + // CREATE account + Account acct = new Account(); + acct.setName("Bye" + loadRandomNum()); + acct.setCode("Hello" + loadRandomNum()); + acct.setDescription("Foo boo"); + acct.setType(com.xero.models.accounting.AccountType.EXPENSE); + Accounts newAccount = accountingApi.createAccount(xeroTenantId,acct); + messages.add("Create a new Account - Name : " + newAccount.getAccounts().get(0).getName() + " Description : " + newAccount.getAccounts().get(0).getDescription() + ""); + UUID accountID = newAccount.getAccounts().get(0).getAccountID(); + + // CREATE Bank account + Account bankAcct = new Account(); + bankAcct.setName("Checking " + loadRandomNum()); + bankAcct.setCode("12" + loadRandomNum()); + bankAcct.setType(com.xero.models.accounting.AccountType.BANK); + bankAcct.setBankAccountNumber("1234" + loadRandomNum()); + Accounts newBankAccount = accountingApi.createAccount(xeroTenantId, bankAcct); + messages.add("Create Bank Account - Name : " + newBankAccount.getAccounts().get(0).getName()); + + // GET BANK account + where = "Status==\"ACTIVE\"&&Type==\"BANK\""; + Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId,ifModifiedSince, where, order); + messages.add("Get a all Accounts - total : " + accountsWhere.getAccounts().size()); + + // UDPATE Account + newAccount.getAccounts().get(0).setDescription("Monsters Inc."); + newAccount.getAccounts().get(0).setStatus(null); + Accounts updateAccount = accountingApi.updateAccount(xeroTenantId,accountID, newAccount); + messages.add("Update Account - Name : " + updateAccount.getAccounts().get(0).getName() + " Description : " + updateAccount.getAccounts().get(0).getDescription() + ""); + + // ARCHIVE Account + Accounts archiveAccounts = new Accounts(); + Account archiveAccount = new Account(); + archiveAccount.setStatus(com.xero.models.accounting.Account.StatusEnum.ARCHIVED); + archiveAccount.setAccountID(accountID); + archiveAccounts.addAccountsItem(archiveAccount); + Accounts achivedAccount = accountingApi.updateAccount(xeroTenantId, accountID, archiveAccounts); + messages.add("Archived Account - Name : " + achivedAccount.getAccounts().get(0).getName() + " Status: " + achivedAccount.getAccounts().get(0).getStatus()); + + // DELETE Account + UUID deleteAccountID = newAccount.getAccounts().get(0).getAccountID(); + Accounts deleteAccount = accountingApi.deleteAccount(xeroTenantId, deleteAccountID); + messages.add("Delete account - Status? : " + deleteAccount.getAccounts().get(0).getStatus()); + + } catch (Exception e) { + System.out.println(e.toString()); + e.printStackTrace(); + } + + } else if (object.equals("GetAttachments")) { + + try { + // GET Account Attachment + where = "Status==\"ACTIVE\""; + Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + if (accounts.getAccounts().size() > 0) { + UUID accountID = accounts.getAccounts().get(0).getAccountID(); + Attachments accountsAttachments = accountingApi.getAccountAttachments(xeroTenantId, accountID); + if (accountsAttachments.getAttachments().size() > 0) { + UUID attachementId = accountsAttachments.getAttachments().get(0).getAttachmentID(); + String contentType = accountsAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream input = accountingApi.getAccountAttachmentById(xeroTenantId, accountID,attachementId, contentType); + String fileName = "Account_" + accountsAttachments.getAttachments().get(0).getFileName(); + String saveFilePath = saveFile(input,fileName); + messages.add("Get Account attachment - save it here: " + saveFilePath); + } + } + + // GET BankTransactions Attachment + where = null; + BankTransactions bankTransactions = accountingApi.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, null, null); + if (bankTransactions.getBankTransactions().size() > 0) { + UUID BankTransactionID = bankTransactions.getBankTransactions().get(0).getBankTransactionID(); + Attachments bankTransactionsAttachments = accountingApi.getBankTransactionAttachments(xeroTenantId, BankTransactionID); + if (bankTransactionsAttachments.getAttachments().size() > 0) { + UUID BankTransactionAttachementID = bankTransactionsAttachments.getAttachments().get(0).getAttachmentID(); + String BankTransactionContentType = bankTransactionsAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream BankTransactionInput = accountingApi.getAccountAttachmentById(xeroTenantId, BankTransactionID,BankTransactionAttachementID, BankTransactionContentType); + String BankTransactionFileName = "BankTransaction_" + bankTransactionsAttachments.getAttachments().get(0).getFileName(); + String BankTransactionSaveFilePath = saveFile(BankTransactionInput,BankTransactionFileName); + messages.add("Get BankTransactions attachment - save it here: " + BankTransactionSaveFilePath); + } + } + + // GET BankTransfers Attachment + BankTransfers bankTransfers = accountingApi.getBankTransfers(xeroTenantId, ifModifiedSince, where, order); + if (bankTransfers.getBankTransfers().size() > 0) { + UUID BankTransferID = bankTransfers.getBankTransfers().get(0).getBankTransferID(); + Attachments bankTransfersAttachments = accountingApi.getBankTransferAttachments(xeroTenantId, BankTransferID); + if (bankTransfersAttachments.getAttachments().size() > 0) { + UUID BankTransferAttachementID = bankTransfersAttachments.getAttachments().get(0).getAttachmentID(); + String BankTransferContentType = bankTransfersAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream BankTransferInput = accountingApi.getAccountAttachmentById(xeroTenantId, BankTransferID,BankTransferAttachementID, BankTransferContentType); + String BankTransferFileName = "BankTransfer_" + bankTransfersAttachments.getAttachments().get(0).getFileName(); + String BankTransferSaveFilePath = saveFile(BankTransferInput,BankTransferFileName); + messages.add("Get BankTransfers attachment - save it here: " + BankTransferSaveFilePath); + } + } + // GET Contacts Attachment + where = "ContactStatus==\"ACTIVE\""; + Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + if (contacts.getContacts().size() > 0) { + UUID ContactID = contacts.getContacts().get(0).getContactID(); + Attachments contactsAttachments = accountingApi.getContactAttachments(xeroTenantId, ContactID); + if (contactsAttachments.getAttachments().size() > 0) { + UUID ContactAttachementID = contactsAttachments.getAttachments().get(0).getAttachmentID(); + String ContactContentType = contactsAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream ContactInput = accountingApi.getAccountAttachmentById(xeroTenantId, ContactID,ContactAttachementID, ContactContentType); + String ContactFileName = "Contact_" + contactsAttachments.getAttachments().get(0).getFileName(); + String ContactSaveFilePath = saveFile(ContactInput,ContactFileName); + messages.add("Get Contacts attachment - save it here: " + ContactSaveFilePath); + } + } + // GET CreditNotes Attachment + where = "Status==\"AUTHORISED\""; + CreditNotes creditNotes = accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, null); + if (creditNotes.getCreditNotes().size() > 0) { + UUID CreditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); + Attachments creditNotesAttachments = accountingApi.getCreditNoteAttachments(xeroTenantId, CreditNoteID); + if (creditNotesAttachments.getAttachments().size() > 0) { + UUID CreditNoteAttachementID = creditNotesAttachments.getAttachments().get(0).getAttachmentID(); + String CreditNoteContentType = creditNotesAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream CreditNoteInput = accountingApi.getAccountAttachmentById(xeroTenantId, CreditNoteID,CreditNoteAttachementID, CreditNoteContentType); + String CreditNoteFileName = "CreditNote_" + creditNotesAttachments.getAttachments().get(0).getFileName(); + String CreditNoteSaveFilePath = saveFile(CreditNoteInput,CreditNoteFileName); + messages.add("Get CreditNotes attachment - save it here: " + CreditNoteSaveFilePath); + } + } + + // GET Invoices Attachment + Invoices invoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + if (invoices.getInvoices().size() > 0) { + UUID InvoiceID = invoices.getInvoices().get(0).getInvoiceID(); + Attachments invoicesAttachments = accountingApi.getInvoiceAttachments(xeroTenantId, InvoiceID); + if (invoicesAttachments.getAttachments().size() > 0) { + UUID InvoiceAttachementID = invoicesAttachments.getAttachments().get(0).getAttachmentID(); + String InvoiceContentType = invoicesAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream InvoiceInput = accountingApi.getAccountAttachmentById(xeroTenantId, InvoiceID,InvoiceAttachementID, InvoiceContentType); + String InvoiceFileName = "Invoice_" + invoicesAttachments.getAttachments().get(0).getFileName(); + String InvoiceSaveFilePath = saveFile(InvoiceInput,InvoiceFileName); + messages.add("Get Invoices attachment - save it here: " + InvoiceSaveFilePath); + } + } + + // GET ManualJournals Attachment + where= null; + ManualJournals manualJournals = accountingApi.getManualJournals(xeroTenantId, ifModifiedSince, where, order, null); + if (manualJournals.getManualJournals().size() > 0) { + UUID ManualJournalID = manualJournals.getManualJournals().get(0).getManualJournalID(); + Attachments manualJournalsAttachments = accountingApi.getManualJournalAttachments(xeroTenantId, ManualJournalID); + if (manualJournalsAttachments.getAttachments().size() > 0) { + UUID ManualJournalAttachementID = manualJournalsAttachments.getAttachments().get(0).getAttachmentID(); + String ManualJournalContentType = manualJournalsAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream ManualJournalInput = accountingApi.getAccountAttachmentById(xeroTenantId, ManualJournalID,ManualJournalAttachementID, ManualJournalContentType); + String ManualJournalFileName = "ManualJournal_" + manualJournalsAttachments.getAttachments().get(0).getFileName(); + String ManualJournalSaveFilePath = saveFile(ManualJournalInput,ManualJournalFileName); + messages.add("Get ManualJournals attachment - save it here: " + ManualJournalSaveFilePath); + } + } + + // GET Receipts Attachment + Receipts receipts = accountingApi.getReceipts(xeroTenantId, ifModifiedSince, where, order, null); + if (receipts.getReceipts().size() > 0) { + UUID ReceiptID = receipts.getReceipts().get(0).getReceiptID(); + Attachments receiptsAttachments = accountingApi.getReceiptAttachments(xeroTenantId, ReceiptID); + if (receiptsAttachments.getAttachments().size() > 0) { + UUID ReceiptAttachementID = receiptsAttachments.getAttachments().get(0).getAttachmentID(); + String ReceiptContentType = receiptsAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream ReceiptInput = accountingApi.getAccountAttachmentById(xeroTenantId, ReceiptID,ReceiptAttachementID, ReceiptContentType); + String ReceiptFileName = "Receipt_" + receiptsAttachments.getAttachments().get(0).getFileName(); + String ReceiptSaveFilePath = saveFile(ReceiptInput,ReceiptFileName); + messages.add("Get Receipts attachment - save it here: " + ReceiptSaveFilePath); + } + } + + // GET RepeatingInvoices Attachment + RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(xeroTenantId, where, order); + if (repeatingInvoices.getRepeatingInvoices().size() > 0) { + UUID RepeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); + Attachments repeatingInvoicesAttachments = accountingApi.getRepeatingInvoiceAttachments(xeroTenantId, RepeatingInvoiceID); + if (repeatingInvoicesAttachments.getAttachments().size() > 0) { + UUID RepeatingInvoiceAttachementID = repeatingInvoicesAttachments.getAttachments().get(0).getAttachmentID(); + String RepeatingInvoiceContentType = repeatingInvoicesAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream RepeatingInvoiceInput = accountingApi.getAccountAttachmentById(xeroTenantId, RepeatingInvoiceID,RepeatingInvoiceAttachementID, RepeatingInvoiceContentType); + String RepeatingInvoiceFileName = "RepeatingInvoice_" + repeatingInvoicesAttachments.getAttachments().get(0).getFileName(); + String RepeatingInvoiceSaveFilePath = saveFile(RepeatingInvoiceInput,RepeatingInvoiceFileName); + messages.add("Get RepeatingInvoices attachment - save it here: " + RepeatingInvoiceSaveFilePath); + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("CreateAttachments")) { + // JSON + File bytes = new File("/Users/sid.maestre/eclipse-workspace/xero-sdk-oauth2-dev-01/resources/youngsid.jpg"); + String newFileName = bytes.getName(); + + try { + // CREATE Accounts attachment + where = "Status==\"ACTIVE\""; + Accounts myAccounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + if ( myAccounts.getAccounts().size() > 0) { + UUID accountID = myAccounts.getAccounts().get(0).getAccountID(); + String accountName = myAccounts.getAccounts().get(0).getName(); + Attachments createdAttachments = accountingApi.createAccountAttachmentByFileName(xeroTenantId, accountID, newFileName, bytes); + messages.add("Attachment to Name: " + accountName + " Account ID: " + accountID + " attachment - ID: " + createdAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (Exception e) { + System.out.println(e); + } + + try { + where = null; + // CREATE BankTransactions attachment + BankTransactions myBanktransactions = accountingApi.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, null, null); + if ( myBanktransactions.getBankTransactions().size() > 0) { + UUID banktransactionID = myBanktransactions.getBankTransactions().get(0).getBankTransactionID(); + Attachments createdBanktransationAttachments = accountingApi.createBankTransactionAttachmentByFileName(xeroTenantId, banktransactionID, newFileName, bytes); + messages.add("Attachment to BankTransaction ID: " + banktransactionID + " attachment - ID: " + createdBanktransationAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (Exception e) { + System.out.println(e); + } + + try { + // CREATE BankTransfer attachment + BankTransfers myBankTransfer = accountingApi.getBankTransfers(xeroTenantId, ifModifiedSince, where, order); + if ( myBankTransfer.getBankTransfers().size() > 0) { + UUID bankTransferID = myBankTransfer.getBankTransfers().get(0).getBankTransferID(); + Attachments createdBankTransferAttachments = accountingApi.createBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, newFileName, bytes); + messages.add("Attachment to BankTransfer ID: " + bankTransferID + " attachment - ID: " + createdBankTransferAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (Exception e) { + System.out.println(e); + } + + try { + // CREATE Contacts attachment + where = "ContactStatus==\"ACTIVE\""; + Contacts contactsWhere = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + if ( contactsWhere.getContacts().size() > 0) { + UUID contactID = contactsWhere.getContacts().get(0).getContactID(); + Attachments createdContactAttachments = accountingApi.createContactAttachmentByFileName(xeroTenantId, contactID, newFileName, bytes); + messages.add("Attachment to Contact ID: " + contactID + " attachment - ID: " + createdContactAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (Exception e) { + System.out.println(e); + } + + try { + where = "Status==\"AUTHORISED\""; + // CREATE CreditNotes attachment + CreditNotes myCreditNotes = accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, null); + if ( myCreditNotes.getCreditNotes().size() > 0) { + UUID creditNoteID = myCreditNotes.getCreditNotes().get(0).getCreditNoteID(); + Attachments createdCreditNoteAttachments = accountingApi.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, newFileName, bytes); + messages.add("Attachment to Credit Notes ID: " + creditNoteID + " attachment - ID: " + createdCreditNoteAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (Exception e) { + System.out.println(e); + } + + try { + // CREATE invoice attachment + Invoices myInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + if ( myInvoices.getInvoices().size() > 0) { + UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); + Attachments createdInvoiceAttachments = accountingApi.createInvoiceAttachmentByFileName(xeroTenantId, invoiceID, newFileName, bytes); + messages.add("Attachment to Invoice ID: " + invoiceID + " attachment - ID: " + createdInvoiceAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (Exception e) { + System.out.println(e); + } + + try { + // CREATE ManualJournals attachment + where= null; + ManualJournals myManualJournals = accountingApi.getManualJournals(xeroTenantId, ifModifiedSince, where, order, null); + System.out.println(myManualJournals.getManualJournals().size()); + + if ( myManualJournals.getManualJournals().size() > 0) { + UUID manualJournalID = myManualJournals.getManualJournals().get(0).getManualJournalID(); + Attachments createdManualJournalAttachments = accountingApi.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, newFileName, bytes); + messages.add("Attachment to Manual Journal ID: " + manualJournalID + " attachment - ID: " + createdManualJournalAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (Exception e) { + System.out.println(e); + } + + try { + // CREATE Receipts attachment + Receipts myReceipts = accountingApi.getReceipts(xeroTenantId, ifModifiedSince, where, order, null); + if ( myReceipts.getReceipts().size() > 0) { + UUID receiptID = myReceipts.getReceipts().get(0).getReceiptID(); + Attachments createdReceiptsAttachments = accountingApi.createReceiptAttachmentByFileName(xeroTenantId, receiptID, newFileName, bytes); + messages.add("Attachment to Receipt ID: " + receiptID + " attachment - ID: " + createdReceiptsAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (Exception e) { + System.out.println(e); + } + + try { + // CREATE Repeating Invoices attachment + RepeatingInvoices myRepeatingInvoices = accountingApi.getRepeatingInvoices(xeroTenantId, where, order); + if ( myRepeatingInvoices.getRepeatingInvoices().size() > 0) { + UUID repeatingInvoiceID = myRepeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); + Attachments createdRepeatingInvoiceAttachments = accountingApi.createRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, newFileName, bytes); + messages.add("Attachment to Repeating Invoices ID: " + repeatingInvoiceID + " attachment - ID: " + createdRepeatingInvoiceAttachments.getAttachments().get(0).getAttachmentID()); + } + + } catch (Exception e) { + System.out.println(e); + } + + } else if (object.equals("BankTransfers")) { + /* BANK TRANSFER */ + try { + where = "Status==\"ACTIVE\"&&Type==\"BANK\""; + Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + where = null; + // Maker sure we have at least 2 banks + if(accountsWhere.getAccounts().size() > 1) { + // CREATE bank transfer + BankTransfer bankTransfer = new BankTransfer(); + bankTransfer.setFromBankAccount(accountsWhere.getAccounts().get(1)); + bankTransfer.setToBankAccount(accountsWhere.getAccounts().get(0)); + bankTransfer.setAmount("50.00"); + BankTransfers newBTs = new BankTransfers(); + newBTs.addBankTransfersItem(bankTransfer); + BankTransfers newBankTranfer = accountingApi.createBankTransfer(xeroTenantId, newBTs); + messages.add("Get a one Bank Transfer - amount : " + newBankTranfer.getBankTransfers().get(0).getAmount()); + + // GET all Bank Transfers + BankTransfers bankTranfers = accountingApi.getBankTransfers(xeroTenantId, ifModifiedSince, where, order); + messages.add("Get a all Bank Transfers - total : " + bankTranfers.getBankTransfers().size()); + UUID bankTransferId = bankTranfers.getBankTransfers().get(0).getBankTransferID(); + + // GET one Bank Transfer + BankTransfers oneBankTranfer = accountingApi.getBankTransfer(xeroTenantId, bankTransferId); + messages.add("Get a one Bank Transfer - amount : " + oneBankTranfer.getBankTransfers().get(0).getAmount()); + + // GET Bank Transfer History + HistoryRecords hr = accountingApi.getBankTransferHistory(xeroTenantId, bankTransferId); + messages.add("Get a one Bank Transfer History Record - details :" + hr.getHistoryRecords().get(0).getDetails()); + + // CREATE Bank Transfer History + // Error: "The document with the supplied id was not found for this endpoint. + /* + HistoryRecords historyRecords = new HistoryRecords(); + HistoryRecord historyRecord = new HistoryRecord(); + historyRecord.setDetails("This is a sample history note"); + historyRecords.addHistoryRecordsItem(historyRecord); + HistoryRecords newHr = accountingApi.createBankTransferHistoryRecord(bankTransferId, historyRecords); + messages.add("Get a one Bank Transfer History Record - details :" + newHr.getHistoryRecords().get(0).getDetails()); + */ + } + } catch (Exception e) { + System.out.println(e.toString()); + } + + + } else if (object.equals("BankTransactions")) { + /* BANK TRANSACTION */ + try { + where = "Status==\"ACTIVE\"&&Type==\"BANK\""; + Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId,ifModifiedSince, where, order); + + Account bankAcct = new Account(); + bankAcct.setCode(accountsWhere.getAccounts().get(0).getCode()); + + where = null; + Contacts contacts = accountingApi.getContacts(xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + // Maker sure we have at least 1 bank + if(accountsWhere.getAccounts().size() > 0) { + // Create Bank Transaction + List lineItems = new ArrayList<>(); + LineItem li = new LineItem(); + li.setAccountCode("400"); + li.setDescription("Foobar"); + li.setQuantity(1.0); + li.setUnitAmount(20.0); + lineItems.add(li); + BankTransaction bt = new BankTransaction(); + bt.setBankAccount(bankAcct); + bt.setContact(useContact); + bt.setLineitems(lineItems); + bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.SPEND); + BankTransactions bts = new BankTransactions(); + bts.addBankTransactionsItem(bt); + BankTransactions newBankTransaction = accountingApi.createBankTransaction(xeroTenantId, bts, summarizeErrors); + messages.add("Create new BankTransaction : amount:" + newBankTransaction.getBankTransactions().get(0).getTotal()); + + // GET all Bank Transaction + BankTransactions bankTransactions = accountingApi.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, null, null); + messages.add("Get a all Bank Transactions - total : " + bankTransactions.getBankTransactions().size()); + + // GET one Bank Transaction + BankTransactions oneBankTransaction = accountingApi.getBankTransaction(xeroTenantId, bankTransactions.getBankTransactions().get(0).getBankTransactionID()); + messages.add("Get a one Bank Transaction : amount:" + oneBankTransaction.getBankTransactions().get(0).getTotal()); + + // UDPATE Bank Transaction + newBankTransaction.getBankTransactions().get(0).setSubTotal(null); + newBankTransaction.getBankTransactions().get(0).setTotal(null); + newBankTransaction.getBankTransactions().get(0).setReference("You just updated"); + BankTransactions updateBankTransaction = accountingApi.updateBankTransaction(xeroTenantId, newBankTransaction.getBankTransactions().get(0).getBankTransactionID(),newBankTransaction); + messages.add("Update new BankTransaction : reference:" + updateBankTransaction.getBankTransactions().get(0).getReference()); + + // DELETE Bank Transaction + newBankTransaction.getBankTransactions().get(0).setStatus(com.xero.models.accounting.BankTransaction.StatusEnum.DELETED); + BankTransactions deletedBankTransaction = accountingApi.updateBankTransaction(xeroTenantId, newBankTransaction.getBankTransactions().get(0).getBankTransactionID(),newBankTransaction); + messages.add("Deleted new Bank Transaction : Status:" + deletedBankTransaction.getBankTransactions().get(0).getStatus()); + + // GET Bank Transaction History + HistoryRecords hr = accountingApi.getBankTransactionsHistory(xeroTenantId, oneBankTransaction.getBankTransactions().get(0).getBankTransactionID()); + messages.add("Get a one Bank Transaction History Record - details :" + hr.getHistoryRecords().get(0).getDetails()); + + // CREATE Bank Transaction History + // Error: "The document with the supplied id was not found for this end point. + /* + HistoryRecords historyRecords = new HistoryRecords(); + HistoryRecord historyRecord = new HistoryRecord(); + historyRecord.setDetails("This is a sample history note"); + historyRecords.addHistoryRecordsItem(historyRecord); + HistoryRecords newHr = accountingApi.createBankTransactionHistoryRecord(oneBankTransaction.getBankTransactions().get(0).getBankTransactionID(), historyRecords); + messages.add("Create a one Bank Transaction History Record - details :" + newHr.getHistoryRecords().get(0).getDetails()); + */ + } + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("BatchPayments")) { + //BATCH PAYMENTS + try { + // CREATE payment + where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; + Invoices allInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoice inv = new Invoice(); + inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); + Invoice inv2 = new Invoice(); + inv2.setInvoiceID(allInvoices.getInvoices().get(1).getInvoiceID()); + Invoice inv3 = new Invoice(); + inv3.setInvoiceID(allInvoices.getInvoices().get(3).getInvoiceID()); + where = null; + + where = "EnablePaymentsToAccount==true"; + Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Account paymentAccount = new Account(); + paymentAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); + where = null; + + BatchPayments createBatchPayments = new BatchPayments(); + BatchPayment createBatchPayment = new BatchPayment(); + createBatchPayment.setAccount(paymentAccount); + createBatchPayment.setAmount(3.0); + LocalDate currDate = LocalDate.now(); + createBatchPayment.setDate(currDate); + createBatchPayment.setReference("Foobar" + loadRandomNum()); + + Payment payment01 = new Payment(); + payment01.setAccount(paymentAccount); + payment01.setInvoice(inv); + payment01.setAmount(1.0); + payment01.setDate(currDate); + + Payment payment02 = new Payment(); + payment02.setAccount(paymentAccount); + payment02.setInvoice(inv2); + payment02.setAmount(1.0); + payment02.setDate(currDate); + + Payment payment03 = new Payment(); + payment03.setAccount(paymentAccount); + payment03.setInvoice(inv3); + payment03.setAmount(1.0); + payment03.setDate(currDate); + + createBatchPayment.addPaymentsItem(payment01); + createBatchPayment.addPaymentsItem(payment02); + createBatchPayment.addPaymentsItem(payment03); + + createBatchPayments.addBatchPaymentsItem(createBatchPayment); + + BatchPayments newBatchPayments = accountingApi.createBatchPayment(xeroTenantId, createBatchPayments); + messages.add("Create BatchPayments - ID : " + newBatchPayments.getBatchPayments().get(0).getTotalAmount()); + + // GET all Payments + BatchPayments allBatchPayments = accountingApi.getBatchPayments(xeroTenantId, ifModifiedSince, where, order); + messages.add("Get BatchPayments - Total : " + allBatchPayments.getBatchPayments().size()); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("BrandingThemes")) { + /* BRANDING THEME */ + try { + // GET all BrandingTheme + BrandingThemes bt = accountingApi.getBrandingThemes(xeroTenantId); + messages.add("Get a All Branding Themes - total : " + bt.getBrandingThemes().size()); + + // GET one BrandingTheme + UUID btID = bt.getBrandingThemes().get(0).getBrandingThemeID(); + BrandingThemes oneBt = accountingApi.getBrandingTheme(xeroTenantId, btID); + messages.add("Get a one Branding Themes - name : " + oneBt.getBrandingThemes().get(0).getName()); +/* + // Create PaymentService for a Branding Theme + PaymentServices paymentServices = accountingApi.getPaymentServices(xeroTenantId); + UUID paymentServiceID = paymentServices.getPaymentServices().get(0).getPaymentServiceID(); + PaymentService btPaymentService = new PaymentService(); + btPaymentService.setPaymentServiceType("Custom"); + btPaymentService.setPaymentServiceID(paymentServiceID); + PaymentServices createdPaymentService = accountingApi.createBrandingThemePaymentServices(xeroTenantId,btID, btPaymentService); + messages.add("Created payment services for Branding Themes - name : " + createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); +*/ + // GET Payment Services for a single Branding Theme + PaymentServices paymentServicesForBrandingTheme = accountingApi.getBrandingThemePaymentServices(xeroTenantId, btID); + messages.add("Get payment services for Branding Themes - name : " + paymentServicesForBrandingTheme.getPaymentServices().get(0).getPaymentServiceName()); + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("Contacts")) { + /* CONTACTS */ + try { + // CREATE contact + Contact contact = new Contact(); + contact.setName("Foo" + loadRandomNum()); + contact.setEmailAddress("sid" + loadRandomNum() + "@blah.com"); + List phones = new ArrayList(); + Phone phone = new Phone(); + phone.setPhoneType(PhoneTypeEnum.MOBILE); + phone.setPhoneNumber("555-1212"); + phone.setPhoneAreaCode("415"); + phones.add(phone); + contact.setPhones(phones); + Contacts newContact = accountingApi.createContact(xeroTenantId, contact); + messages.add("Create new Contact - Name : " + newContact.getContacts().get(0).getName()); + + // UPDATE contact + newContact.getContacts().get(0).setName("Bar" + loadRandomNum()); + UUID contactID = newContact.getContacts().get(0).getContactID(); + Contacts updatedContact = accountingApi.updateContact(xeroTenantId, contactID, newContact); + messages.add("Update new Contact - Name : " + updatedContact.getContacts().get(0).getName()); + + // GET all contact + Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + messages.add("Get a All Contacts - Total : " + contacts.getContacts().size()); + + // GET one contact + UUID oneContactID = contacts.getContacts().get(0).getContactID(); + Contacts oneContact = accountingApi.getContact(xeroTenantId, oneContactID); + messages.add("Get a One Contact - Name : " + oneContact.getContacts().get(0).getName()); + + // GET contact cisSettings + where = "Name==\"sidney\""; + Contacts cisContact = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + if (cisContact.getContacts().size() > 0) { + CISSettings cisSettings = accountingApi.getContactCISSettings(xeroTenantId, cisContact.getContacts().get(0).getContactID()); + messages.add("Get a Contact cisSettings - Enabled? : " + cisSettings.getCiSSettings().get(0).getCiSEnabled()); + } + where = null; + + // GET active contacts + where = "ContactStatus==\"ACTIVE\""; + Contacts contactsWhere = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + messages.add("Get a all ACTIVE Contacts - Total : " + contactsWhere.getContacts().size()); + where = null; + + // Get Contact History + HistoryRecords contactHistory = accountingApi.getContactHistory(xeroTenantId, contactID); + messages.add("Contact History - count : " + contactHistory.getHistoryRecords().size() ); + + // Create Contact History + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + + HistoryRecords newInvoiceHistory = accountingApi.createContactHistory(xeroTenantId, contactID,newHistoryRecords); + messages.add("Contact History - note added to : " + newInvoiceHistory.getHistoryRecords().get(0).getDetails()); + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("ContactGroups")) { + + /* CONTACT GROUP */ + try { + // Create contact group + ContactGroups newCGs = new ContactGroups(); + ContactGroup cg = new ContactGroup(); + cg.setName("NewGroup" + loadRandomNum()); + newCGs.addContactGroupsItem(cg); + ContactGroups newContactGroup = accountingApi.createContactGroup(xeroTenantId, newCGs); + messages.add("Create a ContactGroup - Name : " + newContactGroup.getContactGroups().get(0).getName()); + + // UPDATE Contact group + newCGs.getContactGroups().get(0).setName("Old Group" + loadRandomNum()); + UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); + ContactGroups updateContactGroup = accountingApi.updateContactGroup(xeroTenantId, newContactGroupID, newCGs); + messages.add("Update a ContactGroup - Name : " + updateContactGroup.getContactGroups().get(0).getName()); + + // GET all contact groups + ContactGroups contactGroups = accountingApi.getContactGroups(xeroTenantId, where, order); + messages.add("Get all ContactGroups - Total : " + contactGroups.getContactGroups().size()); + + // GET one contact groups + UUID contactGroupId = contactGroups.getContactGroups().get(0).getContactGroupID(); + ContactGroups oneCg = accountingApi.getContactGroup(xeroTenantId, contactGroupId); + messages.add("Get one ContactGroups - Name : " + oneCg.getContactGroups().get(0).getName()); + + // DELETE contact Group + newCGs.getContactGroups().get(0).setStatus(com.xero.models.accounting.ContactGroup.StatusEnum.DELETED); + UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); + ContactGroups deletedContactGroup = accountingApi.updateContactGroup(xeroTenantId, contactGroupID, contactGroups); + messages.add("Delete a ContactGroup - Name : " + deletedContactGroup.getContactGroups().get(0).getName()); + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("ContactGroupContacts")) { + /* CONTACT GROUP CONTACTS */ + try { + // Create new Contact Group + ContactGroups newCGs = new ContactGroups(); + ContactGroup cg = new ContactGroup(); + cg.setName("NewGroup" + loadRandomNum()); + newCGs.addContactGroupsItem(cg); + ContactGroups newContactGroup = accountingApi.createContactGroup(xeroTenantId, newCGs); + + Contacts allContacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + + // Create Contacts in Group + Contacts contactList = new Contacts(); + contactList.addContactsItem(allContacts.getContacts().get(0)); + contactList.addContactsItem(allContacts.getContacts().get(1)); + UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); + Contacts addContacts = accountingApi.createContactGroupContacts(xeroTenantId, contactGroupID, contactList); + messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts.getContacts().size()); + + // DELETE all Contacts in Group + accountingApi.deleteContactGroupContacts(xeroTenantId, newContactGroup.getContactGroups().get(0).getContactGroupID()); + messages.add("Delete All Contacts to Contact Group - no content in response "); + + ContactGroups oneCg = accountingApi.getContactGroup(xeroTenantId, newContactGroup.getContactGroups().get(0).getContactGroupID()); + messages.add("Get ContactGroups - Total Contacts : " + oneCg.getContactGroups().get(0).getContacts().size()); + + // DELETE Single Contact + Contacts contactList2 = new Contacts(); + contactList2.addContactsItem(allContacts.getContacts().get(3)); + contactList2.addContactsItem(allContacts.getContacts().get(4)); + + UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); + Contacts addContacts2 = accountingApi.createContactGroupContacts(xeroTenantId, newContactGroupID, contactList2); + messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts2.getContacts().size()); + + // DELETE Single CONACTS + accountingApi.deleteContactGroupContact(xeroTenantId, newContactGroup.getContactGroups().get(0).getContactGroupID(),allContacts.getContacts().get(3).getContactID()); + messages.add("Delete 1 contact from Contact Group - no content in response"); + + ContactGroups oneCg2 = accountingApi.getContactGroup(xeroTenantId, newContactGroup.getContactGroups().get(0).getContactGroupID()); + messages.add("Get ContactGroups - Total Contacts : " + oneCg2.getContactGroups().get(0).getContacts().size()); + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("CreditNotesPDF")) { + // GET CreditNote As a PDF + CreditNotes creditNotes = accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, null); + UUID creditNoteId = creditNotes.getCreditNotes().get(0).getCreditNoteID(); + ByteArrayInputStream CreditNoteInput = accountingApi.getCreditNoteAsPdf(xeroTenantId, creditNoteId, "application/pdf"); + String CreditNoteFileName = "CreditNoteAsPDF.pdf"; + + String CreditNoteSaveFilePath = saveFile(CreditNoteInput,CreditNoteFileName); + messages.add("Get CreditNote attachment - save it here: " + CreditNoteSaveFilePath); + + } else if (object.equals("CreditNotes")) { + // CREDIT NOTE + try { + Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + + // Create Credit Note + List lineItems = new ArrayList<>(); + LineItem li = new LineItem(); + li.setAccountCode("400"); + li.setDescription("Foobar"); + li.setQuantity(2.0); + li.setUnitAmount(20.0); + lineItems.add(li); + + CreditNotes newCNs = new CreditNotes(); + CreditNote cn = new CreditNote(); + cn.setContact(contacts.getContacts().get(0)); + cn.setLineItems(lineItems); + cn.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT); + newCNs.addCreditNotesItem(cn); + CreditNotes newCreditNote = accountingApi.createCreditNote(xeroTenantId, newCNs, summarizeErrors); + messages.add("Create a CreditNote - Amount : " + newCreditNote.getCreditNotes().get(0).getTotal()); + UUID newCreditNoteId = newCreditNote.getCreditNotes().get(0).getCreditNoteID(); + + // GET all Credit Note + CreditNotes creditNotes = accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, null); + messages.add("Get all CreditNotes - Total : " + creditNotes.getCreditNotes().size()); + + // GET One Credit Note + UUID creditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); + CreditNotes oneCreditNote = accountingApi.getCreditNote(xeroTenantId, creditNoteID); + messages.add("Get a CreditNote - Amount : " + oneCreditNote.getCreditNotes().get(0).getTotal()); + + // UPDATE Credit Note + newCNs.getCreditNotes().get(0).setStatus(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED); + CreditNotes updatedCreditNote = accountingApi.updateCreditNote(xeroTenantId, newCreditNoteId, newCNs); + messages.add("Update a CreditNote - Ref : " + updatedCreditNote.getCreditNotes().get(0).getReference()); + + // Allocate Credit Note + Allocations allocations = new Allocations(); + Allocation allocation = new Allocation(); + + where = "Status==\"AUTHORISED\"&&Type==\"ACCPAY\""; + Invoices allInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoice inv = new Invoice(); + inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); + allocation.setInvoice(inv); + allocation.setAmount(1.0); + LocalDate currDate = LocalDate.now(); + allocation.setDate(currDate); + allocations.addAllocationsItem(allocation); + where = null; + + Allocations allocatedCreditNote = accountingApi.createCreditNoteAllocation(xeroTenantId, newCreditNoteId,allocations); + messages.add("Update CreditNote Allocation - Amount : " + allocatedCreditNote.getAllocations().get(0).getAmount()); + + // Get Invoice History + HistoryRecords history = accountingApi.getCreditNoteHistory(xeroTenantId, creditNoteID); + messages.add("History - count : " + history.getHistoryRecords().size() ); + + // Create Invoice History + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + + HistoryRecords newHistory = accountingApi.createCreditNoteHistory(xeroTenantId, creditNoteID, newHistoryRecords); + messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("Currencies")) { + + /* CURRENCY */ + // JSON - incomplete + try { + //Get All + Currencies currencies = accountingApi.getCurrencies(xeroTenantId, where, order); + messages.add("Get all Currencies - Total : " + currencies.getCurrencies().size()); + + // Create New +// Error: 400 + /* + Currency curr = new Currency(); + curr.setCode(CurrencyCode.SGD); + Currencies currs = new Currencies(); + currs.addCurrenciesItem(curr); + Currencies newCurrency = accountingApi.createCurrency(xeroTenantId, currs); + messages.add("New Currencies - Code : " + newCurrency.getCurrencies().get(0).getCode()); + */ + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("Employees")) { + // EMPLOYEE + try { + + // Create + Employee employee = new Employee(); + employee.setFirstName("Sam"); + employee.setLastName("Jackson" + loadRandomNum()); + ExternalLink extLink = new ExternalLink(); + extLink.setUrl("http://twitter.com/#!/search/Homer+Simpson"); + employee.setExternalLink(extLink); + Employees emps = new Employees(); + emps.addEmployeesItem(employee); + + Employees newEmployee = accountingApi.createEmployee(xeroTenantId, emps); + messages.add("Create an Employee - Last Name : " + newEmployee.getEmployees().get(0).getLastName()); + + //Get All + Employees employees = accountingApi.getEmployees(xeroTenantId, ifModifiedSince, where, order); + messages.add("Get all Employees - Total : " + employees.getEmployees().size()); + + UUID newEmpId = employees.getEmployees().get(0).getEmployeeID(); + + // Get One + Employees oneEmployee = accountingApi.getEmployee(xeroTenantId, newEmpId); + messages.add("Get one Employees - Name : " + oneEmployee.getEmployees().get(0).getFirstName()); + +// 404 ERROR + // Update No EmployeeID as part of URI - first/last name used as unique key + ExternalLink extLink2 = new ExternalLink(); + extLink2.setUrl("http://twitter.com/#!/search/Bart+Simpson"); + newEmployee.getEmployees().get(0).setExternalLink(extLink2); + + Employees updateEmployee = accountingApi.updateEmployee(xeroTenantId, newEmpId, newEmployee); + messages.add("Update an Employee - Last Name : " + updateEmployee.getEmployees().get(0).getLastName()); + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("ExpenseClaims")) { + // EXPENSE CLAIM + try { + //Create + //where = "IsSubscriber==true"; + Users users = accountingApi.getUsers(xeroTenantId, ifModifiedSince, where, order); + where = null; + + where = "ShowInExpenseClaims==true&&Status==\"ACTIVE\""; + Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + where = null; + + if (users.getUsers().size() > 0) { + User user = new User(); + user.setUserID(users.getUsers().get(0).getUserID()); + + Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + // CREATE NEW RECEIPT + Receipts receipts = new Receipts(); + Receipt receipt = new Receipt(); + + LineItem li = new LineItem(); + li.setAccountCode(accounts.getAccounts().get(0).getCode()); + li.setDescription("Foobar"); + li.setQuantity(2.0); + li.setUnitAmount(20.00); + li.setLineAmount(40.00); + li.setTaxType("NONE"); + + receipt.addLineitemsItem(li); + receipt.setUser(user); + receipt.lineAmountTypes(LineAmountTypes.NOTAX); + receipt.contact(useContact); + receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); + receipts.addReceiptsItem(receipt); + Receipts newReceipts = accountingApi.createReceipt(xeroTenantId, receipts); + + // CREATE EXPENSE CLAIM + ExpenseClaims createExpenseClaims = new ExpenseClaims(); + ExpenseClaim expenseClaim = new ExpenseClaim(); + expenseClaim.setUser(user); + + Receipts myReceipts = new Receipts(); + Receipt myReceipt = new Receipt(); + myReceipt.setReceiptID(newReceipts.getReceipts().get(0).getReceiptID()); + myReceipts.addReceiptsItem(myReceipt); + expenseClaim.setReceipts(myReceipts.getReceipts()); + expenseClaim.setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED); + createExpenseClaims.addExpenseClaimsItem(expenseClaim); + ExpenseClaims newExpenseClaims = accountingApi.createExpenseClaim(xeroTenantId, createExpenseClaims, summarizeErrors); + messages.add("Create new Expense Claim - Status : " + newExpenseClaims.getExpenseClaims().get(0).getStatus()); + + // UPDATE EXPENSE CLAIM + createExpenseClaims.getExpenseClaims().get(0).setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED); + UUID expenseClaimID = newExpenseClaims.getExpenseClaims().get(0).getExpenseClaimID(); + ExpenseClaims updateExpenseClaims = accountingApi.updateExpenseClaim(xeroTenantId, expenseClaimID, createExpenseClaims); + messages.add("Update new Expense Claim - Status : " + updateExpenseClaims.getExpenseClaims().get(0).getStatus()); + + //Get All Expense Claims + ExpenseClaims expenseClaims = accountingApi.getExpenseClaims(xeroTenantId, ifModifiedSince, where, order); + messages.add("Get all Expense Claim - Total : " + expenseClaims.getExpenseClaims().size()); + + // Get One Expense Claim + ExpenseClaims oneExpenseClaim = accountingApi.getExpenseClaim(xeroTenantId, expenseClaims.getExpenseClaims().get(0).getExpenseClaimID()); + messages.add("Get one Expense Claim - Total : " + oneExpenseClaim.getExpenseClaims().get(0).getStatus()); + + // VOID EXPENSE CLAIM + createExpenseClaims.getExpenseClaims().get(0).setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.VOIDED); + ExpenseClaims voidExpenseClaims = accountingApi.updateExpenseClaim(xeroTenantId, expenseClaimID, createExpenseClaims); + messages.add("Void new Expense Claim - Status : " + voidExpenseClaims.getExpenseClaims().get(0).getStatus()); + + // Get Invoice History + HistoryRecords history = accountingApi.getExpenseClaimHistory(xeroTenantId, expenseClaimID); + messages.add("History - count : " + history.getHistoryRecords().size() ); + + // Create Invoice History + // Error: "The document with the supplied id was not found for this endpoint. + /* + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords newHistory = accountingApi.createExpenseClaimHistory(expenseClaimID, newHistoryRecords); + messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); + */ + } else { + System.out.println("No User Found"); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("Invoices")) { + // INVOICE + + // GET Invoice As a PDF + Invoices myInvoicesForPDF = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + UUID invoiceIDForPDF = myInvoicesForPDF.getInvoices().get(0).getInvoiceID(); + ByteArrayInputStream InvoiceNoteInput = accountingApi.getInvoiceAsPdf(xeroTenantId, invoiceIDForPDF, "application/pdf"); + String InvoiceFileName = "InvoiceAsPDF.pdf"; + String InvoiceSaveFilePath = saveFile(InvoiceNoteInput,InvoiceFileName); + messages.add("Get Invoice attachment - save it here: " + InvoiceSaveFilePath); + + // Create Invoice + where = "Type==\"REVENUE\""; + Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + String accountCodeForInvoice = accounts.getAccounts().get(0).getCode(); + where = null; + + Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + + UUID contactIDForInvoice = contacts.getContacts().get(0).getContactID(); + + for(int i=0; i > contacts.getContacts().size(); i++) { + String email = contacts.getContacts().get(i).getEmailAddress().toString(); + + if ( email != null && !email.isEmpty()) { + contactIDForInvoice = contacts.getContacts().get(i).getContactID(); + break; + } + } + + contactIDForInvoice = UUID.fromString("9f857fe0-4a14-408b-b526-4f742db3b079"); + Contact useContact = new Contact(); + useContact.setContactID(contactIDForInvoice); + + Invoices newInvoices = new Invoices(); + Invoice myInvoice = new Invoice(); + + LineItem li = new LineItem(); + li.setAccountCode(accountCodeForInvoice); + li.setDescription("Acme Tires"); + li.setQuantity(2.0); + li.setUnitAmount(20.00); + li.setLineAmount(40.00); + li.setTaxType("NONE"); + + myInvoice.addLineItemsItem(li); + myInvoice.setContact(useContact); + LocalDate dueDate = LocalDate.of(2018,Month.DECEMBER,10); + myInvoice.setDueDate(dueDate); + LocalDate todayDate = LocalDate.now(); + myInvoice.setDate(todayDate); + myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); + myInvoice.setReference("One Fish, Two Fish"); + myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); + newInvoices.addInvoicesItem(myInvoice); + + Invoices newInvoice = accountingApi.createInvoice(xeroTenantId, newInvoices, summarizeErrors); + messages.add("Create invoice - Reference : " + newInvoice.getInvoices().get(0).getReference()); + UUID newInvoiceID = newInvoice.getInvoices().get(0).getInvoiceID(); + Invoices updateInvoices = new Invoices(); + Invoice updateInvoice = new Invoice(); + updateInvoice.setInvoiceID(newInvoiceID); + updateInvoice.setReference("Red Fish, Blue Fish"); + updateInvoices.addInvoicesItem(updateInvoice); + + Invoices updatedInvoice = accountingApi.updateInvoice(xeroTenantId, newInvoiceID,updateInvoices); + messages.add("Update invoice - Reference : " + updatedInvoice.getInvoices().get(0).getReference()); + + //Get All + Invoices invoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + messages.add("Get all invoices - Total : " + invoices.getInvoices().size()); + + //Get Invoice If-Modified-Since + OffsetDateTime invModified = OffsetDateTime.of(LocalDateTime.of(2018, 12, 06, 15, 00), ZoneOffset.UTC); + Invoices invoicesSince = accountingApi.getInvoices(xeroTenantId, invModified, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + messages.add("Get all invoices - Since Modfied Date - Total : " + invoicesSince.getInvoices().size()); + + // Get One + Invoices oneInvoice = accountingApi.getInvoice(xeroTenantId, invoices.getInvoices().get(0).getInvoiceID()); + messages.add("Get one invoice - total : " + oneInvoice.getInvoices().get(0).getTotal()); + LocalDate myDate = oneInvoice.getInvoices().get(0).getDate(); + OffsetDateTime myUTC = oneInvoice.getInvoices().get(0).getUpdatedDateUTC(); + + // Get Online Invoice + OnlineInvoices onlineInvoice = accountingApi.getOnlineInvoice(xeroTenantId, newInvoiceID); + messages.add("Get Online invoice - URL : " + onlineInvoice.getOnlineInvoices().get(0).getOnlineInvoiceUrl()); + + // Email Invoice + RequestEmpty empty = new RequestEmpty(); + accountingApi.emailInvoice(xeroTenantId, newInvoiceID,empty); + messages.add("Email invoice - no content in response"); + + // Get Invoice History + HistoryRecords history = accountingApi.getInvoiceHistory(xeroTenantId, newInvoiceID); + messages.add("History - count : " + history.getHistoryRecords().size() ); + + // Create Invoice History + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords newHistory = accountingApi.createInvoiceHistory(xeroTenantId, newInvoiceID,newHistoryRecords); + messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); + + // CREATE invoice attachment + statuses = "AUTHORISED"; + Invoices myInvoices = accountingApi.getInvoices(xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); + + File requestBodyFile = new File("/Users/sid.maestre/eclipse-workspace/xero-sdk-oauth2-dev-01/resources/youngsid.jpg"); + String newFileName = requestBodyFile.getName(); + + Attachments createdAttachments = accountingApi.createInvoiceAttachmentByFileName(xeroTenantId,invoiceID, newFileName, requestBodyFile); + messages.add("Attachment to Invoice complete - ID: " + createdAttachments.getAttachments().get(0).getAttachmentID()); + + // GET Invoice Attachment + System.out.println(invoiceID); + Attachments attachments = accountingApi.getInvoiceAttachments(xeroTenantId,invoiceID); + System.out.println(attachments.getAttachments().get(0).getFileName()); + UUID attachementId = attachments.getAttachments().get(0).getAttachmentID(); + String contentType = attachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream InvoiceAttachmentInput = accountingApi.getInvoiceAttachmentById(xeroTenantId,invoiceID,attachementId, contentType); + + String InvoiceAttachmentFileName = attachments.getAttachments().get(0).getFileName(); + String InvoiceAttachmentSaveFilePath = saveFile(InvoiceAttachmentInput,InvoiceAttachmentFileName); + messages.add("Get Invoice attachment - save it here: " + InvoiceAttachmentSaveFilePath); + + } else if (object.equals("InvoiceReminders")) { + // INVOICE REMINDER + try { + InvoiceReminders invReminders = accountingApi.getInvoiceReminders(xeroTenantId); + messages.add("Get a Invoice Reminder - Is Enabled: " + invReminders.getInvoiceReminders().get(0).getEnabled() ); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Items")) { + // ITEM + try { + // Create Items + Items myItems = new Items(); + Item myItem = new Item(); + myItem.setCode("abc" + loadRandomNum()); + myItem.setDescription("foobar"); + myItem.setName("Hello"+loadRandomNum()); + myItems.addItemsItem(myItem); + Items newItems = accountingApi.createItem(xeroTenantId, myItems); + messages.add("Create new item - Description : " + newItems.getItems().get(0).getDescription()); + UUID newItemId = newItems.getItems().get(0).getItemID(); + + // Update Item + newItems.getItems().get(0).setDescription("Barfoo"); + Items updateItem = accountingApi.updateItem(xeroTenantId, newItemId, newItems); + messages.add("Update item - Description : " + updateItem.getItems().get(0).getDescription()); + + //Get All Items + Items items = accountingApi.getItems(xeroTenantId, ifModifiedSince, where, order, null); + messages.add("Get all items - Total : " + items.getItems().size()); + + // Get One Item + UUID itemId = items.getItems().get(0).getItemID(); + Items oneItem = accountingApi.getItem(xeroTenantId, itemId); + messages.add("Get one item - Description : " + oneItem.getItems().get(0).getDescription()); + + // Get Invoice History + HistoryRecords history = accountingApi.getItemHistory(xeroTenantId, itemId); + messages.add("History - count : " + history.getHistoryRecords().size() ); + + // Create Invoice History + // Error: "The document with the supplied id was not found for this endpoint. + /* + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords createdHistory = accountingApi.createItemHistory(itemId,newHistoryRecords); + messages.add("History - note added to : " + createdHistory.getHistoryRecords().get(0).getDetails()); + */ + + //Delete + accountingApi.deleteItem(xeroTenantId, newItemId); + messages.add("Delete one item - no content in response"); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("Journals")) { + // JOURNAL + try { + + boolean paymentsOnly = false; + // GET all Journals + Journals journals = accountingApi.getJournals(xeroTenantId, ifModifiedSince, null, paymentsOnly); + messages.add("Get Journals - total : " + journals.getJournals().size()); + + // GET Journal with offset + Journals journalsOffset = accountingApi.getJournals(xeroTenantId, ifModifiedSince, null, paymentsOnly); + messages.add("Get Journals offset - total : " + journalsOffset.getJournals().size()); +// 404 ERROR +/* + // GET one Journal + UUID journalId = journals.getJournals().get(0).getJournalID(); + Journals oneJournal = accountingApi.getJournal(xeroTenantId, journalId); + messages.add("Get one Journal - number : " + oneJournal.getJournals().get(0).getJournalNumber()); +*/ + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("LinkedTransactions")) { + + /* LINKED TRANSACTION */ + try { + // Create Linked Transaction + where = "Type==\"EXPENSE\""; + Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + where = null; + + Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + Invoices newInvoices = new Invoices(); + Invoice myInvoice = new Invoice(); + + LineItem li = new LineItem(); + li.setAccountCode(accounts.getAccounts().get(0).getCode()); + li.setDescription("Acme Tires"); + li.setQuantity(2.0); + li.setUnitAmount(20.00); + li.setLineAmount(40.00); + li.setTaxType("NONE"); + + myInvoice.addLineItemsItem(li); + myInvoice.setContact(useContact); + LocalDate dueDate = LocalDate.of(2018,Month.OCTOBER,10); + myInvoice.setDueDate(dueDate); + LocalDate todayDate = LocalDate.now(); + myInvoice.setDate(todayDate); + myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCPAY); + myInvoice.setReference("One Fish, Two Fish"); + myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); + newInvoices.addInvoicesItem(myInvoice); + + Invoices newInvoice = accountingApi.createInvoice(xeroTenantId, newInvoices, summarizeErrors); + + UUID sourceTransactionID1 = newInvoice.getInvoices().get(0).getInvoiceID(); + UUID sourceLineItemID1 = newInvoice.getInvoices().get(0).getLineItems().get(0).getLineItemID(); + LinkedTransactions newLinkedTransactions = new LinkedTransactions(); + LinkedTransaction newLinkedTransaction = new LinkedTransaction(); + newLinkedTransaction.setSourceTransactionID(sourceTransactionID1); + newLinkedTransaction.setSourceLineItemID(sourceLineItemID1); + newLinkedTransactions.addLinkedTransactionsItem(newLinkedTransaction); + + LinkedTransactions createdLinkedTransaction = accountingApi.createLinkedTransaction(xeroTenantId, newLinkedTransactions); + messages.add("Create LinkedTransaction - Status : " + createdLinkedTransaction.getLinkedTransactions().get(0).getStatus()); + + // Created Linked Transaction 2 + Contact contact = new Contact(); + contact.setName("Foo" + loadRandomNum()); + contact.setEmailAddress("sid" + loadRandomNum() + "@blah.com"); + Contacts newContact = accountingApi.createContact(xeroTenantId, contact); + UUID newContactID = newContact.getContacts().get(0).getContactID(); + + Invoices newInvoice2 = accountingApi.createInvoice(xeroTenantId, newInvoices, summarizeErrors); + + UUID sourceTransactionID2 = newInvoice2.getInvoices().get(0).getInvoiceID(); + UUID sourceLineItemID2 = newInvoice2.getInvoices().get(0).getLineItems().get(0).getLineItemID(); + LinkedTransactions newLinkedTransactions2 = new LinkedTransactions(); + LinkedTransaction newLinkedTransaction2 = new LinkedTransaction(); + newLinkedTransaction2.setSourceTransactionID(sourceTransactionID2); + newLinkedTransaction2.setSourceLineItemID(sourceLineItemID2); + newLinkedTransaction2.setContactID(newContactID); + newLinkedTransactions2.addLinkedTransactionsItem(newLinkedTransaction2); + + LinkedTransactions createdLinkedTransaction2 = accountingApi.createLinkedTransaction(xeroTenantId, newLinkedTransactions2); + messages.add("Create LinkedTransaction 2 - Status : " + createdLinkedTransaction2.getLinkedTransactions().get(0).getStatus()); + + // Created Linked Transaction 3 + Invoices newInvoicesAccRec = new Invoices(); + Invoice myInvoiceAccRec = new Invoice(); + + myInvoiceAccRec.addLineItemsItem(li); + myInvoiceAccRec.setContact(useContact); + + myInvoiceAccRec.setDueDate(dueDate); + myInvoiceAccRec.setDate(todayDate); + + myInvoiceAccRec.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); + myInvoiceAccRec.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); + newInvoicesAccRec.addInvoicesItem(myInvoiceAccRec); + + Invoices newInvoiceAccRec = accountingApi.createInvoice(xeroTenantId, newInvoicesAccRec, summarizeErrors); + UUID sourceTransactionID4 = newInvoiceAccRec.getInvoices().get(0).getInvoiceID(); + UUID sourceLineItemID4 = newInvoiceAccRec.getInvoices().get(0).getLineItems().get(0).getLineItemID(); + + Invoices newInvoice3 = accountingApi.createInvoice(xeroTenantId, newInvoices, summarizeErrors); + + UUID sourceTransactionID3 = newInvoice3.getInvoices().get(0).getInvoiceID(); + UUID sourceLineItemID3 = newInvoice3.getInvoices().get(0).getLineItems().get(0).getLineItemID(); + LinkedTransactions newLinkedTransactions3 = new LinkedTransactions(); + LinkedTransaction newLinkedTransaction3 = new LinkedTransaction(); + newLinkedTransaction3.setSourceTransactionID(sourceTransactionID3); + newLinkedTransaction3.setSourceLineItemID(sourceLineItemID3); + newLinkedTransaction3.setContactID(useContact.getContactID()); + newLinkedTransaction3.setTargetTransactionID(sourceTransactionID4); + newLinkedTransaction3.setTargetLineItemID(sourceLineItemID4); + newLinkedTransactions3.addLinkedTransactionsItem(newLinkedTransaction3); + + LinkedTransactions createdLinkedTransaction3 = accountingApi.createLinkedTransaction(xeroTenantId, newLinkedTransactions3); + messages.add("Create LinkedTransaction 3 - Status : " + createdLinkedTransaction3.getLinkedTransactions().get(0).getStatus()); + + // GET all Link Transactions + + int page = 1; + String linkedTransactionID = null; + String sourceTransactionID = null; + String targetTransactionID = null; + String status = null; + String contactID = null; + LinkedTransactions linkTransactions = accountingApi.getLinkedTransactions(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); + messages.add("Get Link Transactions - total : " + linkTransactions.getLinkedTransactions().size()); + + // GET all Link Transactions + UUID linkedTransactionID2 = linkTransactions.getLinkedTransactions().get(0).getLinkedTransactionID(); + LinkedTransactions oneLinkTransaction = accountingApi.getLinkedTransaction(xeroTenantId, linkedTransactionID2); + messages.add("Get one Link Transaction - Status : " + oneLinkTransaction.getLinkedTransactions().get(0).getStatus()); +// 500 Error + /* + // DELETE LINKEDTRANSACTION + UUID newLinkedTransactionID = createdLinkedTransaction.getLinkedTransactions().get(0).getLinkedTransactionID(); + accountingApi.deleteLinkedTransaction(xeroTenantId, newLinkedTransactionID); + messages.add("Delete LinkedTransaction - no content in response"); + */ + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("ManualJournals")) { + // MANUAL JOURNAL + try { + // Create Manual Journal + where = "Type==\"EXPENSE\" && Status ==\"ACTIVE\""; + Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + String accountCode = accounts.getAccounts().get(0).getCode(); + where = null; + ManualJournals manualJournals = new ManualJournals(); + ManualJournal manualJournal = new ManualJournal(); + LocalDate currDate = LocalDate.now(); + manualJournal.setDate(currDate); + manualJournal.setNarration("Foo bar"); + + ManualJournalLine credit = new ManualJournalLine(); + credit.setDescription("Hello there"); + credit.setAccountCode(accountCode); + credit.setLineAmount(100.00); + manualJournal.addJournalLinesItem(credit); + + ManualJournalLine debit = new ManualJournalLine(); + debit.setDescription("Goodbye"); + debit.setAccountCode(accountCode); + debit.setLineAmount(-100.00); + manualJournal.addJournalLinesItem(debit); + manualJournals.addManualJournalsItem(manualJournal); + ManualJournals createdManualJournals = accountingApi.createManualJournal(xeroTenantId, manualJournals); + UUID newManualJournalId = createdManualJournals.getManualJournals().get(0).getManualJournalID(); + messages.add("Create Manual Journal - Narration : " + createdManualJournals.getManualJournals().get(0).getNarration()); + + // GET all Manual Journal + ManualJournals getManualJournals = accountingApi.getManualJournals(xeroTenantId, ifModifiedSince, where, order, null); + messages.add("Get Manual Journal - total : " + getManualJournals.getManualJournals().size()); + + // GET one Manual Journal + UUID manualJournalId = getManualJournals.getManualJournals().get(0).getManualJournalID(); + ManualJournals oneManualJournal = accountingApi.getManualJournal(xeroTenantId, manualJournalId); + messages.add("Get one Manual Journal - Narration : " + oneManualJournal.getManualJournals().get(0).getNarration()); + + // Update Manual Journal + ManualJournals updateManualJournals = new ManualJournals(); + ManualJournal updateManualJournal = new ManualJournal(); + updateManualJournal.setManualJournalID(newManualJournalId); + updateManualJournal.setNarration("Hello Xero"); + updateManualJournals.addManualJournalsItem(updateManualJournal); + ManualJournals updatedManualJournal = accountingApi.updateManualJournal(xeroTenantId, newManualJournalId,updateManualJournals); + messages.add("Update Manual Journal - Narration : " + updatedManualJournal.getManualJournals().get(0).getNarration()); + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("Organisations")) { + // Organisation + try { + Organisations organisations = accountingApi.getOrganisations(xeroTenantId); + messages.add("Get a Organisation - Name : " + organisations.getOrganisations().get(0).getName()); + } catch (Exception e) { + System.out.println("ERROR"); + System.out.println(e.getMessage()); + } + + } else if (object.equals("Overpayments")) { + // OVERPAYMENT + where = "Status==\"ACTIVE\"&&Type==\"BANK\""; + Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Account bankAccount = new Account(); + bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); + where = null; + + where = "SystemAccount==\"DEBTORS\""; + Accounts arAccounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Account arAccount = arAccounts.getAccounts().get(0); + where = null; + + Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + // Maker sure we have at least 2 banks + if(accountsWhere.getAccounts().size() > 0) { + List lineItems = new ArrayList<>(); + LineItem li = new LineItem(); + li.setAccountCode(arAccount.getCode()); + li.setDescription("Foobar"); + li.setQuantity(1.0); + li.setUnitAmount(20.00); + lineItems.add(li); + + BankTransaction bt = new BankTransaction(); + bt.setBankAccount(bankAccount); + bt.setContact(useContact); + bt.setLineitems(lineItems); + bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_OVERPAYMENT); + BankTransactions bts = new BankTransactions(); + bts.addBankTransactionsItem(bt); + BankTransactions newBankTransaction = accountingApi.createBankTransaction(xeroTenantId, bts, summarizeErrors); + + Overpayments overpayments = accountingApi.getOverpayments(xeroTenantId, ifModifiedSince, where, order, null, null); + messages.add("Get a Overpayments - Count : " + overpayments.getOverpayments().size()); + + if(overpayments.getOverpayments().size() > 0) { + UUID overpaymentId = overpayments.getOverpayments().get(2).getOverpaymentID(); + Overpayments oneOverpayment = accountingApi.getOverpayment(xeroTenantId, overpaymentId); + messages.add("Get one Overpayment - Total : " + oneOverpayment.getOverpayments().get(0).getTotal()); + + where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; + Invoices allInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoice inv = new Invoice(); + inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); + where = null; + + Allocations allocations = new Allocations(); + Allocation allocation = new Allocation(); + allocation.setAmount(1.0); + LocalDate currDate = LocalDate.now(); + allocation.setDate(currDate); + allocation.setInvoice(inv); + allocations.addAllocationsItem(allocation); + + Allocations newAllocation = accountingApi.createOverpaymentAllocation(xeroTenantId, overpaymentId, allocations); + messages.add("Create OverPayment allocation - Amt : " + newAllocation.getAllocations().get(0).getAmount()); + + // Get History + HistoryRecords history = accountingApi.getOverpaymentHistory(xeroTenantId, overpaymentId); + messages.add("History - count : " + history.getHistoryRecords().size() ); + + // Create History + // Error: "The document with the supplied id was not found for this endpoint. + /* + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords createdHistory = accountingApi.createOverpaymentHistory(overpaymentId,newHistoryRecords); + messages.add("History - note added to : " + createdHistory.getHistoryRecords().get(0).getDetails()); + */ + } + } + + } else if (object.equals("Payments")) { + /* Payment */ + // CREATE payment + where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; + Invoices allInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoice inv = new Invoice(); + inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); + where = null; + + where = "EnablePaymentsToAccount==true"; + Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Account paymentAccount = new Account(); + paymentAccount.setCode(accountsWhere.getAccounts().get(0).getCode()); + where = null; + + Payments createPayments = new Payments(); + Payment createPayment = new Payment(); + createPayment.setAccount(paymentAccount); + createPayment.setInvoice(inv); + createPayment.setAmount(1.00); + + LocalDate currDate = LocalDate.now(); + createPayment.setDate(currDate); + createPayments.addPaymentsItem(createPayment); + + Payments newPayments = accountingApi.createPayment(xeroTenantId, createPayments); + messages.add("Create Payments - Amt : " + newPayments.getPayments().get(0).getAmount()); + + // GET all Payments + Payments payments = accountingApi.getPayments(xeroTenantId, ifModifiedSince, where, order); + messages.add("Get Payments - Total : " + payments.getPayments().size()); + + // GET one Payment + UUID paymentID = payments.getPayments().get(0).getPaymentID(); + Payments onePayment = accountingApi.getPayment(xeroTenantId, paymentID); + messages.add("Get Payments - Amount : " + onePayment.getPayments().get(0).getAmount()); + + // Get History + HistoryRecords allHistory = accountingApi.getPaymentHistory(xeroTenantId, paymentID); + messages.add("History - count : " + allHistory.getHistoryRecords().size() ); + + // Create History + /* + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords newHistory = accountingApi.createPaymentHistory(paymentID,newHistoryRecords); + messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); + */ + } else if (object.equals("PaymentServices")) { + // Payment Services + try { + // CREATE PaymentService + PaymentServices newPaymentServices = new PaymentServices(); + PaymentService newPaymentService = new PaymentService(); + newPaymentService.setPaymentServiceName("PayUp"+ loadRandomNum()); + newPaymentService.setPaymentServiceUrl("https://www.payupnow.com/"); + newPaymentService.setPayNowText("Time To PayUp"); + newPaymentServices.addPaymentServicesItem(newPaymentService); + PaymentServices createdPaymentService = accountingApi.createPaymentService(xeroTenantId, newPaymentServices); + messages.add("Create PaymentServices - name : " + createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); + + // GET all Payments + PaymentServices paymentServices = accountingApi.getPaymentServices(xeroTenantId); + messages.add("Get PaymentServices - Total : " + paymentServices.getPaymentServices().size()); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Prepayments")) { + /* PREPAYMENT */ + where = "Status==\"ACTIVE\"&&Type==\"BANK\""; + Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Account bankAccount = new Account(); + bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); + where = null; + + where = "Type==\"EXPENSE\""; + Accounts arAccounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Account arAccount = arAccounts.getAccounts().get(0); + where = null; + + Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + // Maker sure we have at least 2 banks + if(accountsWhere.getAccounts().size() > 0) { + List lineItems = new ArrayList<>(); + LineItem li = new LineItem(); + li.setAccountCode(arAccount.getCode()); + li.setDescription("Foobar"); + li.setQuantity(1.0); + li.setTaxType("NONE"); + li.setUnitAmount(20.00); + lineItems.add(li); + + BankTransaction bt = new BankTransaction(); + bt.setBankAccount(bankAccount); + bt.setContact(useContact); + bt.setLineitems(lineItems); + bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_PREPAYMENT); + BankTransactions bts = new BankTransactions(); + bts.addBankTransactionsItem(bt); + BankTransactions newBankTransaction = accountingApi.createBankTransaction(xeroTenantId, bts, summarizeErrors); + where = "Status==\"AUTHORISED\" && TYPE==\"RECEIVE-PREPAYMENT\""; + Prepayments prepayments = accountingApi.getPrepayments(xeroTenantId, ifModifiedSince, where, order, null, null); + messages.add("Get a Prepayments - Count : " + prepayments.getPrepayments().size()); + where = null; + if(prepayments.getPrepayments().size() > 0) { + UUID prepaymentId = prepayments.getPrepayments().get(0).getPrepaymentID(); + Prepayments onePrepayment = accountingApi.getPrepayment(xeroTenantId, prepaymentId); + messages.add("Get one Prepayment - Total : " + onePrepayment.getPrepayments().get(0).getTotal()); + where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; + Invoices allInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoice inv = new Invoice(); + inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); + where = null; + + Allocations allocations = new Allocations(); + Allocation allocation = new Allocation(); + allocation.setAmount(1.0); + LocalDate currDate = LocalDate.now(); + allocation.setDate(currDate); + allocation.setInvoice(inv); + allocations.addAllocationsItem(allocation); + + //Allocations newAllocation = accountingApi.createPrepaymentAllocation(prepaymentId, allocations); + //messages.add("Create PrePayment allocation - Amt : " + newAllocation.getAllocations().get(0).getAmount()); + + // Get History + HistoryRecords history = accountingApi.getPrepaymentHistory(xeroTenantId, prepaymentId); + messages.add("History - count : " + history.getHistoryRecords().size() ); + + // Create History + // Error: "The document with the supplied id was not found for this end point. + /* + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords createdHistory = accountingApi.createPrepaymentHistory(prepaymentId,newHistoryRecords); + messages.add("History - note added to : " + createdHistory.getHistoryRecords().get(0).getDetails()); + */ + } + } + } else if (object.equals("PurchaseOrders")) { + // PURCHASE ORDERS + try { + // CREATE Purchase Order + where = "Type==\"EXPENSE\""; + Accounts arAccounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Account arAccount = arAccounts.getAccounts().get(0); + where = null; + + PurchaseOrders purchaseOrders = new PurchaseOrders(); + PurchaseOrder purchaseOrder = new PurchaseOrder(); + LocalDate currDate = LocalDate.now(); + purchaseOrder.setDate(currDate); + Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + purchaseOrder.setContact(useContact); + + List lineItems = new ArrayList<>(); + LineItem li = new LineItem(); + li.setAccountCode(arAccount.getCode()); + li.setDescription("Foobar"); + li.setQuantity(1.0); + li.setUnitAmount(20.00); + lineItems.add(li); + purchaseOrder.setLineItems(lineItems); + purchaseOrders.addPurchaseOrdersItem(purchaseOrder); + PurchaseOrders createdPurchaseOrders = accountingApi.createPurchaseOrder(xeroTenantId, purchaseOrders, summarizeErrors); + messages.add("Create Purchase order - total : " + createdPurchaseOrders.getPurchaseOrders().get(0).getTotal()); + + // UPDATE Purchase Orders + UUID newPurchaseOrderID = createdPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); + createdPurchaseOrders.getPurchaseOrders().get(0).setAttentionTo("Jimmy"); + PurchaseOrders updatePurchaseOrders = accountingApi.updatePurchaseOrder(xeroTenantId, newPurchaseOrderID, createdPurchaseOrders); + messages.add("Update Purchase order - attn : " + updatePurchaseOrders.getPurchaseOrders().get(0).getAttentionTo()); + + // GET Purchase Orders + String status = null; + String dateFrom = null; + String dateTo = null; + PurchaseOrders allPurchaseOrders = accountingApi.getPurchaseOrders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, null); + messages.add("Get Purchase orders - Count : " + allPurchaseOrders.getPurchaseOrders().size()); + + // GET one Purchase Order + UUID purchaseOrderID = allPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); + PurchaseOrders onePurchaseOrder = accountingApi.getPurchaseOrder(xeroTenantId, purchaseOrderID); + messages.add("Get one Purchase order - Total : " + onePurchaseOrder.getPurchaseOrders().get(0).getTotal()); + + // DELETE Purchase Orders + createdPurchaseOrders.getPurchaseOrders().get(0).setStatus(com.xero.models.accounting.PurchaseOrder.StatusEnum.DELETED); + PurchaseOrders deletePurchaseOrders = accountingApi.updatePurchaseOrder(xeroTenantId, newPurchaseOrderID, createdPurchaseOrders); + messages.add("Delete Purchase order - Status : " + deletePurchaseOrders.getPurchaseOrders().get(0).getStatus()); + + // Get History + HistoryRecords history = accountingApi.getInvoiceHistory(xeroTenantId, purchaseOrderID); + messages.add("History - count : " + history.getHistoryRecords().size() ); + + // Create History + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords newHistory = accountingApi.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID,newHistoryRecords); + messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Receipts")) { + /* RECEIPTS */ + try { + //Create +// where = "IsSubscriber==true"; + Users users = accountingApi.getUsers(xeroTenantId, ifModifiedSince, where, order); + where = null; + + where = "ShowInExpenseClaims==true && Status==\"ACTIVE\""; + Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + where = null; + + User useUser = new User(); + useUser.setUserID(users.getUsers().get(0).getUserID()); + + Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + // CREATE NEW RECEIPT + Receipts receipts = new Receipts(); + Receipt receipt = new Receipt(); + + LineItem li = new LineItem(); + li.setAccountCode(accounts.getAccounts().get(0).getCode()); + li.setDescription("Foobar"); + li.setQuantity(2.0); + li.setUnitAmount(20.00); + li.setLineAmount(40.00); + li.setTaxType("NONE"); + + receipt.addLineitemsItem(li); + receipt.setUser(useUser); + receipt.lineAmountTypes(LineAmountTypes.NOTAX); + receipt.contact(useContact); + receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); + receipts.addReceiptsItem(receipt); + Receipts newReceipts = accountingApi.createReceipt(xeroTenantId, receipts); + messages.add("Create Receipts - Total : " + newReceipts.getReceipts().get(0).getTotal()); + + // UPDATE Receipts + UUID newReceiptId = newReceipts.getReceipts().get(0).getReceiptID(); + newReceipts.getReceipts().get(0).setReference("Foobar"); + Receipts updateReceipts = accountingApi.updateReceipt(xeroTenantId, newReceiptId, newReceipts); + messages.add("Create Receipts - Ref : " + updateReceipts.getReceipts().get(0).getReference()); + + // GET all Receipts + Receipts allReceipts = accountingApi.getReceipts(xeroTenantId, ifModifiedSince, where, order, null); + messages.add("Create Receipts - Count : " + allReceipts.getReceipts().size()); + + // GET one Receipts + UUID receiptID = allReceipts.getReceipts().get(0).getReceiptID(); + Receipts oneReceipts = accountingApi.getReceipt(xeroTenantId, receiptID); + messages.add("Create Receipts - Total : " + oneReceipts.getReceipts().get(0).getTotal()); + + // Get History + HistoryRecords history = accountingApi.getReceiptHistory(xeroTenantId, receiptID); + messages.add("History - count : " + history.getHistoryRecords().size() ); + + // Create History + // Error: "The document with the supplied id was not found for this endpoint. + /* + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords newHistory = accountingApi.createReceiptHistory(receiptID, newHistoryRecords); + messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); + */ + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("RepeatingInvoices")) { + /* REPEATING INVOICE */ + try { + // GET all Repeating Invoices + RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(xeroTenantId, where, order); + if ( repeatingInvoices.getRepeatingInvoices().size() > 0) { + messages.add("Repeating Invoice - count : " + repeatingInvoices.getRepeatingInvoices().size() ); + + // GET one Repeating Invoices + UUID repeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); + RepeatingInvoices repeatingInvoice = accountingApi.getRepeatingInvoice(xeroTenantId, repeatingInvoiceID); + messages.add("Repeating Invoice - total : " + repeatingInvoice.getRepeatingInvoices().get(0).getTotal()); + + // Get History + HistoryRecords history = accountingApi.getRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID); + messages.add("History - count : " + history.getHistoryRecords().size() ); + + // Create History + // Error: "The document with the supplied id was not found for this endpoint. + /* + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords newHistory = accountingApi.createRepeatingInvoiceHistory(repeatingInvoiceID, newHistoryRecords); + messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); + */ + } else { + messages.add("Zero repeating Invoices found" ); + + } + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Reports")) { + + /* REPORTS */ + /* + // TenNinetyNine - US Only + String reportYear = null; + Reports reports = accountingApi.getReportTenNinetyNine(reportYear); + System.out.println(reports.toString()); + */ + // AgedPayablesByContact + String date = null; + String fromDate = null; + String toDate = null; + String profitLossTimeframe = null; + String trackingOptionID1 = null; + String trackingOptionID2 = null; + boolean standardLayout = false; + boolean paymentsOnly = false; + String trackingCategoryID = null; + String trackingCategoryID2 = null; + String trackingOptionID = null; + + Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + UUID contactId = contacts.getContacts().get(0).getContactID(); + LocalDate xDate = LocalDate.now(); + LocalDate xFromDate = LocalDate.now(); + LocalDate xToDate = LocalDate.now(); + + ReportWithRows reportAgedPayablesByContact = accountingApi.getReportAgedPayablesByContact(xeroTenantId, contactId, xDate, xFromDate, xToDate); + messages.add("Get a Reports - Name:" + reportAgedPayablesByContact.getReports().get(0).getReportName()); + + // AgedReceivablesByContact + ReportWithRows reportAgedReceivablesByContact = accountingApi.getReportAgedReceivablesByContact(xeroTenantId, contactId, xDate, xFromDate, xToDate); + messages.add("Get a Reports - Name:" + reportAgedReceivablesByContact.getReports().get(0).getReportName()); + + // reportBalanceSheet + ReportWithRows reportBalanceSheet = accountingApi.getReportBalanceSheet(xeroTenantId, toDate, 3, "MONTH", trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); + messages.add("Get a Reports - Name:" + reportBalanceSheet.getReports().get(0).getReportName()); + + // reportBankSummary + ReportWithRows reportBankSummary = accountingApi.getReportBankSummary(xeroTenantId, xToDate, null, null); + messages.add("Get a Reports - Name:" + reportBankSummary.getReports().get(0).getReportName()); + + // reportBASorGSTlist - AU and NZ only + ReportWithRows reportTax = accountingApi.getReportBASorGSTList(xeroTenantId); + System.out.println(reportTax.toString()); + + // reportBudgetSummary + int budgetPeriod = 1; + int budgetTimeframe = 3; + ReportWithRows reportBudgetSummary = accountingApi.getReportBudgetSummary(xeroTenantId, xToDate, budgetPeriod, budgetTimeframe); + messages.add("Get a Reports - Name:" + reportBudgetSummary.getReports().get(0).getReportName()); + + // reportExecutiveSummary + ReportWithRows reportExecutiveSummary = accountingApi.getReportExecutiveSummary(xeroTenantId, xToDate); + messages.add("Get a Reports - Name:" + reportExecutiveSummary.getReports().get(0).getReportName()); + + // reportProfitandLoss + fromDate = "2018-01-01"; + toDate = "2018-12-31"; + profitLossTimeframe = "MONTH"; + standardLayout = true; + paymentsOnly = false; + ReportWithRows reportProfitLoss = accountingApi.getReportProfitAndLoss(xeroTenantId, xFromDate, xToDate, null, profitLossTimeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); + messages.add("Get a Reports - Name:" + reportProfitLoss.getReports().get(0).getReportName()); + fromDate = null; + toDate = null; + + // reportTrialBalance + ReportWithRows reportTrialBalance = accountingApi.getReportTrialBalance(xeroTenantId, xToDate, paymentsOnly); + messages.add("Get a Reports - Name:" + reportTrialBalance.getReports().get(0).getReportName()); + + } else if (object.equals("TrackingCategories")) { + // TRACKING CATEGORIES + try { + // GET Tracking Categories + TrackingCategories trackingCategories = accountingApi.getTrackingCategories(xeroTenantId, where, order, includeArchived); + int count = trackingCategories.getTrackingCategories().size(); + + if (count == 2) { + //DELETE Tracking Categories + UUID trackingCategoryID = trackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); + TrackingCategories deletedTrackingCategories = accountingApi.deleteTrackingCategory(xeroTenantId, trackingCategoryID); + messages.add("DELETED tracking categories - status : " + deletedTrackingCategories.getTrackingCategories().get(0).getStatus()); + } + + // CREATE Tracking Categories + TrackingCategory newTrackingCategory = new TrackingCategory(); + newTrackingCategory.setName("Foo"+ loadRandomNum()); + TrackingCategories createdTrackingCategories = accountingApi.createTrackingCategory(xeroTenantId, newTrackingCategory); + messages.add("CREATED tracking categories - name : " + createdTrackingCategories.getTrackingCategories().get(0).getName()); + + // UPDATE Tracking Categories + UUID newTrackingCategoryID = createdTrackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); + newTrackingCategory.setName("Foo"+ loadRandomNum()); + TrackingCategories updatedTrackingCategories = accountingApi.updateTrackingCategory(xeroTenantId, newTrackingCategoryID,newTrackingCategory); + messages.add("UPDATED tracking categories - name : " + updatedTrackingCategories.getTrackingCategories().get(0).getName()); + + // GET one Tracking Categories + if (count > 0) + { + UUID oneTrackingCategoryID = trackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); + TrackingCategories oneTrackingCategories = accountingApi.getTrackingCategory(xeroTenantId, oneTrackingCategoryID); + messages.add("GET ONE tracking categories - name : " + oneTrackingCategories.getTrackingCategories().get(0).getName()); + + // Create one Option + TrackingOption option = new TrackingOption(); + option.setName("Bar"+ loadRandomNum()); + TrackingOptions newTrackingOptions = accountingApi.createTrackingOptions(xeroTenantId, oneTrackingCategoryID,option); + messages.add("CREATE option - name : " + newTrackingOptions.getOptions().get(0).getName()); + + // DELETE All options + //UUID newOptionId = newTrackingOptions.getOptions().get(0).getTrackingOptionID(); + //TrackingOptions deleteOptions = accountingApi.deleteTrackingOptions(oneTrackingCategoryID, newOptionId); + //messages.add("DELETE one option - Status : " + deleteOptions.getOptions().get(0).getStatus()); + } + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("TaxRates")) { + // TAX RATE + try { + // CREATE Tax Rate + TaxRates newTaxRates = new TaxRates(); + TaxRate newTaxRate = new TaxRate(); + TaxComponent rate01 = new TaxComponent(); + rate01.setName("State Tax"); + rate01.setRate(2.25); + newTaxRate.setName("SDKTax"+ loadRandomNum()); + newTaxRate.addTaxComponentsItem(rate01); + newTaxRates.addTaxRatesItem(newTaxRate); + + TaxRates createdTaxRate = accountingApi.createTaxRate(xeroTenantId, newTaxRates); + messages.add("CREATE TaxRate - name : " + createdTaxRate.getTaxRates().get(0).getName()); + + // UDPATE Tax Rate + newTaxRates.getTaxRates().get(0).setStatus(com.xero.models.accounting.TaxRate.StatusEnum.DELETED); + TaxRates updatedTaxRate = accountingApi.updateTaxRate(xeroTenantId, newTaxRates); + messages.add("UPDATED TaxRate - status : " + updatedTaxRate.getTaxRates().get(0).getStatus()); + + // GET Tax Rate + String taxType = null; + TaxRates taxRates = accountingApi.getTaxRates(xeroTenantId, where, order, taxType); + messages.add("GET TaxRate - cnt : " + taxRates.getTaxRates().size()); + + // GET Tax Rate + taxType = "CAPEXINPUT2"; + TaxRates taxRatesByType = accountingApi.getTaxRates(xeroTenantId, where, order, taxType); + messages.add("GET TaxRate by Cap Purchase Type : " + taxRatesByType.getTaxRates().size()); + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Users")) { + // USER + try { + // GET Users + Users users = accountingApi.getUsers(xeroTenantId, ifModifiedSince, where, order); + messages.add("GET Users - cnt : " + users.getUsers().size()); + + //GET One User + UUID userID = users.getUsers().get(0).getUserID(); + Users user = accountingApi.getUser(xeroTenantId, userID); + messages.add("GET Users - First Name : " + user.getUsers().get(0).getFirstName()); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + + for (int i = 0; i < messages.size(); i++) { + System.out.println(messages.get(i)); + respWriter.println("

" + messages.get(i) + "

"); + } + + respWriter.println("
end processing request
"); + respWriter.println("
"); + } + + protected void addToMapIfNotNull(Map map, String key, Object value) { + if (value != null) { + map.put(key, value.toString()); + } + } + + protected String saveFile(ByteArrayInputStream input, String fileName) { + String saveFilePath = null; + File f = new File("./"); + String dirPath; + try { + dirPath = f.getCanonicalPath(); + + FileOutputStream output = new FileOutputStream(fileName); + + int DEFAULT_BUFFER_SIZE = 1024; + byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; + int n = 0; + n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); + while (n >= 0) { + output.write(buffer, 0, n); + n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); + } + input.close(); + output.close(); + + saveFilePath = dirPath + File.separator + fileName; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return saveFilePath; + } + + public static int loadRandomNum() { + Random randomGenerator = new Random(); + int randomInt = randomGenerator.nextInt(100000); + return randomInt; + } +} diff --git a/src/main/java/com/xero/example/Authorization.java b/src/main/java/com/xero/example/Authorization.java index 4dc4d3fc..f7dea931 100644 --- a/src/main/java/com/xero/example/Authorization.java +++ b/src/main/java/com/xero/example/Authorization.java @@ -1,6 +1,7 @@ package com.xero.example; import java.io.IOException; +import java.net.URLEncoder; import java.util.Random; import javax.servlet.ServletException; @@ -11,6 +12,7 @@ import com.github.scribejava.core.builder.ServiceBuilder; import com.github.scribejava.core.oauth.OAuth20Service; +import com.xero.api.ApiClient; import com.xero.api.XeroApi20; /** @@ -31,22 +33,26 @@ public Authorization() { * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // Replace these with your client id and secret - final String clientId = "--your-clientid--"; - final String clientSecret = "--your-clientsecret--"; + + TokenStorage store = new TokenStorage(); + final String clientId = "-your-clientid-"; + final String clientSecret = "-your-clientsecret-"; + final String redirectURI = "-your-redirecturi-"; final String secretState = "secret" + new Random().nextInt(999_999); - final OAuth20Service service = new ServiceBuilder(clientId) + // Configure OAuth2 access token for authorization: oAuth2AuthCode + final OAuth20Service service = new ServiceBuilder(clientId) .apiSecret(clientSecret) - .defaultScope("openid email profile offline_access accounting.settings accounting.transactions") // replace with desired scope - .callback("http://localhost:8080/Callback") + .defaultScope("openid email profile offline_access accounting.settings accounting.transactions accounting.contacts accounting.journals.read accounting.reports.read accounting.attachments paymentservices") // replace with desired scope + .callback(redirectURI) .build(XeroApi20.instance()); // Obtain the Authorization URL final String authorizationUrl = service.createAuthorizationUrlBuilder() .state(secretState) .build(); - + System.out.println(authorizationUrl); response.sendRedirect(authorizationUrl); + } /** diff --git a/src/main/java/com/xero/example/Callback.java b/src/main/java/com/xero/example/Callback.java index 88369dd2..aec66e5f 100644 --- a/src/main/java/com/xero/example/Callback.java +++ b/src/main/java/com/xero/example/Callback.java @@ -1,6 +1,7 @@ package com.xero.example; import java.io.IOException; +import java.io.PrintWriter; import java.util.Random; import java.util.concurrent.ExecutionException; @@ -43,30 +44,38 @@ public Callback() { * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - final String clientId = "--your-clientid--"; - final String clientSecret = "--your-clientsecret--"; - final String secretState = "secret" + new Random().nextInt(999_999); + + final String clientId = "-your-clientid-"; + final String clientSecret = "-your-clientsecret-"; + final String redirectURI = "-your-redirecturi-"; final OAuth20Service service = new ServiceBuilder(clientId) .apiSecret(clientSecret) .defaultScope("openid email profile offline_access accounting.settings accounting.transactions") // replace with desired scope - .callback("http://localhost:8080/Callback") + .callback(redirectURI) .build(XeroApi20.instance()); + + + PrintWriter respWriter = response.getWriter(); + response.setStatus(200); + response.setContentType("text/html"); + respWriter.println("
Let's make API calls
"); String code = "123"; if (request.getParameter("code") != null) { code = request.getParameter("code"); } - System.out.println("Trading the Authorization Code for an Access Token..."); + + OAuth2AccessToken accessToken; try { accessToken = service.getAccessToken(code); TokenStorage store = new TokenStorage(); store.saveItem(response, "access_token", accessToken.getAccessToken()); - System.out.println("Got the Access Token!"); - - System.out.println("Refreshing the Access Token..."); - accessToken = service.refreshAccessToken(accessToken.getRefreshToken()); - store.saveItem(response, "access_token", accessToken.getAccessToken()); + store.saveItem(response, "refresh_token", accessToken.getRefreshToken()); + + // REFRESH BITS + //accessToken = service.refreshAccessToken(accessToken.getRefreshToken()); + //store.saveItem(response, "access_token", accessToken.getAccessToken()); // GET CONNECTIONS String requestUrl = "https://api.xero.com/connections"; @@ -81,17 +90,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t System.out.println(jsonObject.get("tenantId")); store.saveItem(response, "tenant_id", jsonObject.get("tenantId").toString()); - System.out.println(store.get(request, "access_token")); - System.out.println(store.get(request, "tenant_id")); - - // GET ORGANISATION - requestUrl = "https://api.xero.com/api.xro/2.0/Organisation"; - final OAuthRequest requestOrg = new OAuthRequest(Verb.GET, requestUrl); - requestOrg.addHeader("Accept", "application/json"); - requestOrg.addHeader("xero-tenant-id",jsonObject.get("tenantId").toString()); - service.signRequest(accessToken.getAccessToken(), requestOrg); - final Response responseOrg = service.execute(requestOrg); - System.out.println(responseOrg.getBody()); + response.sendRedirect("./AuthenticatedResource"); } catch (InterruptedException | ExecutionException | ParseException e) { // TODO Auto-generated catch block From 94e1c6f295b735d98e32703147472b663234848e Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Thu, 20 Jun 2019 10:01:22 -0700 Subject: [PATCH 10/76] moved xeroTenantId from individual methods to the AccountingApi object --- .../com/xero/api/client/AccountingApi.java | 2677 ++++++----------- src/test/.gitignore | 1 + .../api/client/AccountingApiAccountsTest.java | 192 ++ .../AccountingApiBankTransactionTest.java | 227 ++ .../client/AccountingApiBankTransferTest.java | 201 ++ .../client/AccountingApiBatchPaymentTest.java | 134 + .../AccountingApiBrandingThemeTest.java | 134 + .../client/AccountingApiContactGroupTest.java | 168 ++ .../api/client/AccountingApiContactsTest.java | 297 ++ .../client/AccountingApiCreditNotesTest.java | 320 ++ .../client/AccountingApiEmployeesTest.java | 152 + .../AccountingApiExpenseClaimsTest.java | 226 ++ .../api/client/AccountingApiInvoicesTest.java | 375 +++ .../api/client/AccountingApiItemsTest.java | 202 ++ .../api/client/AccountingApiJournalsTest.java | 165 + .../AccountingApiLinkedTransactionsTest.java | 169 ++ .../AccountingApiManualJournalsTest.java | 255 ++ .../AccountingApiOrganisationsTest.java | 124 + .../client/AccountingApiOverpaymentsTest.java | 196 ++ .../AccountingApiPaymentServicesTest.java | 112 + .../api/client/AccountingApiPaymentsTest.java | 203 ++ .../client/AccountingApiPrepaymentsTest.java | 193 ++ .../AccountingApiPurchaseOrdersTest.java | 276 ++ .../java/com/xero/api/client/helo-heros.jpg | Bin 0 -> 40053 bytes .../java/com/xero/api/client/helo-heros2.jpg | Bin 0 -> 40053 bytes .../org.mockito.plugins.MockMaker | 1 + 26 files changed, 5287 insertions(+), 1713 deletions(-) create mode 100644 src/test/.gitignore create mode 100644 src/test/java/com/xero/api/client/AccountingApiAccountsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiContactsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiItemsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiJournalsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java create mode 100644 src/test/java/com/xero/api/client/helo-heros.jpg create mode 100644 src/test/java/com/xero/api/client/helo-heros2.jpg create mode 100644 src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index 899615c6..749bc857 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -76,48 +76,55 @@ public class AccountingApi { private ApiClient apiClient; + private String xeroTenantId; public AccountingApi() { - this(new ApiClient()); + //this(new ApiClient()); } - public AccountingApi(ApiClient apiClient) { + public AccountingApi(ApiClient apiClient, String xeroTenantId) { this.apiClient = apiClient; + this.xeroTenantId = xeroTenantId; } public ApiClient getApiClient() { return apiClient; } - public void setApiClient(ApiClient apiClient) { + public void setApiClient(ApiClient apiClient, String xeroTenantId) { this.apiClient = apiClient; + this.xeroTenantId = xeroTenantId; + } + + public String getXeroTenantId(String xeroTenantId) { + return xeroTenantId; + } + + public void aetXeroTenantId(String xeroTenantId) { + this.xeroTenantId = xeroTenantId; } /** * Allows you to create a new chart of accounts *

200 - Success - created new Account and return response of type Accounts array with new Account *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant * @param account Request of type Account * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts createAccount(String xeroTenantId, Account account) throws IOException { - HttpResponse response = createAccountForHttpResponse(xeroTenantId, account); + public Accounts createAccount(Account account) throws IOException { + HttpResponse response = createAccountForHttpResponse(account); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createAccountForHttpResponse( String xeroTenantId, Account account) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); - }// verify the required parameter 'account' is set + public HttpResponse createAccountForHttpResponse( Account account) throws IOException { + // verify the required parameter 'account' is set if (account == null) { throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Accounts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -140,24 +147,20 @@ public HttpResponse createAccountForHttpResponse( String xeroTenantId, Account * Allows you to create Attachment on Account *

200 - Success - return response of type Attachments array of Attachment *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param fileName Name of the attachment * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { - HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); + public Attachments createAccountAttachmentByFileName(UUID accountID, String fileName, File body) throws IOException { + HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(accountID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createAccountAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set + public HttpResponse createAccountAttachmentByFileNameForHttpResponse( UUID accountID, String fileName, File body) throws IOException { + // verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -168,7 +171,7 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( String xer throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; @@ -199,28 +202,24 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( String xer * Allows you to create a spend or receive money transaction *

200 - Success - return response of type BankTransactions array with new BankTransaction *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param bankTransactions The bankTransactions parameter * @param summarizeErrors response format that shows validation errors for each bank transaction * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { - HttpResponse response = createBankTransactionForHttpResponse(xeroTenantId, bankTransactions, summarizeErrors); + public BankTransactions createBankTransaction(BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + HttpResponse response = createBankTransactionForHttpResponse(bankTransactions, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransactionForHttpResponse( String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); - }// verify the required parameter 'bankTransactions' is set + public HttpResponse createBankTransactionForHttpResponse( BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'bankTransactions' is set if (bankTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransactions"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -254,24 +253,20 @@ public HttpResponse createBankTransactionForHttpResponse( String xeroTenantId, * Allows you to createa an Attachment on BankTransaction by Filename *

200 - Success - return response of Attachments array of Attachment *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param fileName The name of the file being attached * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { - HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); + public Attachments createBankTransactionAttachmentByFileName(UUID bankTransactionID, String fileName, File body) throws IOException { + HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(bankTransactionID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set + public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( UUID bankTransactionID, String fileName, File body) throws IOException { + // verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -282,7 +277,7 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( St throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; @@ -313,23 +308,19 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( St * Allows you to create history record for a bank transactions *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(xeroTenantId, bankTransactionID, historyRecords); + public HistoryRecords createBankTransactionHistoryRecord(UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(bankTransactionID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransactionHistoryRecordForHttpResponse( String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); - }// verify the required parameter 'bankTransactionID' is set + public HttpResponse createBankTransactionHistoryRecordForHttpResponse( UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); }// verify the required parameter 'historyRecords' is set @@ -337,7 +328,7 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse( String xe throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransactions/{BankTransactionID}/History"; @@ -365,27 +356,23 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse( String xe * Allows you to create a bank transfers *

200 - Success - return response of BankTransfers array of one BankTransfer *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param bankTransfers The bankTransfers parameter * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers) throws IOException { - HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers); + public BankTransfers createBankTransfer(BankTransfers bankTransfers) throws IOException { + HttpResponse response = createBankTransferForHttpResponse(bankTransfers); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransferForHttpResponse( String xeroTenantId, BankTransfers bankTransfers) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); - }// verify the required parameter 'bankTransfers' is set + public HttpResponse createBankTransferForHttpResponse( BankTransfers bankTransfers) throws IOException { + // verify the required parameter 'bankTransfers' is set if (bankTransfers == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransfers"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -407,24 +394,20 @@ public HttpResponse createBankTransferForHttpResponse( String xeroTenantId, Ban /** *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param fileName The name of the file being attached to a Bank Transfer * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { - HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); + public Attachments createBankTransferAttachmentByFileName(UUID bankTransferID, String fileName, File body) throws IOException { + HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(bankTransferID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set + public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( UUID bankTransferID, String fileName, File body) throws IOException { + // verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -435,7 +418,7 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( Strin throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; @@ -465,23 +448,19 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( Strin /** *

200 - Success - return response HistoryRecords array with the newly created HistoryRecord for a Bank Transfer *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createBankTransferHistoryRecordForHttpResponse(xeroTenantId, bankTransferID, historyRecords); + public HistoryRecords createBankTransferHistoryRecord(UUID bankTransferID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBankTransferHistoryRecordForHttpResponse(bankTransferID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransferHistoryRecordForHttpResponse( String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); - }// verify the required parameter 'bankTransferID' is set + public HttpResponse createBankTransferHistoryRecordForHttpResponse( UUID bankTransferID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); }// verify the required parameter 'historyRecords' is set @@ -489,7 +468,7 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse( String xeroT throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransfers/{BankTransferID}/History"; @@ -517,27 +496,23 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse( String xeroT * Create one or many BatchPayments for invoices *

200 - Success - return response of type BatchPayments array of BatchPayment objects *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments) throws IOException { - HttpResponse response = createBatchPaymentForHttpResponse(xeroTenantId, batchPayments); + public BatchPayments createBatchPayment(BatchPayments batchPayments) throws IOException { + HttpResponse response = createBatchPaymentForHttpResponse(batchPayments); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBatchPaymentForHttpResponse( String xeroTenantId, BatchPayments batchPayments) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); - }// verify the required parameter 'batchPayments' is set + public HttpResponse createBatchPaymentForHttpResponse( BatchPayments batchPayments) throws IOException { + // verify the required parameter 'batchPayments' is set if (batchPayments == null) { throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BatchPayments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -560,23 +535,19 @@ public HttpResponse createBatchPaymentForHttpResponse( String xeroTenantId, Bat * Allows you to create a history record for a Batch Payment *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param batchPaymentID Unique identifier for BatchPayment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(xeroTenantId, batchPaymentID, historyRecords); + public HistoryRecords createBatchPaymentHistoryRecord(UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(batchPaymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); - }// verify the required parameter 'batchPaymentID' is set + public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'batchPaymentID' is set if (batchPaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); }// verify the required parameter 'historyRecords' is set @@ -584,7 +555,7 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( String xeroT throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BatchPayments/{BatchPaymentID}/History"; @@ -612,23 +583,19 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( String xeroT * Allow for the creation of new custom payment service for specified Branding Theme *

200 - Success - return response of type PaymentServices array with newly created PaymentService *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param brandingThemeID Unique identifier for a Branding Theme * @param paymentService The paymentService parameter * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { - HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, paymentService); + public PaymentServices createBrandingThemePaymentServices(UUID brandingThemeID, PaymentService paymentService) throws IOException { + HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(brandingThemeID, paymentService); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBrandingThemePaymentServicesForHttpResponse( String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); - }// verify the required parameter 'brandingThemeID' is set + public HttpResponse createBrandingThemePaymentServicesForHttpResponse( UUID brandingThemeID, PaymentService paymentService) throws IOException { + // verify the required parameter 'brandingThemeID' is set if (brandingThemeID == null) { throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); }// verify the required parameter 'paymentService' is set @@ -636,7 +603,7 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse( String xe throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; @@ -663,27 +630,23 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse( String xe /** *

200 - Success - return response of type Contacts array with newly created Contact *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant * @param contact The contact parameter * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts createContact(String xeroTenantId, Contact contact) throws IOException { - HttpResponse response = createContactForHttpResponse(xeroTenantId, contact); + public Contacts createContact(Contact contact) throws IOException { + HttpResponse response = createContactForHttpResponse(contact); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createContactForHttpResponse( String xeroTenantId, Contact contact) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); - }// verify the required parameter 'contact' is set + public HttpResponse createContactForHttpResponse( Contact contact) throws IOException { + // verify the required parameter 'contact' is set if (contact == null) { throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -705,24 +668,20 @@ public HttpResponse createContactForHttpResponse( String xeroTenantId, Contact /** *

200 - Success - return response of type Attachments array with an newly created Attachment *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param fileName Name for the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { - HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); + public Attachments createContactAttachmentByFileName(UUID contactID, String fileName, File body) throws IOException { + HttpResponse response = createContactAttachmentByFileNameForHttpResponse(contactID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createContactAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set + public HttpResponse createContactAttachmentByFileNameForHttpResponse( UUID contactID, String fileName, File body) throws IOException { + // verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -733,7 +692,7 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( String xer throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; @@ -764,27 +723,23 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( String xer * Allows you to create a contact group *

200 - Success - return response of type Contact Groups array of newly created Contact Group *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant * @param contactGroups an array of contact groups with names specified * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups) throws IOException { - HttpResponse response = createContactGroupForHttpResponse(xeroTenantId, contactGroups); + public ContactGroups createContactGroup(ContactGroups contactGroups) throws IOException { + HttpResponse response = createContactGroupForHttpResponse(contactGroups); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createContactGroupForHttpResponse( String xeroTenantId, ContactGroups contactGroups) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); - }// verify the required parameter 'contactGroups' is set + public HttpResponse createContactGroupForHttpResponse( ContactGroups contactGroups) throws IOException { + // verify the required parameter 'contactGroups' is set if (contactGroups == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ContactGroups"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -807,23 +762,19 @@ public HttpResponse createContactGroupForHttpResponse( String xeroTenantId, Con * Allows you to add Contacts to a Contract Group *

200 - Success - return response of type Contacts array of added Contacts *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group * @param contacts an array of contacts with ContactID to be added to ContactGroup * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { - HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts); + public Contacts createContactGroupContacts(UUID contactGroupID, Contacts contacts) throws IOException { + HttpResponse response = createContactGroupContactsForHttpResponse(contactGroupID, contacts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createContactGroupContactsForHttpResponse( String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); - }// verify the required parameter 'contactGroupID' is set + public HttpResponse createContactGroupContactsForHttpResponse( UUID contactGroupID, Contacts contacts) throws IOException { + // verify the required parameter 'contactGroupID' is set if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); }// verify the required parameter 'contacts' is set @@ -831,7 +782,7 @@ public HttpResponse createContactGroupContactsForHttpResponse( String xeroTenant throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; @@ -859,23 +810,19 @@ public HttpResponse createContactGroupContactsForHttpResponse( String xeroTenant * Allows you to retrieve a history records of an Contact *

200 - Success - return response of type History Records array of newly created History Record for a specific Contact *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createContactHistoryForHttpResponse(xeroTenantId, contactID, historyRecords); + public HistoryRecords createContactHistory(UUID contactID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createContactHistoryForHttpResponse(contactID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createContactHistoryForHttpResponse( String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); - }// verify the required parameter 'contactID' is set + public HttpResponse createContactHistoryForHttpResponse( UUID contactID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); }// verify the required parameter 'historyRecords' is set @@ -883,7 +830,7 @@ public HttpResponse createContactHistoryForHttpResponse( String xeroTenantId, U throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts/{ContactID}/History"; @@ -911,28 +858,24 @@ public HttpResponse createContactHistoryForHttpResponse( String xeroTenantId, U * Allows you to create a credit note *

200 - Success - return response of type Credit Notes array of newly created CreditNote *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param creditNotes an array of Credit Notes with a single CreditNote object. * @param summarizeErrors shows validation errors for each credit note * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { - HttpResponse response = createCreditNoteForHttpResponse(xeroTenantId, creditNotes, summarizeErrors); + public CreditNotes createCreditNote(CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + HttpResponse response = createCreditNoteForHttpResponse(creditNotes, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createCreditNoteForHttpResponse( String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); - }// verify the required parameter 'creditNotes' is set + public HttpResponse createCreditNoteForHttpResponse( CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'creditNotes' is set if (creditNotes == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -966,23 +909,19 @@ public HttpResponse createCreditNoteForHttpResponse( String xeroTenantId, Credi * Allows you to create Allocation on CreditNote *

200 - Success - return response of type Allocations array with newly created Allocation for specific Credit Note *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param allocations an array of Allocations with single Allocation object defined. * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { - HttpResponse response = createCreditNoteAllocationForHttpResponse(xeroTenantId, creditNoteID, allocations); + public Allocations createCreditNoteAllocation(UUID creditNoteID, Allocations allocations) throws IOException { + HttpResponse response = createCreditNoteAllocationForHttpResponse(creditNoteID, allocations); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createCreditNoteAllocationForHttpResponse( String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); - }// verify the required parameter 'creditNoteID' is set + public HttpResponse createCreditNoteAllocationForHttpResponse( UUID creditNoteID, Allocations allocations) throws IOException { + // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); }// verify the required parameter 'allocations' is set @@ -990,7 +929,7 @@ public HttpResponse createCreditNoteAllocationForHttpResponse( String xeroTenant throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes/{CreditNoteID}/Allocations"; @@ -1018,24 +957,20 @@ public HttpResponse createCreditNoteAllocationForHttpResponse( String xeroTenant * Allows you to create Attachments on CreditNote by file name *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param fileName Name of the file you are attaching to Credit Note * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { - HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); + public Attachments createCreditNoteAttachmentByFileName(UUID creditNoteID, String fileName, File body) throws IOException { + HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(creditNoteID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set + public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( UUID creditNoteID, String fileName, File body) throws IOException { + // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -1046,7 +981,7 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( String throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; @@ -1077,23 +1012,19 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( String * Allows you to retrieve a history records of an CreditNote *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Credit Note *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, historyRecords); + public HistoryRecords createCreditNoteHistory(UUID creditNoteID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createCreditNoteHistoryForHttpResponse(creditNoteID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createCreditNoteHistoryForHttpResponse( String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); - }// verify the required parameter 'creditNoteID' is set + public HttpResponse createCreditNoteHistoryForHttpResponse( UUID creditNoteID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); }// verify the required parameter 'historyRecords' is set @@ -1101,7 +1032,7 @@ public HttpResponse createCreditNoteHistoryForHttpResponse( String xeroTenantId, throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes/{CreditNoteID}/History"; @@ -1127,27 +1058,23 @@ public HttpResponse createCreditNoteHistoryForHttpResponse( String xeroTenantId, /** *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency - * @param xeroTenantId Xero identifier for Tenant * @param currencies The currencies parameter * @return Currencies * @throws IOException if an error occurs while attempting to invoke the API **/ - public Currencies createCurrency(String xeroTenantId, Currencies currencies) throws IOException { - HttpResponse response = createCurrencyForHttpResponse(xeroTenantId, currencies); + public Currencies createCurrency(Currencies currencies) throws IOException { + HttpResponse response = createCurrencyForHttpResponse(currencies); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createCurrencyForHttpResponse( String xeroTenantId, Currencies currencies) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); - }// verify the required parameter 'currencies' is set + public HttpResponse createCurrencyForHttpResponse( Currencies currencies) throws IOException { + // verify the required parameter 'currencies' is set if (currencies == null) { throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Currencies"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -1170,27 +1097,23 @@ public HttpResponse createCurrencyForHttpResponse( String xeroTenantId, Currenc * Allows you to create new employees used in Xero payrun *

200 - Success - return response of type Employees array with new Employee *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param employees The employees parameter * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees createEmployee(String xeroTenantId, Employees employees) throws IOException { - HttpResponse response = createEmployeeForHttpResponse(xeroTenantId, employees); + public Employees createEmployee(Employees employees) throws IOException { + HttpResponse response = createEmployeeForHttpResponse(employees); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createEmployeeForHttpResponse( String xeroTenantId, Employees employees) 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 'employees' is set + public HttpResponse createEmployeeForHttpResponse( Employees employees) throws IOException { + // verify the required parameter 'employees' is set if (employees == null) { throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Employees"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -1213,28 +1136,24 @@ public HttpResponse createEmployeeForHttpResponse( String xeroTenantId, Employe * Allows you to retrieve expense claims *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param expenseClaims The expenseClaims parameter * @param summarizeErrors shows validation errors for each expense claim * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { - HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, summarizeErrors); + public ExpenseClaims createExpenseClaim(ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + HttpResponse response = createExpenseClaimForHttpResponse(expenseClaims, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createExpenseClaimForHttpResponse( String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set + public HttpResponse createExpenseClaimForHttpResponse( ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'expenseClaims' is set if (expenseClaims == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ExpenseClaims"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -1267,23 +1186,19 @@ public HttpResponse createExpenseClaimForHttpResponse( String xeroTenantId, Exp /** * Allows you to create a history records of an ExpenseClaim *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims - * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, historyRecords); + public HistoryRecords createExpenseClaimHistory(UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createExpenseClaimHistoryForHttpResponse(expenseClaimID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createExpenseClaimHistoryForHttpResponse( String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); - }// verify the required parameter 'expenseClaimID' is set + public HttpResponse createExpenseClaimHistoryForHttpResponse( UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'expenseClaimID' is set if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); }// verify the required parameter 'historyRecords' is set @@ -1291,7 +1206,7 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse( String xeroTenantI throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; @@ -1319,28 +1234,24 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse( String xeroTenantI * Allows you to create any sales invoices or purchase bills *

200 - Success - return response of type Invoices array with newly created Invoice *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param invoices The invoices parameter * @param summarizeErrors shows validation errors for each invoice * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices createInvoice(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { - HttpResponse response = createInvoiceForHttpResponse(xeroTenantId, invoices, summarizeErrors); + public Invoices createInvoice(Invoices invoices, Boolean summarizeErrors) throws IOException { + HttpResponse response = createInvoiceForHttpResponse(invoices, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createInvoiceForHttpResponse( String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); - }// verify the required parameter 'invoices' is set + public HttpResponse createInvoiceForHttpResponse( Invoices invoices, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'invoices' is set if (invoices == null) { throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -1374,24 +1285,20 @@ public HttpResponse createInvoiceForHttpResponse( String xeroTenantId, Invoices * Allows you to create an Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of type Attachments array with newly created Attachment *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param fileName Name of the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { - HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); + public Attachments createInvoiceAttachmentByFileName(UUID invoiceID, String fileName, File body) throws IOException { + HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(invoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( UUID invoiceID, String fileName, File body) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -1402,7 +1309,7 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( String xer throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; @@ -1433,23 +1340,19 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( String xer * Allows you to retrieve a history records of an invoice *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Invoice *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, historyRecords); + public HistoryRecords createInvoiceHistory(UUID invoiceID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createInvoiceHistoryForHttpResponse(invoiceID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createInvoiceHistoryForHttpResponse( String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse createInvoiceHistoryForHttpResponse( UUID invoiceID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); }// verify the required parameter 'historyRecords' is set @@ -1457,7 +1360,7 @@ public HttpResponse createInvoiceHistoryForHttpResponse( String xeroTenantId, U throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}/History"; @@ -1485,27 +1388,23 @@ public HttpResponse createInvoiceHistoryForHttpResponse( String xeroTenantId, U * Allows you to create an item *

200 - Success - return response of type Items array with newly created Item *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param items The items parameter * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items createItem(String xeroTenantId, Items items) throws IOException { - HttpResponse response = createItemForHttpResponse(xeroTenantId, items); + public Items createItem(Items items) throws IOException { + HttpResponse response = createItemForHttpResponse(items); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createItemForHttpResponse( String xeroTenantId, Items items) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); - }// verify the required parameter 'items' is set + public HttpResponse createItemForHttpResponse( Items items) throws IOException { + // verify the required parameter 'items' is set if (items == null) { throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Items"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -1527,23 +1426,19 @@ public HttpResponse createItemForHttpResponse( String xeroTenantId, Items items /** * Allows you to create a history record for items *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items - * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createItemHistoryForHttpResponse(xeroTenantId, itemID, historyRecords); + public HistoryRecords createItemHistory(UUID itemID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createItemHistoryForHttpResponse(itemID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createItemHistoryForHttpResponse( String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); - }// verify the required parameter 'itemID' is set + public HttpResponse createItemHistoryForHttpResponse( UUID itemID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'itemID' is set if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); }// verify the required parameter 'historyRecords' is set @@ -1551,7 +1446,7 @@ public HttpResponse createItemHistoryForHttpResponse( String xeroTenantId, UUID throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Items/{ItemID}/History"; @@ -1579,27 +1474,23 @@ public HttpResponse createItemHistoryForHttpResponse( String xeroTenantId, UUID * Allows you to create linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactions The linkedTransactions parameter * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { - HttpResponse response = createLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactions); + public LinkedTransactions createLinkedTransaction(LinkedTransactions linkedTransactions) throws IOException { + HttpResponse response = createLinkedTransactionForHttpResponse(linkedTransactions); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createLinkedTransactionForHttpResponse( String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); - }// verify the required parameter 'linkedTransactions' is set + public HttpResponse createLinkedTransactionForHttpResponse( LinkedTransactions linkedTransactions) throws IOException { + // verify the required parameter 'linkedTransactions' is set if (linkedTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/LinkedTransactions"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -1622,27 +1513,23 @@ public HttpResponse createLinkedTransactionForHttpResponse( String xeroTenantId, * Allows you to create a manual journal *

200 - Success - return response of type ManualJournals array with newly created ManualJournal *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param manualJournals The manualJournals parameter * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals) throws IOException { - HttpResponse response = createManualJournalForHttpResponse(xeroTenantId, manualJournals); + public ManualJournals createManualJournal(ManualJournals manualJournals) throws IOException { + HttpResponse response = createManualJournalForHttpResponse(manualJournals); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createManualJournalForHttpResponse( String xeroTenantId, ManualJournals manualJournals) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); - }// verify the required parameter 'manualJournals' is set + public HttpResponse createManualJournalForHttpResponse( ManualJournals manualJournals) throws IOException { + // verify the required parameter 'manualJournals' is set if (manualJournals == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ManualJournals"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -1665,24 +1552,20 @@ public HttpResponse createManualJournalForHttpResponse( String xeroTenantId, Ma * Allows you to create a specified Attachment on ManualJournal by file name *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param fileName The name of the file being attached to a ManualJournal * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { - HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); + public Attachments createManualJournalAttachmentByFileName(UUID manualJournalID, String fileName, File body) throws IOException { + HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(manualJournalID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set + public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( UUID manualJournalID, String fileName, File body) throws IOException { + // verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -1693,7 +1576,7 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( Stri throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; @@ -1724,23 +1607,19 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( Stri * Allows you to retrieve Allocations for overpayments *

200 - Success - return response of type Allocations array with all Allocation for Overpayments *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment * @param allocations The allocations parameter * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { - HttpResponse response = createOverpaymentAllocationForHttpResponse(xeroTenantId, overpaymentID, allocations); + public Allocations createOverpaymentAllocation(UUID overpaymentID, Allocations allocations) throws IOException { + HttpResponse response = createOverpaymentAllocationForHttpResponse(overpaymentID, allocations); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createOverpaymentAllocationForHttpResponse( String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); - }// verify the required parameter 'overpaymentID' is set + public HttpResponse createOverpaymentAllocationForHttpResponse( UUID overpaymentID, Allocations allocations) throws IOException { + // verify the required parameter 'overpaymentID' is set if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); }// verify the required parameter 'allocations' is set @@ -1748,7 +1627,7 @@ public HttpResponse createOverpaymentAllocationForHttpResponse( String xeroTenan throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Overpayments/{OverpaymentID}/Allocations"; @@ -1776,23 +1655,19 @@ public HttpResponse createOverpaymentAllocationForHttpResponse( String xeroTenan * Allows you to create history records of an Overpayment *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Overpayments *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Overpayments - * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, historyRecords); + public HistoryRecords createOverpaymentHistory(UUID overpaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createOverpaymentHistoryForHttpResponse(overpaymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createOverpaymentHistoryForHttpResponse( String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); - }// verify the required parameter 'overpaymentID' is set + public HttpResponse createOverpaymentHistoryForHttpResponse( UUID overpaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'overpaymentID' is set if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); }// verify the required parameter 'historyRecords' is set @@ -1800,7 +1675,7 @@ public HttpResponse createOverpaymentHistoryForHttpResponse( String xeroTenantId throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Overpayments/{OverpaymentID}/History"; @@ -1828,27 +1703,23 @@ public HttpResponse createOverpaymentHistoryForHttpResponse( String xeroTenantId * Allows you to create payments for invoices and credit notes *

200 - Success - return response of type Payments array for newly created Payment *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param payments The payments parameter * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments createPayment(String xeroTenantId, Payments payments) throws IOException { - HttpResponse response = createPaymentForHttpResponse(xeroTenantId, payments); + public Payments createPayment(Payments payments) throws IOException { + HttpResponse response = createPaymentForHttpResponse(payments); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPaymentForHttpResponse( String xeroTenantId, Payments payments) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); - }// verify the required parameter 'payments' is set + public HttpResponse createPaymentForHttpResponse( Payments payments) throws IOException { + // verify the required parameter 'payments' is set if (payments == null) { throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Payments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -1871,23 +1742,19 @@ public HttpResponse createPaymentForHttpResponse( String xeroTenantId, Payments * Allows you to create a history record for a payment *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Payments - * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createPaymentHistoryForHttpResponse(xeroTenantId, paymentID, historyRecords); + public HistoryRecords createPaymentHistory(UUID paymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPaymentHistoryForHttpResponse(paymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPaymentHistoryForHttpResponse( String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); - }// verify the required parameter 'paymentID' is set + public HttpResponse createPaymentHistoryForHttpResponse( UUID paymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'paymentID' is set if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); }// verify the required parameter 'historyRecords' is set @@ -1895,7 +1762,7 @@ public HttpResponse createPaymentHistoryForHttpResponse( String xeroTenantId, U throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Payments/{PaymentID}/History"; @@ -1923,27 +1790,23 @@ public HttpResponse createPaymentHistoryForHttpResponse( String xeroTenantId, U * Allows you to create payment services *

200 - Success - return response of type PaymentServices array for newly created PaymentService *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param paymentServices The paymentServices parameter * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices) throws IOException { - HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices); + public PaymentServices createPaymentService(PaymentServices paymentServices) throws IOException { + HttpResponse response = createPaymentServiceForHttpResponse(paymentServices); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPaymentServiceForHttpResponse( String xeroTenantId, PaymentServices paymentServices) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); - }// verify the required parameter 'paymentServices' is set + public HttpResponse createPaymentServiceForHttpResponse( PaymentServices paymentServices) throws IOException { + // verify the required parameter 'paymentServices' is set if (paymentServices == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/PaymentServices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -1966,23 +1829,19 @@ public HttpResponse createPaymentServiceForHttpResponse( String xeroTenantId, P * Allows you to create an Allocation for prepayments *

200 - Success - return response of type Allocations array of Allocation for all Prepayment *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID The prepaymentID parameter * @param allocations The allocations parameter * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { - HttpResponse response = createPrepaymentAllocationForHttpResponse(xeroTenantId, prepaymentID, allocations); + public Allocations createPrepaymentAllocation(UUID prepaymentID, Allocations allocations) throws IOException { + HttpResponse response = createPrepaymentAllocationForHttpResponse(prepaymentID, allocations); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPrepaymentAllocationForHttpResponse( String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); - }// verify the required parameter 'prepaymentID' is set + public HttpResponse createPrepaymentAllocationForHttpResponse( UUID prepaymentID, Allocations allocations) throws IOException { + // verify the required parameter 'prepaymentID' is set if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); }// verify the required parameter 'allocations' is set @@ -1990,7 +1849,7 @@ public HttpResponse createPrepaymentAllocationForHttpResponse( String xeroTenant throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Prepayments/{PrepaymentID}/Allocations"; @@ -2018,23 +1877,19 @@ public HttpResponse createPrepaymentAllocationForHttpResponse( String xeroTenant * Allows you to create a history record for an Prepayment *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PrePayment *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims - * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID Unique identifier for a PrePayment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, historyRecords); + public HistoryRecords createPrepaymentHistory(UUID prepaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPrepaymentHistoryForHttpResponse(prepaymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPrepaymentHistoryForHttpResponse( String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); - }// verify the required parameter 'prepaymentID' is set + public HttpResponse createPrepaymentHistoryForHttpResponse( UUID prepaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'prepaymentID' is set if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); }// verify the required parameter 'historyRecords' is set @@ -2042,7 +1897,7 @@ public HttpResponse createPrepaymentHistoryForHttpResponse( String xeroTenantId, throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Prepayments/{PrepaymentID}/History"; @@ -2070,28 +1925,24 @@ public HttpResponse createPrepaymentHistoryForHttpResponse( String xeroTenantId, * Allows you to create purchase orders *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrders The purchaseOrders parameter * @param summarizeErrors shows validation errors for each purchase order. * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { - HttpResponse response = createPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrders, summarizeErrors); + public PurchaseOrders createPurchaseOrder(PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + HttpResponse response = createPurchaseOrderForHttpResponse(purchaseOrders, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPurchaseOrderForHttpResponse( String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set + public HttpResponse createPurchaseOrderForHttpResponse( PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'purchaseOrders' is set if (purchaseOrders == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/PurchaseOrders"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -2125,23 +1976,19 @@ public HttpResponse createPurchaseOrderForHttpResponse( String xeroTenantId, Pu * Allows you to create HistoryRecord for purchase orders *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PurchaseOrder *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, historyRecords); + public HistoryRecords createPurchaseOrderHistory(UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPurchaseOrderHistoryForHttpResponse(purchaseOrderID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPurchaseOrderHistoryForHttpResponse( String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); - }// verify the required parameter 'purchaseOrderID' is set + public HttpResponse createPurchaseOrderHistoryForHttpResponse( UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'purchaseOrderID' is set if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); }// verify the required parameter 'historyRecords' is set @@ -2149,7 +1996,7 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse( String xeroTenant throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; @@ -2177,27 +2024,23 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse( String xeroTenant * Allows you to create draft expense claim receipts for any user *

200 - Success - return response of type Receipts array for newly created Receipt *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param receipts The receipts parameter * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts createReceipt(String xeroTenantId, Receipts receipts) throws IOException { - HttpResponse response = createReceiptForHttpResponse(xeroTenantId, receipts); + public Receipts createReceipt(Receipts receipts) throws IOException { + HttpResponse response = createReceiptForHttpResponse(receipts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createReceiptForHttpResponse( String xeroTenantId, Receipts receipts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); - }// verify the required parameter 'receipts' is set + public HttpResponse createReceiptForHttpResponse( Receipts receipts) throws IOException { + // verify the required parameter 'receipts' is set if (receipts == null) { throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Receipts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -2220,24 +2063,20 @@ public HttpResponse createReceiptForHttpResponse( String xeroTenantId, Receipts * Allows you to create Attachment on expense claim receipts by file name *

200 - Success - return response of type Attachments array with newly created Attachment for a specified Receipt *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param fileName The name of the file being attached to the Receipt * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { - HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); + public Attachments createReceiptAttachmentByFileName(UUID receiptID, String fileName, File body) throws IOException { + HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(receiptID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set + public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( UUID receiptID, String fileName, File body) throws IOException { + // verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -2248,7 +2087,7 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( String xer throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; @@ -2279,23 +2118,19 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( String xer * Allows you to retrieve a history records of an Receipt *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts - * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createReceiptHistoryForHttpResponse(xeroTenantId, receiptID, historyRecords); + public HistoryRecords createReceiptHistory(UUID receiptID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createReceiptHistoryForHttpResponse(receiptID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createReceiptHistoryForHttpResponse( String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); - }// verify the required parameter 'receiptID' is set + public HttpResponse createReceiptHistoryForHttpResponse( UUID receiptID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); }// verify the required parameter 'historyRecords' is set @@ -2303,7 +2138,7 @@ public HttpResponse createReceiptHistoryForHttpResponse( String xeroTenantId, U throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Receipts/{ReceiptID}/History"; @@ -2331,24 +2166,20 @@ public HttpResponse createReceiptHistoryForHttpResponse( String xeroTenantId, U * Allows you to create attachment on repeating invoices by file name *

200 - Success - return response of type Attachments array with updated Attachment for a specified Repeating Invoice *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param fileName The name of the file being attached to a Repeating Invoice * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { - HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); + public Attachments createRepeatingInvoiceAttachmentByFileName(UUID repeatingInvoiceID, String fileName, File body) throws IOException { + HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(repeatingInvoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( UUID repeatingInvoiceID, String fileName, File body) throws IOException { + // verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -2359,7 +2190,7 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( S throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; @@ -2390,23 +2221,19 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( S * Allows you to create history for a repeating invoice *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords); + public HistoryRecords createRepeatingInvoiceHistory(UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(repeatingInvoiceID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); - }// verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); }// verify the required parameter 'historyRecords' is set @@ -2414,7 +2241,7 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( String xeroTen throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; @@ -2442,27 +2269,23 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( String xeroTen * Allows you to create Tax Rates *

200 - Success - return response of type TaxRates array newly created TaxRate *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param taxRates The taxRates parameter * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { - HttpResponse response = createTaxRateForHttpResponse(xeroTenantId, taxRates); + public TaxRates createTaxRate(TaxRates taxRates) throws IOException { + HttpResponse response = createTaxRateForHttpResponse(taxRates); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createTaxRateForHttpResponse( String xeroTenantId, TaxRates taxRates) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); - }// verify the required parameter 'taxRates' is set + public HttpResponse createTaxRateForHttpResponse( TaxRates taxRates) throws IOException { + // verify the required parameter 'taxRates' is set if (taxRates == null) { throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/TaxRates"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -2485,27 +2308,23 @@ public HttpResponse createTaxRateForHttpResponse( String xeroTenantId, TaxRates * Allows you to create tracking categories *

200 - Success - return response of type TrackingCategories array of newly created TrackingCategory *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param trackingCategory The trackingCategory parameter * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory) throws IOException { - HttpResponse response = createTrackingCategoryForHttpResponse(xeroTenantId, trackingCategory); + public TrackingCategories createTrackingCategory(TrackingCategory trackingCategory) throws IOException { + HttpResponse response = createTrackingCategoryForHttpResponse(trackingCategory); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createTrackingCategoryForHttpResponse( String xeroTenantId, TrackingCategory trackingCategory) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); - }// verify the required parameter 'trackingCategory' is set + public HttpResponse createTrackingCategoryForHttpResponse( TrackingCategory trackingCategory) throws IOException { + // verify the required parameter 'trackingCategory' is set if (trackingCategory == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/TrackingCategories"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -2528,23 +2347,19 @@ public HttpResponse createTrackingCategoryForHttpResponse( String xeroTenantId, * Allows you to create options for a specified tracking category *

200 - Success - return response of type TrackingOptions array of options for a specified category *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @param trackingOption The trackingOption parameter * @return TrackingOptions * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { - HttpResponse response = createTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOption); + public TrackingOptions createTrackingOptions(UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { + HttpResponse response = createTrackingOptionsForHttpResponse(trackingCategoryID, trackingOption); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createTrackingOptionsForHttpResponse( String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); - }// verify the required parameter 'trackingCategoryID' is set + public HttpResponse createTrackingOptionsForHttpResponse( UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { + // verify the required parameter 'trackingCategoryID' is set if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); }// verify the required parameter 'trackingOption' is set @@ -2552,7 +2367,7 @@ public HttpResponse createTrackingOptionsForHttpResponse( String xeroTenantId, throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options"; @@ -2580,27 +2395,23 @@ public HttpResponse createTrackingOptionsForHttpResponse( String xeroTenantId, * Allows you to delete a chart of accounts *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for retrieving single object * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws IOException { - HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID); + public Accounts deleteAccount(UUID accountID) throws IOException { + HttpResponse response = deleteAccountForHttpResponse(accountID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteAccountForHttpResponse( String xeroTenantId, UUID accountID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteAccount"); - }// verify the required parameter 'accountID' is set + public HttpResponse deleteAccountForHttpResponse( UUID accountID) throws IOException { + // verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Accounts/{AccountID}"; @@ -2626,20 +2437,16 @@ public HttpResponse deleteAccountForHttpResponse( String xeroTenantId, UUID acc * Allows you to delete a specific Contact from a Contract Group *

204 - Success - return response 204 no content *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group * @param contactID Unique identifier for a Contact * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { - deleteContactGroupContactForHttpResponse(xeroTenantId, contactGroupID, contactID); + public void deleteContactGroupContact(UUID contactGroupID, UUID contactID) throws IOException { + deleteContactGroupContactForHttpResponse(contactGroupID, contactID); } - public HttpResponse deleteContactGroupContactForHttpResponse( String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); - }// verify the required parameter 'contactGroupID' is set + public HttpResponse deleteContactGroupContactForHttpResponse( UUID contactGroupID, UUID contactID) throws IOException { + // verify the required parameter 'contactGroupID' is set if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); }// verify the required parameter 'contactID' is set @@ -2647,7 +2454,7 @@ public HttpResponse deleteContactGroupContactForHttpResponse( String xeroTenantI throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; @@ -2673,24 +2480,20 @@ public HttpResponse deleteContactGroupContactForHttpResponse( String xeroTenantI /** * Allows you to delete all Contacts from a Contract Group *

200 - Success - return response 204 no content - * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID) throws IOException { - deleteContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID); + public void deleteContactGroupContacts(UUID contactGroupID) throws IOException { + deleteContactGroupContactsForHttpResponse(contactGroupID); } - public HttpResponse deleteContactGroupContactsForHttpResponse( String xeroTenantId, UUID contactGroupID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); - }// verify the required parameter 'contactGroupID' is set + public HttpResponse deleteContactGroupContactsForHttpResponse( UUID contactGroupID) throws IOException { + // verify the required parameter 'contactGroupID' is set if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; @@ -2716,24 +2519,20 @@ public HttpResponse deleteContactGroupContactsForHttpResponse( String xeroTenant * Allows you to delete a specified item *

204 - Success - return response 204 no content *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteItem(String xeroTenantId, UUID itemID) throws IOException { - deleteItemForHttpResponse(xeroTenantId, itemID); + public void deleteItem(UUID itemID) throws IOException { + deleteItemForHttpResponse(itemID); } - public HttpResponse deleteItemForHttpResponse( String xeroTenantId, UUID itemID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteItem"); - }// verify the required parameter 'itemID' is set + public HttpResponse deleteItemForHttpResponse( UUID itemID) throws IOException { + // verify the required parameter 'itemID' is set if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Items/{ItemID}"; @@ -2759,24 +2558,20 @@ public HttpResponse deleteItemForHttpResponse( String xeroTenantId, UUID itemID * Allows you to delete a specified linked transactions (billable expenses) *

204 - Success - return response 204 no content *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactionID Unique identifier for a LinkedTransaction * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { - deleteLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); + public void deleteLinkedTransaction(UUID linkedTransactionID) throws IOException { + deleteLinkedTransactionForHttpResponse(linkedTransactionID); } - public HttpResponse deleteLinkedTransactionForHttpResponse( String xeroTenantId, UUID linkedTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set + public HttpResponse deleteLinkedTransactionForHttpResponse( UUID linkedTransactionID) throws IOException { + // verify the required parameter 'linkedTransactionID' is set if (linkedTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; @@ -2802,23 +2597,19 @@ public HttpResponse deleteLinkedTransactionForHttpResponse( String xeroTenantId, * Allows you to update a specified payment for invoices and credit notes *

200 - Success - return response of type Payments array for updated Payment *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment * @param payments The payments parameter * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { - HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments); + public Payments deletePayment(UUID paymentID, Payments payments) throws IOException { + HttpResponse response = deletePaymentForHttpResponse(paymentID, payments); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deletePaymentForHttpResponse( String xeroTenantId, UUID paymentID, Payments payments) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); - }// verify the required parameter 'paymentID' is set + public HttpResponse deletePaymentForHttpResponse( UUID paymentID, Payments payments) throws IOException { + // verify the required parameter 'paymentID' is set if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); }// verify the required parameter 'payments' is set @@ -2826,7 +2617,7 @@ public HttpResponse deletePaymentForHttpResponse( String xeroTenantId, UUID pay throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Payments/{PaymentID}"; @@ -2854,27 +2645,23 @@ public HttpResponse deletePaymentForHttpResponse( String xeroTenantId, UUID pay * Allows you to delete tracking categories *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { - HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); + public TrackingCategories deleteTrackingCategory(UUID trackingCategoryID) throws IOException { + HttpResponse response = deleteTrackingCategoryForHttpResponse(trackingCategoryID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteTrackingCategoryForHttpResponse( String xeroTenantId, UUID trackingCategoryID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set + public HttpResponse deleteTrackingCategoryForHttpResponse( UUID trackingCategoryID) throws IOException { + // verify the required parameter 'trackingCategoryID' is set if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/TrackingCategories/{TrackingCategoryID}"; @@ -2900,23 +2687,19 @@ public HttpResponse deleteTrackingCategoryForHttpResponse( String xeroTenantId, * Allows you to delete a specified option for a specified tracking category *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @param trackingOptionID Unique identifier for a Tracking Option * @return TrackingOptions * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { - HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID); + public TrackingOptions deleteTrackingOptions(UUID trackingCategoryID, UUID trackingOptionID) throws IOException { + HttpResponse response = deleteTrackingOptionsForHttpResponse(trackingCategoryID, trackingOptionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteTrackingOptionsForHttpResponse( String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); - }// verify the required parameter 'trackingCategoryID' is set + public HttpResponse deleteTrackingOptionsForHttpResponse( UUID trackingCategoryID, UUID trackingOptionID) throws IOException { + // verify the required parameter 'trackingCategoryID' is set if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); }// verify the required parameter 'trackingOptionID' is set @@ -2924,7 +2707,7 @@ public HttpResponse deleteTrackingOptionsForHttpResponse( String xeroTenantId, throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; @@ -2951,20 +2734,16 @@ public HttpResponse deleteTrackingOptionsForHttpResponse( String xeroTenantId, * Allows you to email a copy of invoice to related Contact *

204 - Success - return response 204 no content *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param requestEmpty The requestEmpty parameter * @throws IOException if an error occurs while attempting to invoke the API **/ - public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { - emailInvoiceForHttpResponse(xeroTenantId, invoiceID, requestEmpty); + public void emailInvoice(UUID invoiceID, RequestEmpty requestEmpty) throws IOException { + emailInvoiceForHttpResponse(invoiceID, requestEmpty); } - public HttpResponse emailInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse emailInvoiceForHttpResponse( UUID invoiceID, RequestEmpty requestEmpty) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); }// verify the required parameter 'requestEmpty' is set @@ -2972,7 +2751,7 @@ public HttpResponse emailInvoiceForHttpResponse( String xeroTenantId, UUID invo throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}/Email"; @@ -2999,27 +2778,23 @@ public HttpResponse emailInvoiceForHttpResponse( String xeroTenantId, UUID invo /** * Allows you to retrieve a single chart of accounts *

200 - Success - return response of type Accounts array with one Account - * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for retrieving single object * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccount(String xeroTenantId, UUID accountID) throws IOException { - HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID); + public Accounts getAccount(UUID accountID) throws IOException { + HttpResponse response = getAccountForHttpResponse(accountID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getAccountForHttpResponse( String xeroTenantId, UUID accountID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccount"); - }// verify the required parameter 'accountID' is set + public HttpResponse getAccountForHttpResponse( UUID accountID) throws IOException { + // verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Accounts/{AccountID}"; @@ -3044,25 +2819,21 @@ public HttpResponse getAccountForHttpResponse( String xeroTenantId, UUID accoun /** * Allows you to retrieve Attachment on Account by Filename *

200 - Success - return response of attachment for Account as binary data - * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param fileName Name of the attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { - HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType); + public ByteArrayInputStream getAccountAttachmentByFileName(UUID accountID, String fileName, String contentType) throws IOException { + HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(accountID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getAccountAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set + public HttpResponse getAccountAttachmentByFileNameForHttpResponse( UUID accountID, String fileName, String contentType) throws IOException { + // verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -3073,7 +2844,7 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse( String xeroTe throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; @@ -3106,25 +2877,21 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse( String xeroTe /** * Allows you to retrieve specific Attachment on Account *

200 - Success - return response of attachment for Account as binary data - * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param attachmentID Unique identifier for Attachment object * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType); + public ByteArrayInputStream getAccountAttachmentById(UUID accountID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getAccountAttachmentByIdForHttpResponse(accountID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getAccountAttachmentByIdForHttpResponse( String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); - }// verify the required parameter 'accountID' is set + public HttpResponse getAccountAttachmentByIdForHttpResponse( UUID accountID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -3135,7 +2902,7 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse( String xeroTenantId throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; @@ -3168,27 +2935,23 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse( String xeroTenantId /** * Allows you to retrieve Attachments for accounts *

200 - Success - return response of type Attachments array of Attachment - * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) throws IOException { - HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID); + public Attachments getAccountAttachments(UUID accountID) throws IOException { + HttpResponse response = getAccountAttachmentsForHttpResponse(accountID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getAccountAttachmentsForHttpResponse( String xeroTenantId, UUID accountID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); - }// verify the required parameter 'accountID' is set + public HttpResponse getAccountAttachmentsForHttpResponse( UUID accountID) throws IOException { + // verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Accounts/{AccountID}/Attachments"; @@ -3213,26 +2976,22 @@ public HttpResponse getAccountAttachmentsForHttpResponse( String xeroTenantId, /** * Allows you to retrieve the full chart of accounts *

200 - Success - return response of type Accounts array with 0 to n Account - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getAccountsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + public Accounts getAccounts(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getAccountsForHttpResponse(ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getAccountsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); - } + public HttpResponse getAccountsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Accounts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -3273,27 +3032,23 @@ public HttpResponse getAccountsForHttpResponse( String xeroTenantId, OffsetDate /** * Allows you to retrieve a single spend or receive money transaction *

200 - Success - return response of type BankTransactions array with a specific BankTransaction - * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID); + public BankTransactions getBankTransaction(UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionForHttpResponse(bankTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionForHttpResponse( String xeroTenantId, UUID bankTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set + public HttpResponse getBankTransactionForHttpResponse( UUID bankTransactionID) throws IOException { + // verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransactions/{BankTransactionID}"; @@ -3318,25 +3073,21 @@ public HttpResponse getBankTransactionForHttpResponse( String xeroTenantId, UUI /** * Allows you to retrieve Attachments on BankTransaction by Filename *

200 - Success - return response of attachment for BankTransaction as binary data - * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param fileName The name of the file being attached * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { - HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType); + public ByteArrayInputStream getBankTransactionAttachmentByFileName(UUID bankTransactionID, String fileName, String contentType) throws IOException { + HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(bankTransactionID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set + public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( UUID bankTransactionID, String fileName, String contentType) throws IOException { + // verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -3347,7 +3098,7 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( Strin throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; @@ -3380,25 +3131,21 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( Strin /** * Allows you to retrieve Attachments on a specific BankTransaction *

200 - Success - return response of attachment for BankTransaction as binary data - * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param attachmentID Xero generated unique identifier for an attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType); + public ByteArrayInputStream getBankTransactionAttachmentById(UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(bankTransactionID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); - }// verify the required parameter 'bankTransactionID' is set + public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -3409,7 +3156,7 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( String xero throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; @@ -3442,27 +3189,23 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( String xero /** * Allows you to retrieve any attachments to bank transactions *

200 - Success - return response of type Attachments array with 0 to n Attachment - * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID); + public Attachments getBankTransactionAttachments(UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionAttachmentsForHttpResponse(bankTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionAttachmentsForHttpResponse( String xeroTenantId, UUID bankTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); - }// verify the required parameter 'bankTransactionID' is set + public HttpResponse getBankTransactionAttachmentsForHttpResponse( UUID bankTransactionID) throws IOException { + // verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransactions/{BankTransactionID}/Attachments"; @@ -3487,7 +3230,6 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse( String xeroTen /** * Allows you to retrieve any spend or receive money transactions *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -3496,19 +3238,16 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse( String xeroTen * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + public BankTransactions getBankTransactions(OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getBankTransactionsForHttpResponse(ifModifiedSince, where, order, page, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); - } + public HttpResponse getBankTransactionsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransactions"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -3569,27 +3308,23 @@ public HttpResponse getBankTransactionsForHttpResponse( String xeroTenantId, Of /** * Allows you to retrieve history from a bank transactions *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord - * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID); + public HistoryRecords getBankTransactionsHistory(UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionsHistoryForHttpResponse(bankTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionsHistoryForHttpResponse( String xeroTenantId, UUID bankTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); - }// verify the required parameter 'bankTransactionID' is set + public HttpResponse getBankTransactionsHistoryForHttpResponse( UUID bankTransactionID) throws IOException { + // verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransactions/{BankTransactionID}/History"; @@ -3614,27 +3349,23 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse( String xeroTenant /** * Allows you to retrieve any bank transfers *

200 - Success - return response of BankTransfers array with one BankTransfer - * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID); + public BankTransfers getBankTransfer(UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferForHttpResponse(bankTransferID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransferForHttpResponse( String xeroTenantId, UUID bankTransferID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); - }// verify the required parameter 'bankTransferID' is set + public HttpResponse getBankTransferForHttpResponse( UUID bankTransferID) throws IOException { + // verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransfers/{BankTransferID}"; @@ -3659,25 +3390,21 @@ public HttpResponse getBankTransferForHttpResponse( String xeroTenantId, UUID b /** * Allows you to retrieve Attachments on BankTransfer by file name *

200 - Success - return response of binary data from the Attachment to a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param fileName The name of the file being attached to a Bank Transfer * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { - HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType); + public ByteArrayInputStream getBankTransferAttachmentByFileName(UUID bankTransferID, String fileName, String contentType) throws IOException { + HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(bankTransferID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set + public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( UUID bankTransferID, String fileName, String contentType) throws IOException { + // verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -3688,7 +3415,7 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( String x throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; @@ -3721,25 +3448,21 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( String x /** * Allows you to retrieve Attachments on BankTransfer *

200 - Success - return response of binary data from the Attachment to a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType); + public ByteArrayInputStream getBankTransferAttachmentById(UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(bankTransferID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getBankTransferAttachmentByIdForHttpResponse( String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); - }// verify the required parameter 'bankTransferID' is set + public HttpResponse getBankTransferAttachmentByIdForHttpResponse( UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -3750,7 +3473,7 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse( String xeroTen throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; @@ -3783,27 +3506,23 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse( String xeroTen /** * Allows you to retrieve Attachments from bank transfers *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID); + public Attachments getBankTransferAttachments(UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferAttachmentsForHttpResponse(bankTransferID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransferAttachmentsForHttpResponse( String xeroTenantId, UUID bankTransferID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); - }// verify the required parameter 'bankTransferID' is set + public HttpResponse getBankTransferAttachmentsForHttpResponse( UUID bankTransferID) throws IOException { + // verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransfers/{BankTransferID}/Attachments"; @@ -3828,27 +3547,23 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse( String xeroTenant /** * Allows you to retrieve history from a bank transfers *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer - * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID); + public HistoryRecords getBankTransferHistory(UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferHistoryForHttpResponse(bankTransferID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransferHistoryForHttpResponse( String xeroTenantId, UUID bankTransferID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); - }// verify the required parameter 'bankTransferID' is set + public HttpResponse getBankTransferHistoryForHttpResponse( UUID bankTransferID) throws IOException { + // verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransfers/{BankTransferID}/History"; @@ -3873,26 +3588,22 @@ public HttpResponse getBankTransferHistoryForHttpResponse( String xeroTenantId, /** * Allows you to retrieve all bank transfers *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + public BankTransfers getBankTransfers(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getBankTransfersForHttpResponse(ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransfersForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); - } + public HttpResponse getBankTransfersForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransfers"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -3933,27 +3644,23 @@ public HttpResponse getBankTransfersForHttpResponse( String xeroTenantId, Offse /** * Allows you to retrieve history from a Batch Payment *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * @param xeroTenantId Xero identifier for Tenant * @param batchPaymentID Unique identifier for BatchPayment * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID) throws IOException { - HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID); + public HistoryRecords getBatchPaymentHistory(UUID batchPaymentID) throws IOException { + HttpResponse response = getBatchPaymentHistoryForHttpResponse(batchPaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBatchPaymentHistoryForHttpResponse( String xeroTenantId, UUID batchPaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); - }// verify the required parameter 'batchPaymentID' is set + public HttpResponse getBatchPaymentHistoryForHttpResponse( UUID batchPaymentID) throws IOException { + // verify the required parameter 'batchPaymentID' is set if (batchPaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BatchPayments/{BatchPaymentID}/History"; @@ -3978,26 +3685,22 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse( String xeroTenantId, /** * Retrieve either one or many BatchPayments for invoices *

200 - Success - return response of type BatchPayments array of BatchPayment objects - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + public BatchPayments getBatchPayments(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getBatchPaymentsForHttpResponse(ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBatchPaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); - } + public HttpResponse getBatchPaymentsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BatchPayments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -4038,27 +3741,23 @@ public HttpResponse getBatchPaymentsForHttpResponse( String xeroTenantId, Offse /** * Allows you to retrieve a specific BrandingThemes *

200 - Success - return response of type BrandingThemes with one BrandingTheme - * @param xeroTenantId Xero identifier for Tenant * @param brandingThemeID Unique identifier for a Branding Theme * @return BrandingThemes * @throws IOException if an error occurs while attempting to invoke the API **/ - public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID) throws IOException { - HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID); + public BrandingThemes getBrandingTheme(UUID brandingThemeID) throws IOException { + HttpResponse response = getBrandingThemeForHttpResponse(brandingThemeID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBrandingThemeForHttpResponse( String xeroTenantId, UUID brandingThemeID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); - }// verify the required parameter 'brandingThemeID' is set + public HttpResponse getBrandingThemeForHttpResponse( UUID brandingThemeID) throws IOException { + // verify the required parameter 'brandingThemeID' is set if (brandingThemeID == null) { throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BrandingThemes/{BrandingThemeID}"; @@ -4083,27 +3782,23 @@ public HttpResponse getBrandingThemeForHttpResponse( String xeroTenantId, UUID /** * Allows you to retrieve the Payment services for a Branding Theme *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService - * @param xeroTenantId Xero identifier for Tenant * @param brandingThemeID Unique identifier for a Branding Theme * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID) throws IOException { - HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID); + public PaymentServices getBrandingThemePaymentServices(UUID brandingThemeID) throws IOException { + HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(brandingThemeID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBrandingThemePaymentServicesForHttpResponse( String xeroTenantId, UUID brandingThemeID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); - }// verify the required parameter 'brandingThemeID' is set + public HttpResponse getBrandingThemePaymentServicesForHttpResponse( UUID brandingThemeID) throws IOException { + // verify the required parameter 'brandingThemeID' is set if (brandingThemeID == null) { throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; @@ -4128,23 +3823,19 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse( String xeroT /** * Allows you to retrieve all the BrandingThemes *

200 - Success - return response of type BrandingThemes - * @param xeroTenantId Xero identifier for Tenant * @return BrandingThemes * @throws IOException if an error occurs while attempting to invoke the API **/ - public BrandingThemes getBrandingThemes(String xeroTenantId) throws IOException { - HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId); + public BrandingThemes getBrandingThemes() throws IOException { + HttpResponse response = getBrandingThemesForHttpResponse(); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBrandingThemesForHttpResponse( String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); - } + public HttpResponse getBrandingThemesForHttpResponse() throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BrandingThemes"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -4164,27 +3855,23 @@ public HttpResponse getBrandingThemesForHttpResponse( String xeroTenantId) throw /** * Allows you to retrieve, add and update contacts in a Xero organisation *

200 - Success - return response of type Contacts array with a unique Contact - * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContact(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID); + public Contacts getContact(UUID contactID) throws IOException { + HttpResponse response = getContactForHttpResponse(contactID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContact"); - }// verify the required parameter 'contactID' is set + public HttpResponse getContactForHttpResponse( UUID contactID) throws IOException { + // verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts/{ContactID}"; @@ -4209,25 +3896,21 @@ public HttpResponse getContactForHttpResponse( String xeroTenantId, UUID contac /** * Allows you to retrieve Attachments on Contacts by file name *

200 - Success - return response of attachment for Contact as binary data - * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param fileName Name for the file you are attaching * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { - HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType); + public ByteArrayInputStream getContactAttachmentByFileName(UUID contactID, String fileName, String contentType) throws IOException { + HttpResponse response = getContactAttachmentByFileNameForHttpResponse(contactID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getContactAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set + public HttpResponse getContactAttachmentByFileNameForHttpResponse( UUID contactID, String fileName, String contentType) throws IOException { + // verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -4238,7 +3921,7 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse( String xeroTe throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; @@ -4271,25 +3954,21 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse( String xeroTe /** * Allows you to retrieve Attachments on Contacts *

200 - Success - return response of attachment for Contact as binary data - * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType); + public ByteArrayInputStream getContactAttachmentById(UUID contactID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getContactAttachmentByIdForHttpResponse(contactID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getContactAttachmentByIdForHttpResponse( String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); - }// verify the required parameter 'contactID' is set + public HttpResponse getContactAttachmentByIdForHttpResponse( UUID contactID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -4300,7 +3979,7 @@ public HttpResponse getContactAttachmentByIdForHttpResponse( String xeroTenantId throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; @@ -4333,27 +4012,23 @@ public HttpResponse getContactAttachmentByIdForHttpResponse( String xeroTenantId /** * Allows you to retrieve, add and update contacts in a Xero organisation *

200 - Success - return response of type Attachments array with 0 to N Attachment - * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getContactAttachments(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID); + public Attachments getContactAttachments(UUID contactID) throws IOException { + HttpResponse response = getContactAttachmentsForHttpResponse(contactID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactAttachmentsForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); - }// verify the required parameter 'contactID' is set + public HttpResponse getContactAttachmentsForHttpResponse( UUID contactID) throws IOException { + // verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts/{ContactID}/Attachments"; @@ -4378,27 +4053,23 @@ public HttpResponse getContactAttachmentsForHttpResponse( String xeroTenantId, /** * Allows you to retrieve CISSettings for a contact in a Xero organisation *

200 - Success - return response of type CISSettings for a specific Contact - * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @return CISSettings * @throws IOException if an error occurs while attempting to invoke the API **/ - public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID); + public CISSettings getContactCISSettings(UUID contactID) throws IOException { + HttpResponse response = getContactCISSettingsForHttpResponse(contactID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactCISSettingsForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); - }// verify the required parameter 'contactID' is set + public HttpResponse getContactCISSettingsForHttpResponse( UUID contactID) throws IOException { + // verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts/{ContactID}/CISSettings"; @@ -4423,27 +4094,23 @@ public HttpResponse getContactCISSettingsForHttpResponse( String xeroTenantId, /** * Allows you to retrieve a unique Contract Group by ID *

200 - Success - return response of type Contact Groups array with a specific Contact Group - * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) throws IOException { - HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID); + public ContactGroups getContactGroup(UUID contactGroupID) throws IOException { + HttpResponse response = getContactGroupForHttpResponse(contactGroupID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactGroupForHttpResponse( String xeroTenantId, UUID contactGroupID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroup"); - }// verify the required parameter 'contactGroupID' is set + public HttpResponse getContactGroupForHttpResponse( UUID contactGroupID) throws IOException { + // verify the required parameter 'contactGroupID' is set if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ContactGroups/{ContactGroupID}"; @@ -4468,25 +4135,21 @@ public HttpResponse getContactGroupForHttpResponse( String xeroTenantId, UUID c /** * Allows you to retrieve the ContactID and Name of all the contacts in a contact group *

200 - Success - return response of type Contact Groups array of Contact Group - * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroups(String xeroTenantId, String where, String order) throws IOException { - HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, where, order); + public ContactGroups getContactGroups(String where, String order) throws IOException { + HttpResponse response = getContactGroupsForHttpResponse(where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactGroupsForHttpResponse( String xeroTenantId, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); - } + public HttpResponse getContactGroupsForHttpResponse( String where, String order) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ContactGroups"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -4527,27 +4190,23 @@ public HttpResponse getContactGroupsForHttpResponse( String xeroTenantId, Strin /** * Allows you to retrieve a history records of an Contact *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact - * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID) throws IOException { - HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID); + public HistoryRecords getContactHistory(UUID contactID) throws IOException { + HttpResponse response = getContactHistoryForHttpResponse(contactID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactHistoryForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactHistory"); - }// verify the required parameter 'contactID' is set + public HttpResponse getContactHistoryForHttpResponse( UUID contactID) throws IOException { + // verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts/{ContactID}/History"; @@ -4572,7 +4231,6 @@ public HttpResponse getContactHistoryForHttpResponse( String xeroTenantId, UUID /** * Allows you to retrieve, add and update contacts in a Xero organisation *

200 - Success - return response of type Contacts array with 0 to N Contact - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -4582,19 +4240,16 @@ public HttpResponse getContactHistoryForHttpResponse( String xeroTenantId, UUID * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { - HttpResponse response = getContactsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, page, includeArchived); + public Contacts getContacts(OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + HttpResponse response = getContactsForHttpResponse(ifModifiedSince, where, order, ids, page, includeArchived); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); - } + public HttpResponse getContactsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -4665,27 +4320,23 @@ public HttpResponse getContactsForHttpResponse( String xeroTenantId, OffsetDate /** * Allows you to retrieve a specific credit note *

200 - Success - return response of type Credit Notes array with a unique CreditNote - * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID); + public CreditNotes getCreditNote(UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteForHttpResponse(creditNoteID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNoteForHttpResponse( String xeroTenantId, UUID creditNoteID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNote"); - }// verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteForHttpResponse( UUID creditNoteID) throws IOException { + // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes/{CreditNoteID}"; @@ -4710,24 +4361,20 @@ public HttpResponse getCreditNoteForHttpResponse( String xeroTenantId, UUID cre /** * Allows you to retrieve Credit Note as PDF files *

200 - Success - return response of binary data from the Attachment to a Credit Note - * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { - HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType); + public ByteArrayInputStream getCreditNoteAsPdf(UUID creditNoteID, String contentType) throws IOException { + HttpResponse response = getCreditNoteAsPdfForHttpResponse(creditNoteID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getCreditNoteAsPdfForHttpResponse( String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); - }// verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteAsPdfForHttpResponse( UUID creditNoteID, String contentType) throws IOException { + // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); }// verify the required parameter 'contentType' is set @@ -4735,7 +4382,7 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse( String xeroTenantId, UUI throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes/{CreditNoteID}/pdf"; @@ -4767,25 +4414,21 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse( String xeroTenantId, UUI /** * Allows you to retrieve Attachments on CreditNote by file name *

200 - Success - return response of attachment for Credit Note as binary data - * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param fileName Name of the file you are attaching to Credit Note * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { - HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType); + public ByteArrayInputStream getCreditNoteAttachmentByFileName(UUID creditNoteID, String fileName, String contentType) throws IOException { + HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(creditNoteID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( UUID creditNoteID, String fileName, String contentType) throws IOException { + // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -4796,7 +4439,7 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( String xer throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; @@ -4829,25 +4472,21 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( String xer /** * Allows you to retrieve Attachments on CreditNote *

200 - Success - return response of attachment for Credit Note as binary data - * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType); + public ByteArrayInputStream getCreditNoteAttachmentById(UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(creditNoteID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); - }// verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -4858,7 +4497,7 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( String xeroTenan throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; @@ -4891,27 +4530,23 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( String xeroTenan /** * Allows you to retrieve Attachments for credit notes *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note - * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID); + public Attachments getCreditNoteAttachments(UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteAttachmentsForHttpResponse(creditNoteID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNoteAttachmentsForHttpResponse( String xeroTenantId, UUID creditNoteID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); - }// verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteAttachmentsForHttpResponse( UUID creditNoteID) throws IOException { + // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes/{CreditNoteID}/Attachments"; @@ -4936,27 +4571,23 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse( String xeroTenantId /** * Allows you to retrieve a history records of an CreditNote *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note - * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID); + public HistoryRecords getCreditNoteHistory(UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteHistoryForHttpResponse(creditNoteID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNoteHistoryForHttpResponse( String xeroTenantId, UUID creditNoteID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); - }// verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteHistoryForHttpResponse( UUID creditNoteID) throws IOException { + // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes/{CreditNoteID}/History"; @@ -4981,7 +4612,6 @@ public HttpResponse getCreditNoteHistoryForHttpResponse( String xeroTenantId, U /** * Allows you to retrieve any credit notes *

200 - Success - return response of type Credit Notes array of CreditNote - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -4989,19 +4619,16 @@ public HttpResponse getCreditNoteHistoryForHttpResponse( String xeroTenantId, U * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); + public CreditNotes getCreditNotes(OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpResponse response = getCreditNotesForHttpResponse(ifModifiedSince, where, order, page); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNotesForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); - } + public HttpResponse getCreditNotesForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -5052,25 +4679,21 @@ public HttpResponse getCreditNotesForHttpResponse( String xeroTenantId, OffsetD /** * Allows you to retrieve currencies for your organisation *

200 - Success - return response of type Currencies array with all Currencies - * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @return Currencies * @throws IOException if an error occurs while attempting to invoke the API **/ - public Currencies getCurrencies(String xeroTenantId, String where, String order) throws IOException { - HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, where, order); + public Currencies getCurrencies(String where, String order) throws IOException { + HttpResponse response = getCurrenciesForHttpResponse(where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCurrenciesForHttpResponse( String xeroTenantId, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); - } + public HttpResponse getCurrenciesForHttpResponse( String where, String order) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Currencies"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -5111,27 +4734,23 @@ public HttpResponse getCurrenciesForHttpResponse( String xeroTenantId, String w /** * Allows you to retrieve a specific employee used in Xero payrun *

200 - Success - return response of type Employees array with specified Employee - * @param xeroTenantId Xero identifier for Tenant * @param employeeID Unique identifier for a Employee * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployee(String xeroTenantId, UUID employeeID) throws IOException { - HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID); + public Employees getEmployee(UUID employeeID) throws IOException { + HttpResponse response = getEmployeeForHttpResponse(employeeID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getEmployeeForHttpResponse( 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 + public HttpResponse getEmployeeForHttpResponse( UUID employeeID) throws IOException { + // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException("Missing the required parameter 'employeeID' when calling getEmployee"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Employees/{EmployeeID}"; @@ -5156,26 +4775,22 @@ public HttpResponse getEmployeeForHttpResponse( String xeroTenantId, UUID emplo /** * Allows you to retrieve employees used in Xero payrun *

200 - Success - return response of type Employees array with all Employee - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + public Employees getEmployees(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getEmployeesForHttpResponse(ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getEmployeesForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); - } + public HttpResponse getEmployeesForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Employees"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -5216,27 +4831,23 @@ public HttpResponse getEmployeesForHttpResponse( String xeroTenantId, OffsetDat /** * Allows you to retrieve a specified expense claim *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim - * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID) throws IOException { - HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID); + public ExpenseClaims getExpenseClaim(UUID expenseClaimID) throws IOException { + HttpResponse response = getExpenseClaimForHttpResponse(expenseClaimID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getExpenseClaimForHttpResponse( String xeroTenantId, UUID expenseClaimID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); - }// verify the required parameter 'expenseClaimID' is set + public HttpResponse getExpenseClaimForHttpResponse( UUID expenseClaimID) throws IOException { + // verify the required parameter 'expenseClaimID' is set if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; @@ -5261,27 +4872,23 @@ public HttpResponse getExpenseClaimForHttpResponse( String xeroTenantId, UUID e /** * Allows you to retrieve a history records of an ExpenseClaim *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim - * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID) throws IOException { - HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID); + public HistoryRecords getExpenseClaimHistory(UUID expenseClaimID) throws IOException { + HttpResponse response = getExpenseClaimHistoryForHttpResponse(expenseClaimID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getExpenseClaimHistoryForHttpResponse( String xeroTenantId, UUID expenseClaimID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); - }// verify the required parameter 'expenseClaimID' is set + public HttpResponse getExpenseClaimHistoryForHttpResponse( UUID expenseClaimID) throws IOException { + // verify the required parameter 'expenseClaimID' is set if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; @@ -5306,26 +4913,22 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse( String xeroTenantId, /** * Allows you to retrieve expense claims *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + public ExpenseClaims getExpenseClaims(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getExpenseClaimsForHttpResponse(ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getExpenseClaimsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); - } + public HttpResponse getExpenseClaimsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ExpenseClaims"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -5366,27 +4969,23 @@ public HttpResponse getExpenseClaimsForHttpResponse( String xeroTenantId, Offse /** * Allows you to retrieve a specified sales invoice or purchase bill *

200 - Success - return response of type Invoices array with specified Invoices - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices getInvoice(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID); + public Invoices getInvoice(UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceForHttpResponse(invoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoice"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceForHttpResponse( UUID invoiceID) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}"; @@ -5411,24 +5010,20 @@ public HttpResponse getInvoiceForHttpResponse( String xeroTenantId, UUID invoic /** * Allows you to retrieve invoices or purchase bills as PDF files *

200 - Success - return response of byte array pdf version of specified Invoices - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { - HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType); + public ByteArrayInputStream getInvoiceAsPdf(UUID invoiceID, String contentType) throws IOException { + HttpResponse response = getInvoiceAsPdfForHttpResponse(invoiceID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getInvoiceAsPdfForHttpResponse( String xeroTenantId, UUID invoiceID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceAsPdfForHttpResponse( UUID invoiceID, String contentType) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); }// verify the required parameter 'contentType' is set @@ -5436,7 +5031,7 @@ public HttpResponse getInvoiceAsPdfForHttpResponse( String xeroTenantId, UUID i throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}/pdf"; @@ -5468,25 +5063,21 @@ public HttpResponse getInvoiceAsPdfForHttpResponse( String xeroTenantId, UUID i /** * Allows you to retrieve Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of attachment for Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param fileName Name of the file you are attaching * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { - HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType); + public ByteArrayInputStream getInvoiceAttachmentByFileName(UUID invoiceID, String fileName, String contentType) throws IOException { + HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(invoiceID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( UUID invoiceID, String fileName, String contentType) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -5497,7 +5088,7 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( String xeroTe throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; @@ -5530,25 +5121,21 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( String xeroTe /** * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID *

200 - Success - return response of attachment for Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param attachmentID Unique identifier for an Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType); + public ByteArrayInputStream getInvoiceAttachmentById(UUID invoiceID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(invoiceID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getInvoiceAttachmentByIdForHttpResponse( String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceAttachmentByIdForHttpResponse( UUID invoiceID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -5559,7 +5146,7 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse( String xeroTenantId throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; @@ -5592,27 +5179,23 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse( String xeroTenantId /** * Allows you to retrieve Attachments on invoices or purchase bills *

200 - Success - return response of type Attachments array of Attachments for specified Invoices - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID); + public Attachments getInvoiceAttachments(UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceAttachmentsForHttpResponse(invoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getInvoiceAttachmentsForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceAttachmentsForHttpResponse( UUID invoiceID) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}/Attachments"; @@ -5637,27 +5220,23 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse( String xeroTenantId, /** * Allows you to retrieve a history records of an invoice *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID); + public HistoryRecords getInvoiceHistory(UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceHistoryForHttpResponse(invoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getInvoiceHistoryForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceHistoryForHttpResponse( UUID invoiceID) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}/History"; @@ -5682,23 +5261,19 @@ public HttpResponse getInvoiceHistoryForHttpResponse( String xeroTenantId, UUID /** * Allows you to retrieve invoice reminder settings *

200 - Success - return response of Invoice Reminders - * @param xeroTenantId Xero identifier for Tenant * @return InvoiceReminders * @throws IOException if an error occurs while attempting to invoke the API **/ - public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws IOException { - HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId); + public InvoiceReminders getInvoiceReminders() throws IOException { + HttpResponse response = getInvoiceRemindersForHttpResponse(); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getInvoiceRemindersForHttpResponse( String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); - } + public HttpResponse getInvoiceRemindersForHttpResponse() throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/InvoiceReminders/Settings"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -5718,7 +5293,6 @@ public HttpResponse getInvoiceRemindersForHttpResponse( String xeroTenantId) thr /** * Allows you to retrieve any sales invoices or purchase bills *

200 - Success - return response of type Invoices array with all Invoices - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -5733,19 +5307,16 @@ public HttpResponse getInvoiceRemindersForHttpResponse( String xeroTenantId) thr * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { - HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); + public Invoices getInvoices(OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + HttpResponse response = getInvoicesForHttpResponse(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getInvoicesForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); - } + public HttpResponse getInvoicesForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -5866,27 +5437,23 @@ public HttpResponse getInvoicesForHttpResponse( String xeroTenantId, OffsetDate /** * Allows you to retrieve a specified item *

200 - Success - return response of type Items array with specified Item - * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items getItem(String xeroTenantId, UUID itemID) throws IOException { - HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID); + public Items getItem(UUID itemID) throws IOException { + HttpResponse response = getItemForHttpResponse(itemID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getItemForHttpResponse( String xeroTenantId, UUID itemID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItem"); - }// verify the required parameter 'itemID' is set + public HttpResponse getItemForHttpResponse( UUID itemID) throws IOException { + // verify the required parameter 'itemID' is set if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Items/{ItemID}"; @@ -5911,27 +5478,23 @@ public HttpResponse getItemForHttpResponse( String xeroTenantId, UUID itemID) t /** * Allows you to retrieve history for items *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item - * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws IOException { - HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID); + public HistoryRecords getItemHistory(UUID itemID) throws IOException { + HttpResponse response = getItemHistoryForHttpResponse(itemID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getItemHistoryForHttpResponse( String xeroTenantId, UUID itemID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItemHistory"); - }// verify the required parameter 'itemID' is set + public HttpResponse getItemHistoryForHttpResponse( UUID itemID) throws IOException { + // verify the required parameter 'itemID' is set if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Items/{ItemID}/History"; @@ -5956,7 +5519,6 @@ public HttpResponse getItemHistoryForHttpResponse( String xeroTenantId, UUID it /** * Allows you to retrieve any items *

200 - Success - return response of type Items array with all Item - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -5964,19 +5526,16 @@ public HttpResponse getItemHistoryForHttpResponse( String xeroTenantId, UUID it * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - HttpResponse response = getItemsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); + public Items getItems(OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpResponse response = getItemsForHttpResponse(ifModifiedSince, where, order, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getItemsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); - } + public HttpResponse getItemsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Items"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -6027,27 +5586,23 @@ public HttpResponse getItemsForHttpResponse( String xeroTenantId, OffsetDateTim /** * Allows you to retrieve a specified journals. *

200 - Success - return response of type Journals array with specified Journal - * @param xeroTenantId Xero identifier for Tenant * @param journalID Unique identifier for a Journal * @return Journals * @throws IOException if an error occurs while attempting to invoke the API **/ - public Journals getJournal(String xeroTenantId, UUID journalID) throws IOException { - HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID); + public Journals getJournal(UUID journalID) throws IOException { + HttpResponse response = getJournalForHttpResponse(journalID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getJournalForHttpResponse( String xeroTenantId, UUID journalID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournal"); - }// verify the required parameter 'journalID' is set + public HttpResponse getJournalForHttpResponse( UUID journalID) throws IOException { + // verify the required parameter 'journalID' is set if (journalID == null) { throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Journals/{JournalID}"; @@ -6072,26 +5627,22 @@ public HttpResponse getJournalForHttpResponse( String xeroTenantId, UUID journa /** * Allows you to retrieve any journals. *

200 - Success - return response of type Journals array with all Journals - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned * @param paymentsOnly Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. * @return Journals * @throws IOException if an error occurs while attempting to invoke the API **/ - public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { - HttpResponse response = getJournalsForHttpResponse(xeroTenantId, ifModifiedSince, offset, paymentsOnly); + public Journals getJournals(OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { + HttpResponse response = getJournalsForHttpResponse(ifModifiedSince, offset, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getJournalsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); - } + public HttpResponse getJournalsForHttpResponse( OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Journals"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -6132,27 +5683,23 @@ public HttpResponse getJournalsForHttpResponse( String xeroTenantId, OffsetDate /** * Allows you to retrieve a specified linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactionID Unique identifier for a LinkedTransaction * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { - HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); + public LinkedTransactions getLinkedTransaction(UUID linkedTransactionID) throws IOException { + HttpResponse response = getLinkedTransactionForHttpResponse(linkedTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getLinkedTransactionForHttpResponse( String xeroTenantId, UUID linkedTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set + public HttpResponse getLinkedTransactionForHttpResponse( UUID linkedTransactionID) throws IOException { + // verify the required parameter 'linkedTransactionID' is set if (linkedTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; @@ -6177,7 +5724,6 @@ public HttpResponse getLinkedTransactionForHttpResponse( String xeroTenantId, U /** * Retrieve linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant * @param page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. * @param linkedTransactionID The Xero identifier for an Linked Transaction * @param sourceTransactionID Filter by the SourceTransactionID. Get all the linked transactions created from a particular ACCPAY invoice @@ -6187,19 +5733,16 @@ public HttpResponse getLinkedTransactionForHttpResponse( String xeroTenantId, U * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { - HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); + public LinkedTransactions getLinkedTransactions(Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { + HttpResponse response = getLinkedTransactionsForHttpResponse(page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getLinkedTransactionsForHttpResponse( String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); - } + public HttpResponse getLinkedTransactionsForHttpResponse( Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/LinkedTransactions"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -6280,27 +5823,23 @@ public HttpResponse getLinkedTransactionsForHttpResponse( String xeroTenantId, /** * Allows you to retrieve a specified manual journals *

200 - Success - return response of type ManualJournals array with a specified ManualJournals - * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID) throws IOException { - HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID); + public ManualJournals getManualJournal(UUID manualJournalID) throws IOException { + HttpResponse response = getManualJournalForHttpResponse(manualJournalID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getManualJournalForHttpResponse( String xeroTenantId, UUID manualJournalID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournal"); - }// verify the required parameter 'manualJournalID' is set + public HttpResponse getManualJournalForHttpResponse( UUID manualJournalID) throws IOException { + // verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ManualJournals/{ManualJournalID}"; @@ -6325,25 +5864,21 @@ public HttpResponse getManualJournalForHttpResponse( String xeroTenantId, UUID /** * Allows you to retrieve specified Attachment on ManualJournal by file name *

200 - Success - return response of attachment for Manual Journal as binary data - * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param fileName The name of the file being attached to a ManualJournal * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { - HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType); + public ByteArrayInputStream getManualJournalAttachmentByFileName(UUID manualJournalID, String fileName, String contentType) throws IOException { + HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(manualJournalID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set + public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( UUID manualJournalID, String fileName, String contentType) throws IOException { + // verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -6354,7 +5889,7 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( String throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; @@ -6387,25 +5922,21 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( String /** * Allows you to retrieve specified Attachment on ManualJournals *

200 - Success - return response of attachment for Manual Journal as binary data - * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType); + public ByteArrayInputStream getManualJournalAttachmentById(UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(manualJournalID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getManualJournalAttachmentByIdForHttpResponse( String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); - }// verify the required parameter 'manualJournalID' is set + public HttpResponse getManualJournalAttachmentByIdForHttpResponse( UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -6416,7 +5947,7 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse( String xeroTe throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; @@ -6449,27 +5980,23 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse( String xeroTe /** * Allows you to retrieve Attachment for manual journals *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals - * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID) throws IOException { - HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID); + public Attachments getManualJournalAttachments(UUID manualJournalID) throws IOException { + HttpResponse response = getManualJournalAttachmentsForHttpResponse(manualJournalID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getManualJournalAttachmentsForHttpResponse( String xeroTenantId, UUID manualJournalID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); - }// verify the required parameter 'manualJournalID' is set + public HttpResponse getManualJournalAttachmentsForHttpResponse( UUID manualJournalID) throws IOException { + // verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ManualJournals/{ManualJournalID}/Attachments"; @@ -6494,7 +6021,6 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse( String xeroTenan /** * Allows you to retrieve any manual journals *

200 - Success - return response of type ManualJournals array with a all ManualJournals - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -6502,19 +6028,16 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse( String xeroTenan * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); + public ManualJournals getManualJournals(OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpResponse response = getManualJournalsForHttpResponse(ifModifiedSince, where, order, page); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getManualJournalsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); - } + public HttpResponse getManualJournalsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ManualJournals"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -6565,27 +6088,23 @@ public HttpResponse getManualJournalsForHttpResponse( String xeroTenantId, Offs /** * Allows you to retrieve a URL to an online invoice *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @return OnlineInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID) throws IOException { - HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID); + public OnlineInvoices getOnlineInvoice(UUID invoiceID) throws IOException { + HttpResponse response = getOnlineInvoiceForHttpResponse(invoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOnlineInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse getOnlineInvoiceForHttpResponse( UUID invoiceID) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}/OnlineInvoice"; @@ -6610,27 +6129,23 @@ public HttpResponse getOnlineInvoiceForHttpResponse( String xeroTenantId, UUID /** * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. *

200 - Success - return response of type Organisation array with specified Organisation - * @param xeroTenantId Xero identifier for Tenant * @param organisationID The organisationID parameter * @return CISOrgSetting * @throws IOException if an error occurs while attempting to invoke the API **/ - public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID) throws IOException { - HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID); + public CISOrgSetting getOrganisationCISSettings(UUID organisationID) throws IOException { + HttpResponse response = getOrganisationCISSettingsForHttpResponse(organisationID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOrganisationCISSettingsForHttpResponse( String xeroTenantId, UUID organisationID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); - }// verify the required parameter 'organisationID' is set + public HttpResponse getOrganisationCISSettingsForHttpResponse( UUID organisationID) throws IOException { + // verify the required parameter 'organisationID' is set if (organisationID == null) { throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Organisation/{OrganisationID}/CISSettings"; @@ -6655,23 +6170,19 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse( String xeroTenant /** * Allows you to retrieve Organisation details *

200 - Success - return response of type Organisation array with all Organisation - * @param xeroTenantId Xero identifier for Tenant * @return Organisations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Organisations getOrganisations(String xeroTenantId) throws IOException { - HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId); + public Organisations getOrganisations() throws IOException { + HttpResponse response = getOrganisationsForHttpResponse(); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOrganisationsForHttpResponse( String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); - } + public HttpResponse getOrganisationsForHttpResponse() throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Organisation"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -6691,27 +6202,23 @@ public HttpResponse getOrganisationsForHttpResponse( String xeroTenantId) throws /** * Allows you to retrieve a specified overpayments *

200 - Success - return response of type Overpayments array with specified Overpayments - * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment * @return Overpayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID) throws IOException { - HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID); + public Overpayments getOverpayment(UUID overpaymentID) throws IOException { + HttpResponse response = getOverpaymentForHttpResponse(overpaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOverpaymentForHttpResponse( String xeroTenantId, UUID overpaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayment"); - }// verify the required parameter 'overpaymentID' is set + public HttpResponse getOverpaymentForHttpResponse( UUID overpaymentID) throws IOException { + // verify the required parameter 'overpaymentID' is set if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Overpayments/{OverpaymentID}"; @@ -6736,27 +6243,23 @@ public HttpResponse getOverpaymentForHttpResponse( String xeroTenantId, UUID ov /** * Allows you to retrieve a history records of an Overpayment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments - * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID) throws IOException { - HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID); + public HistoryRecords getOverpaymentHistory(UUID overpaymentID) throws IOException { + HttpResponse response = getOverpaymentHistoryForHttpResponse(overpaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOverpaymentHistoryForHttpResponse( String xeroTenantId, UUID overpaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); - }// verify the required parameter 'overpaymentID' is set + public HttpResponse getOverpaymentHistoryForHttpResponse( UUID overpaymentID) throws IOException { + // verify the required parameter 'overpaymentID' is set if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Overpayments/{OverpaymentID}/History"; @@ -6781,7 +6284,6 @@ public HttpResponse getOverpaymentHistoryForHttpResponse( String xeroTenantId, /** * Allows you to retrieve overpayments *

200 - Success - return response of type Overpayments array with all Overpayments - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -6790,19 +6292,16 @@ public HttpResponse getOverpaymentHistoryForHttpResponse( String xeroTenantId, * @return Overpayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + public Overpayments getOverpayments(OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getOverpaymentsForHttpResponse(ifModifiedSince, where, order, page, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOverpaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); - } + public HttpResponse getOverpaymentsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Overpayments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -6863,27 +6362,23 @@ public HttpResponse getOverpaymentsForHttpResponse( String xeroTenantId, Offset /** * Allows you to retrieve a specified payment for invoices and credit notes *

200 - Success - return response of type Payments array for specified Payment - * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments getPayment(String xeroTenantId, UUID paymentID) throws IOException { - HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID); + public Payments getPayment(UUID paymentID) throws IOException { + HttpResponse response = getPaymentForHttpResponse(paymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPaymentForHttpResponse( String xeroTenantId, UUID paymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayment"); - }// verify the required parameter 'paymentID' is set + public HttpResponse getPaymentForHttpResponse( UUID paymentID) throws IOException { + // verify the required parameter 'paymentID' is set if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Payments/{PaymentID}"; @@ -6908,27 +6403,23 @@ public HttpResponse getPaymentForHttpResponse( String xeroTenantId, UUID paymen /** * Allows you to retrieve history records of a payment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments - * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) throws IOException { - HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID); + public HistoryRecords getPaymentHistory(UUID paymentID) throws IOException { + HttpResponse response = getPaymentHistoryForHttpResponse(paymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPaymentHistoryForHttpResponse( String xeroTenantId, UUID paymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); - }// verify the required parameter 'paymentID' is set + public HttpResponse getPaymentHistoryForHttpResponse( UUID paymentID) throws IOException { + // verify the required parameter 'paymentID' is set if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Payments/{PaymentID}/History"; @@ -6953,23 +6444,19 @@ public HttpResponse getPaymentHistoryForHttpResponse( String xeroTenantId, UUID /** * Allows you to retrieve payment services *

200 - Success - return response of type PaymentServices array for all PaymentService - * @param xeroTenantId Xero identifier for Tenant * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices getPaymentServices(String xeroTenantId) throws IOException { - HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId); + public PaymentServices getPaymentServices() throws IOException { + HttpResponse response = getPaymentServicesForHttpResponse(); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPaymentServicesForHttpResponse( String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); - } + public HttpResponse getPaymentServicesForHttpResponse() throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/PaymentServices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -6989,26 +6476,22 @@ public HttpResponse getPaymentServicesForHttpResponse( String xeroTenantId) thro /** * Allows you to retrieve payments for invoices and credit notes *

200 - Success - return response of type Payments array for all Payments - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments getPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + public Payments getPayments(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getPaymentsForHttpResponse(ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); - } + public HttpResponse getPaymentsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Payments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -7049,27 +6532,23 @@ public HttpResponse getPaymentsForHttpResponse( String xeroTenantId, OffsetDate /** * Allows you to retrieve a specified prepayments *

200 - Success - return response of type Prepayments array for a specified Prepayment - * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID Unique identifier for a PrePayment * @return Prepayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID) throws IOException { - HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID); + public Prepayments getPrepayment(UUID prepaymentID) throws IOException { + HttpResponse response = getPrepaymentForHttpResponse(prepaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPrepaymentForHttpResponse( String xeroTenantId, UUID prepaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayment"); - }// verify the required parameter 'prepaymentID' is set + public HttpResponse getPrepaymentForHttpResponse( UUID prepaymentID) throws IOException { + // verify the required parameter 'prepaymentID' is set if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Prepayments/{PrepaymentID}"; @@ -7094,27 +6573,23 @@ public HttpResponse getPrepaymentForHttpResponse( String xeroTenantId, UUID pre /** * Allows you to retrieve a history records of an Prepayment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment - * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID Unique identifier for a PrePayment * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID) throws IOException { - HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID); + public HistoryRecords getPrepaymentHistory(UUID prepaymentID) throws IOException { + HttpResponse response = getPrepaymentHistoryForHttpResponse(prepaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPrepaymentHistoryForHttpResponse( String xeroTenantId, UUID prepaymentID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); - }// verify the required parameter 'prepaymentID' is set + public HttpResponse getPrepaymentHistoryForHttpResponse( UUID prepaymentID) throws IOException { + // verify the required parameter 'prepaymentID' is set if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Prepayments/{PrepaymentID}/History"; @@ -7139,7 +6614,6 @@ public HttpResponse getPrepaymentHistoryForHttpResponse( String xeroTenantId, U /** * Allows you to retrieve prepayments *

200 - Success - return response of type Prepayments array for all Prepayment - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -7148,19 +6622,16 @@ public HttpResponse getPrepaymentHistoryForHttpResponse( String xeroTenantId, U * @return Prepayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + public Prepayments getPrepayments(OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getPrepaymentsForHttpResponse(ifModifiedSince, where, order, page, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPrepaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); - } + public HttpResponse getPrepaymentsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Prepayments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -7221,27 +6692,23 @@ public HttpResponse getPrepaymentsForHttpResponse( String xeroTenantId, OffsetD /** * Allows you to retrieve a specified purchase orders *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID) throws IOException { - HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID); + public PurchaseOrders getPurchaseOrder(UUID purchaseOrderID) throws IOException { + HttpResponse response = getPurchaseOrderForHttpResponse(purchaseOrderID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPurchaseOrderForHttpResponse( String xeroTenantId, UUID purchaseOrderID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); - }// verify the required parameter 'purchaseOrderID' is set + public HttpResponse getPurchaseOrderForHttpResponse( UUID purchaseOrderID) throws IOException { + // verify the required parameter 'purchaseOrderID' is set if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; @@ -7266,27 +6733,23 @@ public HttpResponse getPurchaseOrderForHttpResponse( String xeroTenantId, UUID /** * Allows you to retrieve history for PurchaseOrder *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID) throws IOException { - HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID); + public HistoryRecords getPurchaseOrderHistory(UUID purchaseOrderID) throws IOException { + HttpResponse response = getPurchaseOrderHistoryForHttpResponse(purchaseOrderID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPurchaseOrderHistoryForHttpResponse( String xeroTenantId, UUID purchaseOrderID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); - }// verify the required parameter 'purchaseOrderID' is set + public HttpResponse getPurchaseOrderHistoryForHttpResponse( UUID purchaseOrderID) throws IOException { + // verify the required parameter 'purchaseOrderID' is set if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; @@ -7311,7 +6774,6 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse( String xeroTenantId, /** * Allows you to retrieve purchase orders *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param status Filter by purchase order status * @param dateFrom Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 @@ -7321,19 +6783,16 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse( String xeroTenantId, * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { - HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page); + public PurchaseOrders getPurchaseOrders(OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { + HttpResponse response = getPurchaseOrdersForHttpResponse(ifModifiedSince, status, dateFrom, dateTo, order, page); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPurchaseOrdersForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); - } + public HttpResponse getPurchaseOrdersForHttpResponse( OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/PurchaseOrders"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -7404,27 +6863,23 @@ public HttpResponse getPurchaseOrdersForHttpResponse( String xeroTenantId, Offs /** * Allows you to retrieve a specified draft expense claim receipts *

200 - Success - return response of type Receipts array for a specified Receipt - * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts getReceipt(String xeroTenantId, UUID receiptID) throws IOException { - HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID); + public Receipts getReceipt(UUID receiptID) throws IOException { + HttpResponse response = getReceiptForHttpResponse(receiptID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReceiptForHttpResponse( String xeroTenantId, UUID receiptID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipt"); - }// verify the required parameter 'receiptID' is set + public HttpResponse getReceiptForHttpResponse( UUID receiptID) throws IOException { + // verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Receipts/{ReceiptID}"; @@ -7449,25 +6904,21 @@ public HttpResponse getReceiptForHttpResponse( String xeroTenantId, UUID receip /** * Allows you to retrieve Attachments on expense claim receipts by file name *

200 - Success - return response of attachment for Receipt as binary data - * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param fileName The name of the file being attached to the Receipt * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { - HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType); + public ByteArrayInputStream getReceiptAttachmentByFileName(UUID receiptID, String fileName, String contentType) throws IOException { + HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(receiptID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set + public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( UUID receiptID, String fileName, String contentType) throws IOException { + // verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -7478,7 +6929,7 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( String xeroTe throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; @@ -7511,25 +6962,21 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( String xeroTe /** * Allows you to retrieve Attachments on expense claim receipts by ID *

200 - Success - return response of attachment for Receipt as binary data - * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType); + public ByteArrayInputStream getReceiptAttachmentById(UUID receiptID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getReceiptAttachmentByIdForHttpResponse(receiptID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getReceiptAttachmentByIdForHttpResponse( String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); - }// verify the required parameter 'receiptID' is set + public HttpResponse getReceiptAttachmentByIdForHttpResponse( UUID receiptID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -7540,7 +6987,7 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse( String xeroTenantId throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; @@ -7573,27 +7020,23 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse( String xeroTenantId /** * Allows you to retrieve Attachments for expense claim receipts *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt - * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) throws IOException { - HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID); + public Attachments getReceiptAttachments(UUID receiptID) throws IOException { + HttpResponse response = getReceiptAttachmentsForHttpResponse(receiptID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReceiptAttachmentsForHttpResponse( String xeroTenantId, UUID receiptID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); - }// verify the required parameter 'receiptID' is set + public HttpResponse getReceiptAttachmentsForHttpResponse( UUID receiptID) throws IOException { + // verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Receipts/{ReceiptID}/Attachments"; @@ -7618,27 +7061,23 @@ public HttpResponse getReceiptAttachmentsForHttpResponse( String xeroTenantId, /** * Allows you to retrieve a history records of an Receipt *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt - * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) throws IOException { - HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID); + public HistoryRecords getReceiptHistory(UUID receiptID) throws IOException { + HttpResponse response = getReceiptHistoryForHttpResponse(receiptID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReceiptHistoryForHttpResponse( String xeroTenantId, UUID receiptID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); - }// verify the required parameter 'receiptID' is set + public HttpResponse getReceiptHistoryForHttpResponse( UUID receiptID) throws IOException { + // verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Receipts/{ReceiptID}/History"; @@ -7663,7 +7102,6 @@ public HttpResponse getReceiptHistoryForHttpResponse( String xeroTenantId, UUID /** * Allows you to retrieve draft expense claim receipts for any user *

200 - Success - return response of type Receipts array for all Receipt - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -7671,19 +7109,16 @@ public HttpResponse getReceiptHistoryForHttpResponse( String xeroTenantId, UUID * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); + public Receipts getReceipts(OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpResponse response = getReceiptsForHttpResponse(ifModifiedSince, where, order, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReceiptsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); - } + public HttpResponse getReceiptsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Receipts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -7734,27 +7169,23 @@ public HttpResponse getReceiptsForHttpResponse( String xeroTenantId, OffsetDate /** * Allows you to retrieve a specified repeating invoice *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID); + public RepeatingInvoices getRepeatingInvoice(UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceForHttpResponse(repeatingInvoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getRepeatingInvoiceForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); - }// verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse getRepeatingInvoiceForHttpResponse( UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}"; @@ -7779,25 +7210,21 @@ public HttpResponse getRepeatingInvoiceForHttpResponse( String xeroTenantId, UU /** * Allows you to retrieve specified attachment on repeating invoices by file name *

200 - Success - return response of attachment for Repeating Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param fileName The name of the file being attached to a Repeating Invoice * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType); + public ByteArrayInputStream getRepeatingInvoiceAttachmentByFileName(UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(repeatingInvoiceID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { + // verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -7808,7 +7235,7 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( Stri throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; @@ -7841,25 +7268,21 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( Stri /** * Allows you to retrieve a specified Attachments on repeating invoices *

200 - Success - return response of attachment for Repeating Invoice as binary data - * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType); + public ByteArrayInputStream getRepeatingInvoiceAttachmentById(UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(repeatingInvoiceID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); } - public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); - }// verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -7870,7 +7293,7 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( String xer throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; @@ -7903,27 +7326,23 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( String xer /** * Allows you to retrieve Attachments on repeating invoice *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID); + public Attachments getRepeatingInvoiceAttachments(UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(repeatingInvoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); - }// verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; @@ -7948,27 +7367,23 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( String xeroTe /** * Allows you to retrieve history for a repeating invoice *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID); + public HistoryRecords getRepeatingInvoiceHistory(UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(repeatingInvoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); - }// verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; @@ -7993,25 +7408,21 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( String xeroTenant /** * Allows you to retrieve any repeating invoices *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice - * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, String order) throws IOException { - HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, where, order); + public RepeatingInvoices getRepeatingInvoices(String where, String order) throws IOException { + HttpResponse response = getRepeatingInvoicesForHttpResponse(where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getRepeatingInvoicesForHttpResponse( String xeroTenantId, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); - } + public HttpResponse getRepeatingInvoicesForHttpResponse( String where, String order) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/RepeatingInvoices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8052,7 +7463,6 @@ public HttpResponse getRepeatingInvoicesForHttpResponse( String xeroTenantId, S /** * Allows you to retrieve report for AgedPayablesByContact *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant * @param contactId Unique identifier for a Contact * @param date The date of the Aged Payables By Contact report * @param fromDate The from date of the Aged Payables By Contact report @@ -8060,22 +7470,19 @@ public HttpResponse getRepeatingInvoicesForHttpResponse( String xeroTenantId, S * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); + public ReportWithRows getReportAgedPayablesByContact(UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + HttpResponse response = getReportAgedPayablesByContactForHttpResponse(contactId, date, fromDate, toDate); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportAgedPayablesByContactForHttpResponse( String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); - }// verify the required parameter 'contactId' is set + public HttpResponse getReportAgedPayablesByContactForHttpResponse( UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + // verify the required parameter 'contactId' is set if (contactId == null) { throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Reports/AgedPayablesByContact"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8136,7 +7543,6 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse( String xeroTe /** * Allows you to retrieve report for AgedReceivablesByContact *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant * @param contactId Unique identifier for a Contact * @param date The date of the Aged Receivables By Contact report * @param fromDate The from date of the Aged Receivables By Contact report @@ -8144,22 +7550,19 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse( String xeroTe * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); + public ReportWithRows getReportAgedReceivablesByContact(UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(contactId, date, fromDate, toDate); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportAgedReceivablesByContactForHttpResponse( String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); - }// verify the required parameter 'contactId' is set + public HttpResponse getReportAgedReceivablesByContactForHttpResponse( UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + // verify the required parameter 'contactId' is set if (contactId == null) { throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Reports/AgedReceivablesByContact"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8220,27 +7623,23 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse( String xer /** * Allows you to retrieve report for BAS only valid for AU orgs *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant * @param reportID Unique identifier for a Report * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) throws IOException { - HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID); + public ReportWithRows getReportBASorGST(String reportID) throws IOException { + HttpResponse response = getReportBASorGSTForHttpResponse(reportID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportBASorGSTForHttpResponse( String xeroTenantId, String reportID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); - }// verify the required parameter 'reportID' is set + public HttpResponse getReportBASorGSTForHttpResponse( String reportID) throws IOException { + // verify the required parameter 'reportID' is set if (reportID == null) { throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Reports/{ReportID}"; @@ -8265,23 +7664,19 @@ public HttpResponse getReportBASorGSTForHttpResponse( String xeroTenantId, Stri /** * Allows you to retrieve report for BAS only valid for AU orgs *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws IOException { - HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId); + public ReportWithRows getReportBASorGSTList() throws IOException { + HttpResponse response = getReportBASorGSTListForHttpResponse(); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportBASorGSTListForHttpResponse( String xeroTenantId) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); - } + public HttpResponse getReportBASorGSTListForHttpResponse() throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Reports"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8301,7 +7696,6 @@ public HttpResponse getReportBASorGSTListForHttpResponse( String xeroTenantId) t /** * Allows you to retrieve report for BalanceSheet *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant * @param date The date of the Balance Sheet report * @param periods The number of periods for the Balance Sheet report * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) @@ -8312,19 +7706,16 @@ public HttpResponse getReportBASorGSTListForHttpResponse( String xeroTenantId) t * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); + public ReportWithRows getReportBalanceSheet(String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportBalanceSheetForHttpResponse(date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportBalanceSheetForHttpResponse( String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); - } + public HttpResponse getReportBalanceSheetForHttpResponse( String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Reports/BalanceSheet"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8415,26 +7806,22 @@ public HttpResponse getReportBalanceSheetForHttpResponse( String xeroTenantId, /** * Allows you to retrieve report for BankSummary *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Bank Summary report e.g. 2018-03-31 * @param period The number of periods to compare (integer between 1 and 12) * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, date, period, timeframe); + public ReportWithRows getReportBankSummary(LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpResponse response = getReportBankSummaryForHttpResponse(date, period, timeframe); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportBankSummaryForHttpResponse( String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); - } + public HttpResponse getReportBankSummaryForHttpResponse( LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Reports/BankSummary"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8485,26 +7872,22 @@ public HttpResponse getReportBankSummaryForHttpResponse( String xeroTenantId, L /** * Allows you to retrieve report for Budget Summary *

200 - success- return a Report with Rows object - * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Bank Summary report e.g. 2018-03-31 * @param period The number of periods to compare (integer between 1 and 12) * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, date, period, timeframe); + public ReportWithRows getReportBudgetSummary(LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpResponse response = getReportBudgetSummaryForHttpResponse(date, period, timeframe); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportBudgetSummaryForHttpResponse( String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); - } + public HttpResponse getReportBudgetSummaryForHttpResponse( LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Reports/BudgetSummary"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8555,24 +7938,20 @@ public HttpResponse getReportBudgetSummaryForHttpResponse( String xeroTenantId, /** * Allows you to retrieve report for ExecutiveSummary *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Bank Summary report e.g. 2018-03-31 * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate date) throws IOException { - HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, date); + public ReportWithRows getReportExecutiveSummary(LocalDate date) throws IOException { + HttpResponse response = getReportExecutiveSummaryForHttpResponse(date); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportExecutiveSummaryForHttpResponse( String xeroTenantId, LocalDate date) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); - } + public HttpResponse getReportExecutiveSummaryForHttpResponse( LocalDate date) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Reports/ExecutiveSummary"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8603,7 +7982,6 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse( String xeroTenantI /** * Allows you to retrieve report for ProfitAndLoss *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant * @param fromDate The from date for the ProfitAndLoss report e.g. 2018-03-31 * @param toDate The to date for the ProfitAndLoss report e.g. 2018-03-31 * @param periods The number of periods to compare (integer between 1 and 12) @@ -8617,19 +7995,16 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse( String xeroTenantI * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); + public ReportWithRows getReportProfitAndLoss(LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportProfitAndLossForHttpResponse(fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportProfitAndLossForHttpResponse( String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); - } + public HttpResponse getReportProfitAndLossForHttpResponse( LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Reports/ProfitAndLoss"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8750,24 +8125,20 @@ public HttpResponse getReportProfitAndLossForHttpResponse( String xeroTenantId, /** * Allows you to retrieve report for TenNinetyNine *

200 - Success - return response of type Reports - * @param xeroTenantId Xero identifier for Tenant * @param reportYear The year of the 1099 report * @return Reports * @throws IOException if an error occurs while attempting to invoke the API **/ - public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) throws IOException { - HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, reportYear); + public Reports getReportTenNinetyNine(String reportYear) throws IOException { + HttpResponse response = getReportTenNinetyNineForHttpResponse(reportYear); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportTenNinetyNineForHttpResponse( String xeroTenantId, String reportYear) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); - } + public HttpResponse getReportTenNinetyNineForHttpResponse( String reportYear) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Reports/TenNinetyNine"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8798,25 +8169,21 @@ public HttpResponse getReportTenNinetyNineForHttpResponse( String xeroTenantId, /** * Allows you to retrieve report for TrialBalance *

200 - Success - return response of type ReportWithRows - * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Trial Balance report e.g. 2018-03-31 * @param paymentsOnly Return cash only basis for the Trial Balance report * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, date, paymentsOnly); + public ReportWithRows getReportTrialBalance(LocalDate date, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportTrialBalanceForHttpResponse(date, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportTrialBalanceForHttpResponse( String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); - } + public HttpResponse getReportTrialBalanceForHttpResponse( LocalDate date, Boolean paymentsOnly) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Reports/TrialBalance"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8857,26 +8224,22 @@ public HttpResponse getReportTrialBalanceForHttpResponse( String xeroTenantId, /** * Allows you to retrieve Tax Rates *

200 - Success - return response of type TaxRates array with TaxRates - * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @param taxType Filter by tax type * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates getTaxRates(String xeroTenantId, String where, String order, String taxType) throws IOException { - HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, where, order, taxType); + public TaxRates getTaxRates(String where, String order, String taxType) throws IOException { + HttpResponse response = getTaxRatesForHttpResponse(where, order, taxType); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getTaxRatesForHttpResponse( String xeroTenantId, String where, String order, String taxType) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); - } + public HttpResponse getTaxRatesForHttpResponse( String where, String order, String taxType) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/TaxRates"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8927,26 +8290,22 @@ public HttpResponse getTaxRatesForHttpResponse( String xeroTenantId, String whe /** * Allows you to retrieve tracking categories and options *

200 - Success - return response of type TrackingCategories array of TrackingCategory - * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @param includeArchived e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories getTrackingCategories(String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { - HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, where, order, includeArchived); + public TrackingCategories getTrackingCategories(String where, String order, Boolean includeArchived) throws IOException { + HttpResponse response = getTrackingCategoriesForHttpResponse(where, order, includeArchived); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getTrackingCategoriesForHttpResponse( String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); - } + public HttpResponse getTrackingCategoriesForHttpResponse( String where, String order, Boolean includeArchived) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/TrackingCategories"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -8997,27 +8356,23 @@ public HttpResponse getTrackingCategoriesForHttpResponse( String xeroTenantId, /** * Allows you to retrieve tracking categories and options for specified category *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory - * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { - HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); + public TrackingCategories getTrackingCategory(UUID trackingCategoryID) throws IOException { + HttpResponse response = getTrackingCategoryForHttpResponse(trackingCategoryID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getTrackingCategoryForHttpResponse( String xeroTenantId, UUID trackingCategoryID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set + public HttpResponse getTrackingCategoryForHttpResponse( UUID trackingCategoryID) throws IOException { + // verify the required parameter 'trackingCategoryID' is set if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/TrackingCategories/{TrackingCategoryID}"; @@ -9042,27 +8397,23 @@ public HttpResponse getTrackingCategoryForHttpResponse( String xeroTenantId, UU /** * Allows you to retrieve a specified user *

200 - Success - return response of type Users array of specified User - * @param xeroTenantId Xero identifier for Tenant * @param userID Unique identifier for a User * @return Users * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUser(String xeroTenantId, UUID userID) throws IOException { - HttpResponse response = getUserForHttpResponse(xeroTenantId, userID); + public Users getUser(UUID userID) throws IOException { + HttpResponse response = getUserForHttpResponse(userID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getUserForHttpResponse( String xeroTenantId, UUID userID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUser"); - }// verify the required parameter 'userID' is set + public HttpResponse getUserForHttpResponse( UUID userID) throws IOException { + // verify the required parameter 'userID' is set if (userID == null) { throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Users/{UserID}"; @@ -9087,26 +8438,22 @@ public HttpResponse getUserForHttpResponse( String xeroTenantId, UUID userID) t /** * Allows you to retrieve users *

200 - Success - return response of type Users array of all User - * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Users * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getUsersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); + public Users getUsers(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getUsersForHttpResponse(ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getUsersForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); - } + public HttpResponse getUsersForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Users"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -9148,23 +8495,19 @@ public HttpResponse getUsersForHttpResponse( String xeroTenantId, OffsetDateTim * Allows you to update a chart of accounts *

200 - Success - update existing Account and return response of type Accounts array with updated Account *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for retrieving single object * @param accounts Request of type Accounts array with one Account * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { - HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts); + public Accounts updateAccount(UUID accountID, Accounts accounts) throws IOException { + HttpResponse response = updateAccountForHttpResponse(accountID, accounts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateAccountForHttpResponse( String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); - }// verify the required parameter 'accountID' is set + public HttpResponse updateAccountForHttpResponse( UUID accountID, Accounts accounts) throws IOException { + // verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); }// verify the required parameter 'accounts' is set @@ -9172,7 +8515,7 @@ public HttpResponse updateAccountForHttpResponse( String xeroTenantId, UUID acc throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Accounts/{AccountID}"; @@ -9200,24 +8543,20 @@ public HttpResponse updateAccountForHttpResponse( String xeroTenantId, UUID acc * Allows you to update Attachment on Account by Filename *

200 - Success - return response of type Attachments array of Attachment *

400 - Validation Error - some data was incorrect returns response of type Error - * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param fileName Name of the attachment * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { - HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); + public Attachments updateAccountAttachmentByFileName(UUID accountID, String fileName, File body) throws IOException { + HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(accountID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); - }// verify the required parameter 'accountID' is set + public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( UUID accountID, String fileName, File body) throws IOException { + // verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9228,7 +8567,7 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( String xer throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; @@ -9259,23 +8598,19 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( String xer * Allows you to update a single spend or receive money transaction *

200 - Success - return response of type BankTransactions array with updated BankTransaction *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param bankTransactions The bankTransactions parameter * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { - HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions); + public BankTransactions updateBankTransaction(UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { + HttpResponse response = updateBankTransactionForHttpResponse(bankTransactionID, bankTransactions); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateBankTransactionForHttpResponse( String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); - }// verify the required parameter 'bankTransactionID' is set + public HttpResponse updateBankTransactionForHttpResponse( UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { + // verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); }// verify the required parameter 'bankTransactions' is set @@ -9283,7 +8618,7 @@ public HttpResponse updateBankTransactionForHttpResponse( String xeroTenantId, throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransactions/{BankTransactionID}"; @@ -9311,24 +8646,20 @@ public HttpResponse updateBankTransactionForHttpResponse( String xeroTenantId, * Allows you to update an Attachment on BankTransaction by Filename *

200 - Success - return response of Attachments array of Attachment *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param fileName The name of the file being attached * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { - HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); + public Attachments updateBankTransactionAttachmentByFileName(UUID bankTransactionID, String fileName, File body) throws IOException { + HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(bankTransactionID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); - }// verify the required parameter 'bankTransactionID' is set + public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( UUID bankTransactionID, String fileName, File body) throws IOException { + // verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9339,7 +8670,7 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( St throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; @@ -9369,24 +8700,20 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( St /** *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param fileName The name of the file being attached to a Bank Transfer * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { - HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); + public Attachments updateBankTransferAttachmentByFileName(UUID bankTransferID, String fileName, File body) throws IOException { + HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(bankTransferID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); - }// verify the required parameter 'bankTransferID' is set + public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( UUID bankTransferID, String fileName, File body) throws IOException { + // verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9397,7 +8724,7 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( Strin throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; @@ -9427,23 +8754,19 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( Strin /** *

200 - Success - return response of type Contacts array with an updated Contact *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param contacts an array of Contacts containing single Contact object with properties to update * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { - HttpResponse response = updateContactForHttpResponse(xeroTenantId, contactID, contacts); + public Contacts updateContact(UUID contactID, Contacts contacts) throws IOException { + HttpResponse response = updateContactForHttpResponse(contactID, contacts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateContactForHttpResponse( String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); - }// verify the required parameter 'contactID' is set + public HttpResponse updateContactForHttpResponse( UUID contactID, Contacts contacts) throws IOException { + // verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); }// verify the required parameter 'contacts' is set @@ -9451,7 +8774,7 @@ public HttpResponse updateContactForHttpResponse( String xeroTenantId, UUID con throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts/{ContactID}"; @@ -9478,24 +8801,20 @@ public HttpResponse updateContactForHttpResponse( String xeroTenantId, UUID con /** *

200 - Success - return response of type Attachments array with an updated Attachment *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param fileName Name for the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { - HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); + public Attachments updateContactAttachmentByFileName(UUID contactID, String fileName, File body) throws IOException { + HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(contactID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateContactAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); - }// verify the required parameter 'contactID' is set + public HttpResponse updateContactAttachmentByFileNameForHttpResponse( UUID contactID, String fileName, File body) throws IOException { + // verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9506,7 +8825,7 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( String xer throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; @@ -9537,23 +8856,19 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( String xer * Allows you to update a Contract Group *

200 - Success - return response of type Contact Groups array of updated Contact Group *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group * @param contactGroups an array of Contact groups with Name of specific group to update * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { - HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups); + public ContactGroups updateContactGroup(UUID contactGroupID, ContactGroups contactGroups) throws IOException { + HttpResponse response = updateContactGroupForHttpResponse(contactGroupID, contactGroups); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateContactGroupForHttpResponse( String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); - }// verify the required parameter 'contactGroupID' is set + public HttpResponse updateContactGroupForHttpResponse( UUID contactGroupID, ContactGroups contactGroups) throws IOException { + // verify the required parameter 'contactGroupID' is set if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); }// verify the required parameter 'contactGroups' is set @@ -9561,7 +8876,7 @@ public HttpResponse updateContactGroupForHttpResponse( String xeroTenantId, UUI throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ContactGroups/{ContactGroupID}"; @@ -9589,23 +8904,19 @@ public HttpResponse updateContactGroupForHttpResponse( String xeroTenantId, UUI * Allows you to update a specific credit note *

200 - Success - return response of type Credit Notes array with updated CreditNote *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param creditNotes an array of Credit Notes containing credit note details to update * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { - HttpResponse response = updateCreditNoteForHttpResponse(xeroTenantId, creditNoteID, creditNotes); + public CreditNotes updateCreditNote(UUID creditNoteID, CreditNotes creditNotes) throws IOException { + HttpResponse response = updateCreditNoteForHttpResponse(creditNoteID, creditNotes); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateCreditNoteForHttpResponse( String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); - }// verify the required parameter 'creditNoteID' is set + public HttpResponse updateCreditNoteForHttpResponse( UUID creditNoteID, CreditNotes creditNotes) throws IOException { + // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); }// verify the required parameter 'creditNotes' is set @@ -9613,7 +8924,7 @@ public HttpResponse updateCreditNoteForHttpResponse( String xeroTenantId, UUID throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes/{CreditNoteID}"; @@ -9641,24 +8952,20 @@ public HttpResponse updateCreditNoteForHttpResponse( String xeroTenantId, UUID * Allows you to update Attachments on CreditNote by file name *

200 - Success - return response of type Attachments array with updated Attachment for specific Credit Note *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param fileName Name of the file you are attaching to Credit Note * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { - HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); + public Attachments updateCreditNoteAttachmentByFileName(UUID creditNoteID, String fileName, File body) throws IOException { + HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(creditNoteID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); - }// verify the required parameter 'creditNoteID' is set + public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( UUID creditNoteID, String fileName, File body) throws IOException { + // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9669,7 +8976,7 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( String throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; @@ -9700,23 +9007,19 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( String * Allows you to update a specific employee used in Xero payrun *

200 - Success - return response of type Employees array with updated Employee *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param employeeID Unique identifier for a Employee * @param employees The employees parameter * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees) throws IOException { - HttpResponse response = updateEmployeeForHttpResponse(xeroTenantId, employeeID, employees); + public Employees updateEmployee(UUID employeeID, Employees employees) throws IOException { + HttpResponse response = updateEmployeeForHttpResponse(employeeID, employees); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateEmployeeForHttpResponse( String xeroTenantId, UUID employeeID, Employees employees) 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 + public HttpResponse updateEmployeeForHttpResponse( UUID employeeID, Employees employees) throws IOException { + // 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 'employees' is set @@ -9724,7 +9027,7 @@ public HttpResponse updateEmployeeForHttpResponse( String xeroTenantId, UUID em throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Employees/{EmployeeID}"; @@ -9752,23 +9055,19 @@ public HttpResponse updateEmployeeForHttpResponse( String xeroTenantId, UUID em * Allows you to update specified expense claims *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim * @param expenseClaims The expenseClaims parameter * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { - HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims); + public ExpenseClaims updateExpenseClaim(UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { + HttpResponse response = updateExpenseClaimForHttpResponse(expenseClaimID, expenseClaims); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateExpenseClaimForHttpResponse( String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); - }// verify the required parameter 'expenseClaimID' is set + public HttpResponse updateExpenseClaimForHttpResponse( UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { + // verify the required parameter 'expenseClaimID' is set if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); }// verify the required parameter 'expenseClaims' is set @@ -9776,7 +9075,7 @@ public HttpResponse updateExpenseClaimForHttpResponse( String xeroTenantId, UUI throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; @@ -9804,23 +9103,19 @@ public HttpResponse updateExpenseClaimForHttpResponse( String xeroTenantId, UUI * Allows you to update a specified sales invoices or purchase bills *

200 - Success - return response of type Invoices array with updated Invoice *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param invoices The invoices parameter * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { - HttpResponse response = updateInvoiceForHttpResponse(xeroTenantId, invoiceID, invoices); + public Invoices updateInvoice(UUID invoiceID, Invoices invoices) throws IOException { + HttpResponse response = updateInvoiceForHttpResponse(invoiceID, invoices); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse updateInvoiceForHttpResponse( UUID invoiceID, Invoices invoices) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); }// verify the required parameter 'invoices' is set @@ -9828,7 +9123,7 @@ public HttpResponse updateInvoiceForHttpResponse( String xeroTenantId, UUID inv throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}"; @@ -9856,24 +9151,20 @@ public HttpResponse updateInvoiceForHttpResponse( String xeroTenantId, UUID inv * Allows you to update Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of type Attachments array with updated Attachment *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param fileName Name of the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { - HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); + public Attachments updateInvoiceAttachmentByFileName(UUID invoiceID, String fileName, File body) throws IOException { + HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(invoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); - }// verify the required parameter 'invoiceID' is set + public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( UUID invoiceID, String fileName, File body) throws IOException { + // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9884,7 +9175,7 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( String xer throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; @@ -9915,23 +9206,19 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( String xer * Allows you to udpate a specified item *

200 - Success - return response of type Items array with updated Item *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @param items The items parameter * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items updateItem(String xeroTenantId, UUID itemID, Items items) throws IOException { - HttpResponse response = updateItemForHttpResponse(xeroTenantId, itemID, items); + public Items updateItem(UUID itemID, Items items) throws IOException { + HttpResponse response = updateItemForHttpResponse(itemID, items); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateItemForHttpResponse( String xeroTenantId, UUID itemID, Items items) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); - }// verify the required parameter 'itemID' is set + public HttpResponse updateItemForHttpResponse( UUID itemID, Items items) throws IOException { + // verify the required parameter 'itemID' is set if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); }// verify the required parameter 'items' is set @@ -9939,7 +9226,7 @@ public HttpResponse updateItemForHttpResponse( String xeroTenantId, UUID itemID throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Items/{ItemID}"; @@ -9967,23 +9254,19 @@ public HttpResponse updateItemForHttpResponse( String xeroTenantId, UUID itemID * Allows you to update a specified linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with updated LinkedTransaction *

400 - Success - return response of type LinkedTransactions array with updated LinkedTransaction - * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactionID Unique identifier for a LinkedTransaction * @param linkedTransactions The linkedTransactions parameter * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { - HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions); + public LinkedTransactions updateLinkedTransaction(UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { + HttpResponse response = updateLinkedTransactionForHttpResponse(linkedTransactionID, linkedTransactions); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateLinkedTransactionForHttpResponse( String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); - }// verify the required parameter 'linkedTransactionID' is set + public HttpResponse updateLinkedTransactionForHttpResponse( UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { + // verify the required parameter 'linkedTransactionID' is set if (linkedTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); }// verify the required parameter 'linkedTransactions' is set @@ -9991,7 +9274,7 @@ public HttpResponse updateLinkedTransactionForHttpResponse( String xeroTenantId, throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; @@ -10019,23 +9302,19 @@ public HttpResponse updateLinkedTransactionForHttpResponse( String xeroTenantId, * Allows you to update a specified manual journal *

200 - Success - return response of type ManualJournals array with an updated ManualJournal *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param manualJournals The manualJournals parameter * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { - HttpResponse response = updateManualJournalForHttpResponse(xeroTenantId, manualJournalID, manualJournals); + public ManualJournals updateManualJournal(UUID manualJournalID, ManualJournals manualJournals) throws IOException { + HttpResponse response = updateManualJournalForHttpResponse(manualJournalID, manualJournals); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateManualJournalForHttpResponse( String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); - }// verify the required parameter 'manualJournalID' is set + public HttpResponse updateManualJournalForHttpResponse( UUID manualJournalID, ManualJournals manualJournals) throws IOException { + // verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); }// verify the required parameter 'manualJournals' is set @@ -10043,7 +9322,7 @@ public HttpResponse updateManualJournalForHttpResponse( String xeroTenantId, UU throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ManualJournals/{ManualJournalID}"; @@ -10071,24 +9350,20 @@ public HttpResponse updateManualJournalForHttpResponse( String xeroTenantId, UU * Allows you to update a specified Attachment on ManualJournal by file name *

200 - Success - return response of type Attachments array with an update Attachment for a ManualJournals *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param fileName The name of the file being attached to a ManualJournal * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { - HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); + public Attachments updateManualJournalAttachmentByFileName(UUID manualJournalID, String fileName, File body) throws IOException { + HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(manualJournalID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set + public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( UUID manualJournalID, String fileName, File body) throws IOException { + // verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -10099,7 +9374,7 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( Stri throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; @@ -10130,23 +9405,19 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( Stri * Allows you to update a specified purchase order *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder * @param purchaseOrders The purchaseOrders parameter * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { - HttpResponse response = updatePurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, purchaseOrders); + public PurchaseOrders updatePurchaseOrder(UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { + HttpResponse response = updatePurchaseOrderForHttpResponse(purchaseOrderID, purchaseOrders); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updatePurchaseOrderForHttpResponse( String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); - }// verify the required parameter 'purchaseOrderID' is set + public HttpResponse updatePurchaseOrderForHttpResponse( UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { + // verify the required parameter 'purchaseOrderID' is set if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); }// verify the required parameter 'purchaseOrders' is set @@ -10154,7 +9425,7 @@ public HttpResponse updatePurchaseOrderForHttpResponse( String xeroTenantId, UU throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; @@ -10182,23 +9453,19 @@ public HttpResponse updatePurchaseOrderForHttpResponse( String xeroTenantId, UU * Allows you to retrieve a specified draft expense claim receipts *

200 - Success - return response of type Receipts array for updated Receipt *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param receipts The receipts parameter * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { - HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts); + public Receipts updateReceipt(UUID receiptID, Receipts receipts) throws IOException { + HttpResponse response = updateReceiptForHttpResponse(receiptID, receipts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateReceiptForHttpResponse( String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); - }// verify the required parameter 'receiptID' is set + public HttpResponse updateReceiptForHttpResponse( UUID receiptID, Receipts receipts) throws IOException { + // verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); }// verify the required parameter 'receipts' is set @@ -10206,7 +9473,7 @@ public HttpResponse updateReceiptForHttpResponse( String xeroTenantId, UUID rec throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Receipts/{ReceiptID}"; @@ -10234,24 +9501,20 @@ public HttpResponse updateReceiptForHttpResponse( String xeroTenantId, UUID rec * Allows you to update Attachment on expense claim receipts by file name *

200 - Success - return response of type Attachments array with updated Attachment for a specified Receipt *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param fileName The name of the file being attached to the Receipt * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { - HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); + public Attachments updateReceiptAttachmentByFileName(UUID receiptID, String fileName, File body) throws IOException { + HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(receiptID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); - }// verify the required parameter 'receiptID' is set + public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( UUID receiptID, String fileName, File body) throws IOException { + // verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -10262,7 +9525,7 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( String xer throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; @@ -10293,24 +9556,20 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( String xer * Allows you to update specified attachment on repeating invoices by file name *

200 - Success - return response of type Attachments array with specified Attachment for a specified Repeating Invoice *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param fileName The name of the file being attached to a Repeating Invoice * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { - HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); + public Attachments updateRepeatingInvoiceAttachmentByFileName(UUID repeatingInvoiceID, String fileName, File body) throws IOException { + HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(repeatingInvoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); - }// verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( UUID repeatingInvoiceID, String fileName, File body) throws IOException { + // verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -10321,7 +9580,7 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( S throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; @@ -10352,27 +9611,23 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( S * Allows you to update Tax Rates *

200 - Success - return response of type TaxRates array updated TaxRate *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param taxRates The taxRates parameter * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { - HttpResponse response = updateTaxRateForHttpResponse(xeroTenantId, taxRates); + public TaxRates updateTaxRate(TaxRates taxRates) throws IOException { + HttpResponse response = updateTaxRateForHttpResponse(taxRates); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateTaxRateForHttpResponse( String xeroTenantId, TaxRates taxRates) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); - }// verify the required parameter 'taxRates' is set + public HttpResponse updateTaxRateForHttpResponse( TaxRates taxRates) throws IOException { + // verify the required parameter 'taxRates' is set if (taxRates == null) { throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/TaxRates"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); @@ -10395,23 +9650,19 @@ public HttpResponse updateTaxRateForHttpResponse( String xeroTenantId, TaxRates * Allows you to update tracking categories *

200 - Success - return response of type TrackingCategories array of updated TrackingCategory *

400 - A failed request due to validation error - * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @param trackingCategory The trackingCategory parameter * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { - HttpResponse response = updateTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, trackingCategory); + public TrackingCategories updateTrackingCategory(UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { + HttpResponse response = updateTrackingCategoryForHttpResponse(trackingCategoryID, trackingCategory); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateTrackingCategoryForHttpResponse( String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); - }// verify the required parameter 'trackingCategoryID' is set + public HttpResponse updateTrackingCategoryForHttpResponse( UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { + // verify the required parameter 'trackingCategoryID' is set if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); }// verify the required parameter 'trackingCategory' is set @@ -10419,7 +9670,7 @@ public HttpResponse updateTrackingCategoryForHttpResponse( String xeroTenantId, throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); + headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/TrackingCategories/{TrackingCategoryID}"; diff --git a/src/test/.gitignore b/src/test/.gitignore new file mode 100644 index 00000000..9bb88d37 --- /dev/null +++ b/src/test/.gitignore @@ -0,0 +1 @@ +/.DS_Store diff --git a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java new file mode 100644 index 00000000..9fccf38e --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java @@ -0,0 +1,192 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +public class AccountingApiAccountsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void testGetAccounts() throws Exception { + System.out.println("@Test - getAccounts"); + + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + assert(accounts.getAccounts().size() == 2); + assertThat(accounts.getAccounts().get(0).getCode(), is(equalTo("091"))); + assertThat(accounts.getAccounts().get(0).getName(), is(equalTo("Business Savings Account"))); + assertThat(accounts.getAccounts().get(0).getAccountID().toString(), is(equalTo("ebd06280-af70-4bed-97c6-7451a454ad85"))); + assertThat(accounts.getAccounts().get(0).getType(), is(equalTo(com.xero.models.accounting.AccountType.BANK))); + assertThat(accounts.getAccounts().get(0).getBankAccountNumber(), is(equalTo("0209087654321050"))); + assertThat(accounts.getAccounts().get(0).getBankAccountType(), is(equalTo(com.xero.models.accounting.Account.BankAccountTypeEnum.BANK))); + assertThat(accounts.getAccounts().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(accounts.getAccounts().get(0).getTaxType(), is(equalTo("NONE"))); + } + + @Test + public void testGetAccount() throws Exception { + System.out.println("@Test - getAccount"); + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + + Accounts oneAccount = accountingApi.getAccount(xeroTenantId,accountID); + assertThat(oneAccount.getAccounts().get(0).getName(), is(equalTo("FooBar"))); + assertThat(oneAccount.getAccounts().get(0).getCode(), is(equalTo("123456"))); + } + + @Test + public void testCreateAccount() throws Exception { + System.out.println("@Test - createAccount"); + Account acct = new Account(); + Accounts newAccount = accountingApi.createAccount(xeroTenantId,acct); + assertThat(newAccount.getAccounts().get(0).getName(), is(equalTo("Foobar"))); + } + + @Test + public void testUpdateAccount() throws Exception { + System.out.println("@Test - updateAccount"); + UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + Accounts accts = new Accounts(); + Accounts updatedAccount = accountingApi.updateAccount(xeroTenantId,accountID, accts); + assertThat(updatedAccount.getAccounts().get(0).getName(), is(equalTo("BarFoo"))); + } + + @Test + public void testDeleteAccount() throws Exception { + System.out.println("@Test - deleteAccount"); + UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + Accounts deleteAccount = accountingApi.deleteAccount(xeroTenantId,accountID); + assertThat(deleteAccount.getAccounts().get(0).getStatus().toString(), is(equalTo("DELETED"))); + } + + @Test + public void testGetAccountAttachments() throws Exception { + System.out.println("@Test - getAccountAttachments"); + UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + Attachments accountsAttachments = accountingApi.getAccountAttachments(xeroTenantId,accountID); + assertThat(accountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("52a643be-cd5c-489f-9778-53a9fd337756"))); + assertThat(accountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); + assertThat(accountsAttachments.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); + assertThat(accountsAttachments.getAttachments().get(0).getUrl().toString(), is(equalTo("https://api.xero.com/api.xro/2.0/Accounts/da962997-a8bd-4dff-9616-01cdc199283f/Attachments/sample5.jpg"))); + + + } + + @Test + public void testCreateAccountAttachmentByFileName() throws Exception { + + System.out.println("@Test - createAccountAttachmentByFileName"); + UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + + ClassLoader classLoader = getClass().getClassLoader(); + File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + String newFileName = "sample5.jpg"; + Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(xeroTenantId,accountID, newFileName, bytes); + + assertThat(createAccountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("ab95b276-9dce-4925-9077-439818ba270f"))); + assertThat(createAccountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); + assertThat(createAccountsAttachments.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); + assertThat(createAccountsAttachments.getAttachments().get(0).getUrl().toString(), is(equalTo("https://api.xero.com/api.xro/2.0/Accounts/da962997-a8bd-4dff-9616-01cdc199283f/Attachments/sample5.jpg"))); + + } +/* + @Test + public void testUpdateAccountAttachmentByFileName() throws Exception { + System.out.println("@Test - updateAccountAttachmentByFileName"); + + UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + ClassLoader classLoader = getClass().getClassLoader(); + File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + String newFileName = "sample.jpg"; + Attachments createAccountsAttachments = accountingApi.updateAccountAttachmentByFileName(xeroTenantId, accountID, newFileName, bytes); + + assertThat(createAccountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("3fa85f64-5717-4562-b3fc-2c963f66afa6"))); + assertThat(createAccountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); + assertThat(createAccountsAttachments.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); + assertThat(createAccountsAttachments.getAttachments().get(0).getUrl().toString(), is(equalTo("https://api.xero.com/api.xro/2.0/Accounts/da962997-a8bd-4dff-9616-01cdc199283f/Attachments/sample5.jpg"))); + } + */ +} diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java new file mode 100644 index 00000000..fbb4c772 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java @@ -0,0 +1,227 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiBankTransactionTest { + + ApiClient defaultClient; + AccountingApi api; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + api = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + + public void tearDown() { + api = null; + defaultClient = null; + } + + @Test + public void testGetBankTransactions() throws Exception { + System.out.println("@Test - getBankTransactions"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + Integer page = null; + Integer unitdp = null; + BankTransactions response = api.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("db54aab0-ad40-4ced-bcff-0940ba20db2c")))); + assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); + assertThat(response.getBankTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE))); + assertThat(response.getBankTransactions().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.USD))); + assertThat(response.getBankTransactions().get(0).getIsReconciled(), is(equalTo(false))); + assertThat(response.getBankTransactions().get(0).getIsReconciled(), is(equalTo(false))); + assertThat(response.getBankTransactions().get(0).getSubTotal(), is(equalTo(10.0))); + assertThat(response.getBankTransactions().get(0).getTotal(), is(equalTo(10.0))); + //System.out.println(response.getBankTransactions().get(0).toString()); + } + + @Test + public void testGetBankTransaction() throws Exception { + System.out.println("@Test - getBankTransaction"); + UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + BankTransactions response = api.getBankTransaction(xeroTenantId, bankTransactionID); + assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("db54aab0-ad40-4ced-bcff-0940ba20db2c")))); + assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); + assertThat(response.getBankTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE))); + assertThat(response.getBankTransactions().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.USD))); + assertThat(response.getBankTransactions().get(0).getIsReconciled(), is(equalTo(false))); + assertThat(response.getBankTransactions().get(0).getSubTotal(), is(equalTo(10.0))); + assertThat(response.getBankTransactions().get(0).getTotal(), is(equalTo(10.0))); + //System.out.println(response.getBankTransactions().get(0).toString()); + } + + @Test + public void testUpdateBankTransaction() throws Exception { + System.out.println("@Test - updateBankTransaction"); + UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + BankTransactions newBankTransactions = new BankTransactions(); + BankTransactions response = api.updateBankTransaction(xeroTenantId, bankTransactionID,newBankTransactions); + + assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("1289c190-e46d-434b-9628-463ffdb52f00")))); + assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); + assertThat(response.getBankTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.BankTransaction.TypeEnum.SPEND))); + assertThat(response.getBankTransactions().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.USD))); + assertThat(response.getBankTransactions().get(0).getIsReconciled(), is(equalTo(false))); + assertThat(response.getBankTransactions().get(0).getSubTotal(), is(equalTo(18.26))); + assertThat(response.getBankTransactions().get(0).getTotal(), is(equalTo(20.00))); + //System.out.println(response.getBankTransactions().get(0).toString()); + } + + @Test + public void testCreateBankTransaction() throws Exception { + System.out.println("@Test - createBankTransaction"); + BankTransactions newBankTransactions = new BankTransactions(); + BankTransactions response = api.createBankTransaction(xeroTenantId, newBankTransactions,null); + + assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("1289c190-e46d-434b-9628-463ffdb52f00")))); + assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); + assertThat(response.getBankTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.BankTransaction.TypeEnum.SPEND))); + assertThat(response.getBankTransactions().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.USD))); + assertThat(response.getBankTransactions().get(0).getIsReconciled(), is(equalTo(false))); + assertThat(response.getBankTransactions().get(0).getSubTotal(), is(equalTo(18.26))); + assertThat(response.getBankTransactions().get(0).getTotal(), is(equalTo(20.00))); + //System.out.println(response.getBankTransactions().get(0).toString()); + } + + + @Test + public void createBankTransactionAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - createBankTransactionAttachmentByFileNameTest"); + UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + ClassLoader classLoader = getClass().getClassLoader(); + File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); + String fileName = "sample5.jpg"; + + Attachments response = api.createBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, bytes); + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b")))); + assertThat(response.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl().toString(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransactions/db54aab0-ad40-4ced-bcff-0940ba20db2c/Attachments/sample5.jpg"))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + + @Test + public void getBankTransactionAttachmentsTest() throws IOException { + System.out.println("@Test - getBankTransactionAttachmentsTest"); + UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + Attachments response = api.getBankTransactionAttachments(xeroTenantId, bankTransactionID); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransactions/db54aab0-ad40-4ced-bcff-0940ba20db2c/Attachments/sample5.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal(2878711)))); + //System.out.println(response.getAttachments().get(0).toString()); + } +/* + @Test + public void updateBankTransactionAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - updateBankTransactionAttachmentByFileNameTest"); + UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + ClassLoader classLoade2 = getClass().getClassLoader(); + File bytes = new File(classLoade2.getResource("helo-heros2.jpg").getFile()); + String fileName = "sample2.jpg"; + + Attachments response = api.updateBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, bytes); + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b")))); + assertThat(response.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl().toString(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransactions/db54aab0-ad40-4ced-bcff-0940ba20db2c/Attachments/sample5.jpg"))); + + } +*/ + @Test + public void testGetBankTransactionsHistory() throws Exception { + System.out.println("@Test - getBankTransactionsHistory"); + UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + HistoryRecords hr = api.getBankTransactionsHistory(xeroTenantId, bankTransactionID); + assertThat(hr.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); + assertThat(hr.getHistoryRecords().get(0).getChanges(), is(equalTo("Attached a file"))); + //System.out.println(hr.getHistoryRecords().toString()); + } + + @Test + public void testCreateBankTransactionHistoryRecord() throws Exception { + System.out.println("@Test - createBankTransactionHistoryRecord - not implemented"); + + /* + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords newHistory = api.createBankTransactionHistoryRecord(bankTransactionID,newHistoryRecords); + //assertThat(newHistory.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); + System.out.println(newHistory.getHistoryRecords().toString()); + */ + } + +} diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java new file mode 100644 index 00000000..e30a2d83 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java @@ -0,0 +1,201 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiBankTransferTest { + + ApiClient defaultClient; + AccountingApi api; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File bytes; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + api = new AccountingApi(defaultClient); + + ClassLoader classLoader = getClass().getClassLoader(); + bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + api = null; + defaultClient = null; + } + + @Test + public void getBankTransfersTest() throws Exception { + System.out.println("@Test - getBankTransfers"); + + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + + BankTransfers response = api.getBankTransfers(xeroTenantId,ifModifiedSince, where, order); + assertThat(response.getBankTransfers().get(0).getBankTransferID(), is(equalTo(UUID.fromString("6221458a-ef7a-4d5f-9b1c-1b96ce03833c")))); + assertThat(response.getBankTransfers().get(0).getFromBankTransactionID(), is(equalTo(UUID.fromString("a3eca480-bc04-4292-9bbd-5c57b8ba12b4")))); + assertThat(response.getBankTransfers().get(0).getToBankTransactionID(), is(equalTo(UUID.fromString("4ca13f40-f3a0-4530-a442-a600f5696118")))); + assertThat(response.getBankTransfers().get(0).getFromBankAccount().getName(), is(equalTo("Business Wells Fargo"))); + assertThat(response.getBankTransfers().get(0).getFromBankAccount().getAccountID(), is(equalTo(UUID.fromString("6f7594f2-f059-4d56-9e67-47ac9733bfe9")))); + assertThat(response.getBankTransfers().get(0).getToBankAccount().getName(), is(equalTo("My Savings"))); + assertThat(response.getBankTransfers().get(0).getToBankAccount().getAccountID(), is(equalTo(UUID.fromString("7e5e243b-9fcd-4aef-8e3a-c70be1e39bfa")))); + //System.out.println(response.getBankTransfers().get(0).toString()); + } + + @Test + public void getBankTransferTest() throws IOException { + System.out.println("@Test - getBankTransfer"); + + UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + BankTransfers response = api.getBankTransfer(xeroTenantId,bankTransferID); + assertThat(response.getBankTransfers().get(0).getBankTransferID(), is(equalTo(UUID.fromString("6221458a-ef7a-4d5f-9b1c-1b96ce03833c")))); + assertThat(response.getBankTransfers().get(0).getFromBankTransactionID(), is(equalTo(UUID.fromString("a3eca480-bc04-4292-9bbd-5c57b8ba12b4")))); + assertThat(response.getBankTransfers().get(0).getToBankTransactionID(), is(equalTo(UUID.fromString("4ca13f40-f3a0-4530-a442-a600f5696118")))); + assertThat(response.getBankTransfers().get(0).getFromBankAccount().getName(), is(equalTo("Business Wells Fargo"))); + assertThat(response.getBankTransfers().get(0).getFromBankAccount().getAccountID(), is(equalTo(UUID.fromString("6f7594f2-f059-4d56-9e67-47ac9733bfe9")))); + assertThat(response.getBankTransfers().get(0).getToBankAccount().getName(), is(equalTo("My Savings"))); + assertThat(response.getBankTransfers().get(0).getToBankAccount().getAccountID(), is(equalTo(UUID.fromString("7e5e243b-9fcd-4aef-8e3a-c70be1e39bfa")))); + //System.out.println(response.getBankTransfers().get(0).toString()); + } + + @Test + public void createBankTransferTest() throws IOException { + System.out.println("@Test - createBankTransfer"); + + BankTransfers bankTransfers = new BankTransfers(); + BankTransfers response = api.createBankTransfer(xeroTenantId,bankTransfers); + assertThat(response.getBankTransfers().get(0).getBankTransferID(), is(equalTo(UUID.fromString("76eea4b6-f026-464c-b6f3-5fb39a196145")))); + assertThat(response.getBankTransfers().get(0).getFromBankTransactionID(), is(equalTo(UUID.fromString("e4059952-5acb-4a56-b076-53fad85f2930")))); + assertThat(response.getBankTransfers().get(0).getToBankAccount().getName(), is(equalTo("Business Wells Fargo"))); + assertThat(response.getBankTransfers().get(0).getToBankAccount().getAccountID(), is(equalTo(UUID.fromString("6f7594f2-f059-4d56-9e67-47ac9733bfe9")))); + assertThat(response.getBankTransfers().get(0).getFromBankAccount().getName(), is(equalTo("My Savings"))); + assertThat(response.getBankTransfers().get(0).getFromBankAccount().getAccountID(), is(equalTo(UUID.fromString("7e5e243b-9fcd-4aef-8e3a-c70be1e39bfa")))); + //System.out.println(response.getBankTransfers().get(0).toString()); + } + @Test + public void getBankTransferHistoryTest() throws IOException { + System.out.println("@Test - getBankTransferHistoryTest"); + + UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + HistoryRecords response = api.getBankTransferHistory(xeroTenantId,bankTransferID); + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Attached a file"))); + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Attached the file sample2.jpg through the Xero API using Xero API Partner"))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void createBankTransferHistoryRecordTest() throws IOException { + System.out.println("@Test - createBankTransferHistoryRecordTest - not implemented at this time"); + + //HistoryRecords historyRecords = null; + //HistoryRecords response = api.createBankTransferHistoryRecord(bankTransferID, historyRecords); + // TODO: test validations + } + + @Test + public void createBankTransferAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - createBankTransferAttachmentByFileNameTest"); + + UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + String fileName = "sample5.jpg"; + + Attachments response = api.createBankTransferAttachmentByFileName(xeroTenantId,bankTransferID, fileName, bytes); + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("9478be4c-c707-48c1-b4a7-83d8eaf442b5")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransfers/6221458a-ef7a-4d5f-9b1c-1b96ce03833c/Attachments/sample5.jpg"))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + @Test + public void getBankTransferAttachmentsTest() throws IOException { + System.out.println("@Test - getBankTransferAttachmentsTest"); + + UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + Attachments response = api.getBankTransferAttachments(xeroTenantId,bankTransferID); + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("e05a6fd8-0e47-47a9-9799-b809c8267260")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransfers/6221458a-ef7a-4d5f-9b1c-1b96ce03833c/Attachments/HelloWorld.jpg"))); + //System.out.println(response.getAttachments().get(0).toString()); + } + /* + @Test + public void updateBankTransferAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - updateBankTransferAttachmentByFileNameTest"); + + UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + String fileName = "sample5.jpg"; + + Attachments response = api.updateBankTransferAttachmentByFileName(xeroTenantId,bankTransferID, fileName, bytes); + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("0851935c-c4c5-4de8-9247-ce22efde6f82")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/BankTransfers/6221458a-ef7a-4d5f-9b1c-1b96ce03833c/Attachments/sample5.jpg"))); + //System.out.println(response.getAttachments().get(0).toString()); + } + */ +} diff --git a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java new file mode 100644 index 00000000..40cf6b23 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java @@ -0,0 +1,134 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; + +public class AccountingApiBatchPaymentTest { + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File bytes; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + ClassLoader classLoader = getClass().getClassLoader(); + bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void testGetBatchPayment() throws Exception { + System.out.println("@Test - getBatchPayment"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + BatchPayments batchPayments = accountingApi.getBatchPayments(xeroTenantId,ifModifiedSince, where, order); + assertThat(batchPayments.getBatchPayments().get(0).getBatchPaymentID().toString(), is(equalTo("d0e9bbbf-5b8a-48b6-906a-035591fcb061"))); + assertThat(batchPayments.getBatchPayments().get(0).getReference(), is(equalTo("Hello World"))); + //System.out.println(batchPayments.getBatchPayments().toString()); + } + + @Test + public void testCreateBatchPayment() throws Exception { + System.out.println("@Test - createBatchPayment"); + + BatchPayments createBatchPayments = new BatchPayments(); + BatchPayment createBatchPayment = new BatchPayment(); + createBatchPayments.addBatchPaymentsItem(createBatchPayment); + BatchPayments newBatchPayments = accountingApi.createBatchPayment(xeroTenantId,createBatchPayments); + assertThat(newBatchPayments.getBatchPayments().get(0).getBatchPaymentID().toString(), is(equalTo("d318c343-208e-49fe-b04a-45642349bcf1"))); + assertThat(newBatchPayments.getBatchPayments().get(0).getReference(), is(equalTo("Foobar123"))); + //System.out.println(newBatchPayments.getBatchPayments().toString()); + } + + @Test + public void testGetBatchPaymentsHistory() throws Exception { + System.out.println("@Test - getBatchPaymentHistory"); + UUID batchPaymentID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + + HistoryRecords hr = accountingApi.getBatchPaymentHistory(xeroTenantId,batchPaymentID); + assertThat(hr.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); + assertThat(hr.getHistoryRecords().get(0).getChanges(), is(equalTo("Approved"))); + //System.out.println(hr.getHistoryRecords().toString()); + } + + @Test + public void testcreateBatchPaymentHistoryRecord() throws Exception { + System.out.println("@Test - createBatchPaymentHistoryRecord"); + UUID batchPaymentID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords newHistory = accountingApi.createBatchPaymentHistoryRecord(xeroTenantId,batchPaymentID,newHistoryRecords); + assertThat(newHistory.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); + //System.out.println(newHistory.getHistoryRecords().toString()); + } +} diff --git a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java new file mode 100644 index 00000000..f11e81a7 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java @@ -0,0 +1,134 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; + +public class AccountingApiBrandingThemeTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void testGetBrandingThemes() throws Exception { + System.out.println("@Test - getBrandingThemes"); + + BrandingThemes bt = accountingApi.getBrandingThemes(xeroTenantId); + assertThat(bt.getBrandingThemes().get(0).getBrandingThemeID().toString(), is(equalTo("dabc7637-62c1-4941-8a6e-ee44fa5090e7"))); + assertThat(bt.getBrandingThemes().get(0).getName(), is(equalTo("Standard"))); + //System.out.println(bt.toString()); + } + + @Test + public void testGetBrandingTheme() throws Exception { + System.out.println("@Test - getBrandingTheme"); + UUID brandingThemeId = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + + BrandingThemes oneBrandingTheme = accountingApi.getBrandingTheme(xeroTenantId,brandingThemeId); + assertThat(oneBrandingTheme.getBrandingThemes().get(0).getBrandingThemeID().toString(), is(equalTo("dabc7637-62c1-4941-8a6e-ee44fa5090e7"))); + assertThat(oneBrandingTheme.getBrandingThemes().get(0).getName(), is(equalTo("Standard"))); + //System.out.println(bt.toString()); + } + + @Test + public void testGetBrandingThemePaymentServices() throws Exception { + System.out.println("@Test - getBrandingThemePaymentServices"); + UUID brandingThemeId = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + + PaymentServices paymentServicesForBrandingTheme = accountingApi.getBrandingThemePaymentServices(xeroTenantId,brandingThemeId); + assertThat(paymentServicesForBrandingTheme.getPaymentServices().get(1).getPaymentServiceID().toString(), is(equalTo("dede7858-14e3-4a46-bf95-4d4cc491e645"))); + assertThat(paymentServicesForBrandingTheme.getPaymentServices().get(1).getPaymentServiceName(), is(equalTo("ACME Payment"))); + //System.out.println(paymentServicesForBrandingTheme.toString()); + } + + @Test + public void testCreateBrandingThemePaymentServices() throws Exception { + System.out.println("@Test - createBrandingThemePaymentServices"); + UUID brandingThemeId = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + UUID paymentServiceId = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + + PaymentService btPaymentService = new PaymentService(); + btPaymentService.setPaymentServiceID(paymentServiceId); + btPaymentService.setPaymentServiceName("ACME Payments"); + btPaymentService.setPaymentServiceUrl("http://www.mydomain.com/paymentservice"); + btPaymentService.setPayNowText("Pay Now"); + PaymentServices response = accountingApi.createBrandingThemePaymentServices(xeroTenantId,brandingThemeId, btPaymentService); + assertThat(response.getPaymentServices().get(0).getPaymentServiceID().toString(), is(equalTo("dede7858-14e3-4a46-bf95-4d4cc491e645"))); + assertThat(response.getPaymentServices().get(0).getPaymentServiceName(), is(equalTo("ACME Payments"))); + assertThat(response.getPaymentServices().get(0).getPaymentServiceUrl(), is(equalTo("https://www.payupnow.com/"))); + assertThat(response.getPaymentServices().get(0).getPayNowText(), is(equalTo("Pay Now"))); + + //System.out.println(response.toString()); + } +} diff --git a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java new file mode 100644 index 00000000..b91e722f --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java @@ -0,0 +1,168 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiContactGroupTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void getContactGroupsTest() throws IOException { + System.out.println("@Test - getContactGroupsTest"); + + String where = null; + String order = null; + ContactGroups response = accountingApi.getContactGroups(xeroTenantId, where, order); + assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("d7a86b80-8dac-4d89-a334-9dcf5753676c")))); + assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Suppliers"))); + assertThat(response.getContactGroups().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ContactGroup.StatusEnum.ACTIVE))); + //System.out.println(response.getContactGroups().get(0).toString()); + } + + @Test + public void getContactGroupTest() throws IOException { + System.out.println("@Test - getContactGroupTest"); + + UUID contactGroupID = UUID.fromString("17b44ed7-4389-4162-91cb-3dd5766e4e22"); + ContactGroups response = accountingApi.getContactGroup(xeroTenantId, contactGroupID); + + assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("17b44ed7-4389-4162-91cb-3dd5766e4e22")))); + assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Oasis"))); + assertThat(response.getContactGroups().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ContactGroup.StatusEnum.ACTIVE))); + assertThat(response.getContactGroups().get(0).getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("4e1753b9-018a-4775-b6aa-1bc7871cfee3")))); + assertThat(response.getContactGroups().get(0).getContacts().get(0).getName(), is(equalTo("Noel Gallagher"))); + assertThat(response.getContactGroups().get(0).getContacts().get(1).getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getContactGroups().get(0).getContacts().get(1).getName(), is(equalTo("Liam Gallagher"))); + //System.out.println(response.getContactGroups().get(0).toString()); + } + + @Test + public void createContactGroupTest() throws IOException { + System.out.println("@Test - createContactGroupTest"); + + ContactGroups contactGroups = new ContactGroups(); + ContactGroups response = accountingApi.createContactGroup(xeroTenantId, contactGroups); + assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("d7a86b80-8dac-4d89-a334-9dcf5753676c")))); + assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Suppliers"))); + assertThat(response.getContactGroups().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ContactGroup.StatusEnum.ACTIVE))); + //System.out.println(response.getContactGroups().get(0).toString()); + } + + @Test + public void updateContactGroupTest() throws IOException { + System.out.println("@Test - updateContactGroupTest"); + + UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); + ContactGroups contactGroups = new ContactGroups(); + ContactGroups response = accountingApi.updateContactGroup(xeroTenantId, contactGroupID, contactGroups); + assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5")))); + assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Supplier Vendor"))); + assertThat(response.getContactGroups().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ContactGroup.StatusEnum.ACTIVE))); + //System.out.println(response.getContactGroups().get(0).toString()); + } + + @Test + public void createContactGroupContactsTest() throws IOException { + System.out.println("@Test - createContactGroupContactsTest"); + + UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); + Contacts contacts = new Contacts(); + Contacts response = accountingApi.createContactGroupContacts(xeroTenantId, contactGroupID, contacts); + assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("a3675fc4-f8dd-4f03-ba5b-f1870566bcd7")))); + //System.out.println(response.getContacts().get(0).toString()); + } + + @Test + public void deleteContactGroupContactTest() throws IOException { + System.out.println("@Test - deleteContactGroupContactTest"); + + UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); + UUID contactID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); + accountingApi.deleteContactGroupContact(xeroTenantId, contactGroupID, contactID); + } + + @Test + public void deleteContactGroupContactsTest() throws IOException { + System.out.println("@Test - deleteContactGroupContactsTest"); + + UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); + accountingApi.deleteContactGroupContacts(xeroTenantId, contactGroupID); + } + +} diff --git a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java new file mode 100644 index 00000000..70b2b917 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java @@ -0,0 +1,297 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiContactsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File body; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + ClassLoader classLoader = getClass().getClassLoader(); + body = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void getContactsTest() throws IOException { + System.out.println("@Test - getContactsTest"); + + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + String ids = null; + Boolean includeArchived = null; + Contacts response = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + + assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("5cc8cf28-567e-4d43-b287-687cfcaec47c")))); + assertThat(response.getContacts().get(0).getName(), is(equalTo("Katherine Warren"))); + assertThat(response.getContacts().get(0).getFirstName(), is(equalTo("Katherine"))); + assertThat(response.getContacts().get(0).getLastName(), is(equalTo("Warren"))); + assertThat(response.getContacts().get(0).getEmailAddress(), is(equalTo("kat.warren@clampett.com"))); + assertThat(response.getContacts().get(0).getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); + assertThat(response.getContacts().get(0).getAddresses().get(1).getAddressType(), is(equalTo(com.xero.models.accounting.Address.AddressTypeEnum.POBOX))); + assertThat(response.getContacts().get(0).getAddresses().get(1).getCity(), is(equalTo("Palo Alto"))); + assertThat(response.getContacts().get(0).getAddresses().get(1).getRegion(), is(equalTo("CA"))); + assertThat(response.getContacts().get(0).getAddresses().get(1).getPostalCode(), is(equalTo("94020"))); + assertThat(response.getContacts().get(0).getAddresses().get(1).getCountry(), is(equalTo("United States"))); + assertThat(response.getContacts().get(0).getPhones().get(1).getPhoneType(), is(equalTo(com.xero.models.accounting.Phone.PhoneTypeEnum.DEFAULT))); + assertThat(response.getContacts().get(0).getPhones().get(1).getPhoneNumber(), is(equalTo("847-1294"))); + assertThat(response.getContacts().get(0).getPhones().get(1).getPhoneAreaCode(), is(equalTo("(626)"))); + assertThat(response.getContacts().get(0).getIsSupplier(), is(equalTo(true))); + assertThat(response.getContacts().get(0).getIsCustomer(), is(equalTo(true))); + assertThat(response.getContacts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-08-21T13:49:04.227-07:00")))); + assertThat(response.getContacts().get(0).getBalances().getAccountsReceivable().getOutstanding(), is(equalTo(760.0))); + assertThat(response.getContacts().get(0).getBalances().getAccountsReceivable().getOverdue(), is(equalTo(920.0))); + assertThat(response.getContacts().get(0).getBalances().getAccountsPayable().getOutstanding(), is(equalTo(231.6))); + assertThat(response.getContacts().get(0).getBalances().getAccountsPayable().getOverdue(), is(equalTo(360.0))); + assertThat(response.getContacts().get(0).getHasAttachments(), is(equalTo(false))); + //System.out.println(response.getContacts().get(0).toString()); + } + + @Test + public void getContactTest() throws IOException { + System.out.println("@Test - getContactTest"); + + UUID contactID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Contacts response = accountingApi.getContact(xeroTenantId, contactID); + + assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d")))); + assertThat(response.getContacts().get(0).getContactNumber(), is(equalTo("SB2"))); + assertThat(response.getContacts().get(0).getAccountNumber(), is(equalTo("1234567"))); + assertThat(response.getContacts().get(0).getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); + assertThat(response.getContacts().get(0).getName(), is(equalTo("Acme Parts Co."))); + assertThat(response.getContacts().get(0).getFirstName(), is(equalTo("Blake"))); + assertThat(response.getContacts().get(0).getLastName(), is(equalTo("Kohler"))); + assertThat(response.getContacts().get(0).getEmailAddress(), is(equalTo("bk@krave.co"))); + assertThat(response.getContacts().get(0).getSkypeUserName(), is(equalTo("blake"))); + assertThat(response.getContacts().get(0).getContactPersons().get(0).getFirstName(), is(equalTo("Sue"))); + assertThat(response.getContacts().get(0).getContactPersons().get(0).getLastName(), is(equalTo("Johnson"))); + assertThat(response.getContacts().get(0).getContactPersons().get(0).getEmailAddress(), is(equalTo("sue.johnson@krave.com"))); + assertThat(response.getContacts().get(0).getContactPersons().get(0).getIncludeInEmails(), is(equalTo(true))); + assertThat(response.getContacts().get(0).getBankAccountDetails(), is(equalTo("12334567"))); + assertThat(response.getContacts().get(0).getTaxNumber(), is(equalTo("123-22-3456"))); + assertThat(response.getContacts().get(0).getAccountsReceivableTaxType(), is(equalTo("TAX003"))); + assertThat(response.getContacts().get(0).getAccountsPayableTaxType(), is(equalTo("TAX022"))); + assertThat(response.getContacts().get(0).getAddresses().get(0).getAddressType(), is(equalTo(com.xero.models.accounting.Address.AddressTypeEnum.STREET))); + assertThat(response.getContacts().get(0).getAddresses().get(0).getAddressLine1(), is(equalTo("123 Fake Street"))); + assertThat(response.getContacts().get(0).getAddresses().get(0).getCity(), is(equalTo("Vancouver"))); + assertThat(response.getContacts().get(0).getAddresses().get(0).getRegion(), is(equalTo("British Columbia"))); + assertThat(response.getContacts().get(0).getAddresses().get(0).getPostalCode(), is(equalTo("V6B 2T4"))); + assertThat(response.getContacts().get(0).getPhones().get(0).getPhoneType(), is(equalTo(com.xero.models.accounting.Phone.PhoneTypeEnum.DDI))); + assertThat(response.getContacts().get(0).getPhones().get(0).getPhoneCountryCode(), is(equalTo("4"))); + assertThat(response.getContacts().get(0).getPhones().get(0).getPhoneNumber(), is(equalTo("489-44493"))); + assertThat(response.getContacts().get(0).getPhones().get(0).getPhoneAreaCode(), is(equalTo("345"))); + assertThat(response.getContacts().get(0).getIsSupplier(), is(equalTo(true))); + assertThat(response.getContacts().get(0).getIsCustomer(), is(equalTo(true))); + assertThat(response.getContacts().get(0).getDefaultCurrency(), is(equalTo(com.xero.models.accounting.CurrencyCode.USD))); + assertThat(response.getContacts().get(0).getSalesDefaultAccountCode(), is(equalTo("002"))); + assertThat(response.getContacts().get(0).getPurchasesDefaultAccountCode(), is(equalTo("660"))); + assertThat(response.getContacts().get(0).getWebsite(), is(equalTo("http://www.google.com"))); + assertThat(response.getContacts().get(0).getBrandingTheme().getBrandingThemeID(), is(equalTo(UUID.fromString("dabc7637-62c1-4941-8a6e-ee44fa5090e7")))); + assertThat(response.getContacts().get(0).getBrandingTheme().getName(), is(equalTo("Standard"))); + assertThat(response.getContacts().get(0).getBatchPayments().getDetails(), is(equalTo("biz checking"))); + assertThat(response.getContacts().get(0).getBatchPayments().getBankAccountNumber(), is(equalTo("12334567"))); + assertThat(response.getContacts().get(0).getBatchPayments().getBankAccountName(), is(equalTo("Citi Bank"))); + assertThat(response.getContacts().get(0).getDiscount(), is(equalTo(13.0))); + assertThat(response.getContacts().get(0).getBalances().getAccountsReceivable().getOutstanding(), is(equalTo(118.90))); + assertThat(response.getContacts().get(0).getBalances().getAccountsReceivable().getOverdue(), is(equalTo(136.90))); + assertThat(response.getContacts().get(0).getBalances().getAccountsPayable().getOutstanding(), is(equalTo(-43.60))); + assertThat(response.getContacts().get(0).getBalances().getAccountsPayable().getOverdue(), is(equalTo(40.00))); + assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getDay(), is(equalTo(Integer.parseInt("12")))); + assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.OFFOLLOWINGMONTH))); + assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getDay(), is(equalTo(Integer.parseInt("14")))); + assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.OFCURRENTMONTH))); + assertThat(response.getContacts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-01T09:02:57.193-08:00")))); + //System.out.println(response.getContacts().get(0).toString()); + } + + @Test + public void createContactTest() throws IOException { + System.out.println("@Test - createContactTest"); + + Contact contact = new Contact(); + Contacts response = accountingApi.createContact(xeroTenantId, contact); + assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("3ff6d40c-af9a-40a3-89ce-3c1556a25591")))); + assertThat(response.getContacts().get(0).getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); + assertThat(response.getContacts().get(0).getName(), is(equalTo("Foo9987"))); + assertThat(response.getContacts().get(0).getEmailAddress(), is(equalTo("sid32476@blah.com"))); + assertThat(response.getContacts().get(0).getPhones().get(3).getPhoneNumber(), is(equalTo("555-1212"))); + assertThat(response.getContacts().get(0).getPhones().get(3).getPhoneAreaCode(), is(equalTo("415"))); + assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getDay(), is(equalTo(Integer.parseInt("15")))); + assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.OFCURRENTMONTH))); + assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getDay(), is(equalTo(Integer.parseInt("10")))); + assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.DAYSAFTERBILLMONTH))); + //System.out.println(response.getContacts().get(0).toString()); + } + + @Test + public void updateContactTest() throws IOException { + System.out.println("@Test - updateContactTest"); + + UUID contactID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Contacts contacts = new Contacts(); + Contacts response = accountingApi.updateContact(xeroTenantId, contactID,contacts); + assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("d5be01fb-b09f-4c3a-9c67-e10c2a03412c")))); + assertThat(response.getContacts().get(0).getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); + assertThat(response.getContacts().get(0).getName(), is(equalTo("FooBar"))); + assertThat(response.getContacts().get(0).getEmailAddress(), is(equalTo("sid30680@blah.com"))); + assertThat(response.getContacts().get(0).getPhones().get(3).getPhoneType(), is(equalTo(com.xero.models.accounting.Phone.PhoneTypeEnum.MOBILE))); + assertThat(response.getContacts().get(0).getPhones().get(3).getPhoneNumber(), is(equalTo("555-1212"))); + assertThat(response.getContacts().get(0).getPhones().get(3).getPhoneAreaCode(), is(equalTo("415"))); + assertThat(response.getContacts().get(0).getIsSupplier(), is(equalTo(false))); + assertThat(response.getContacts().get(0).getIsCustomer(), is(equalTo(false))); + assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getDay(), is(equalTo(Integer.parseInt("15")))); + assertThat(response.getContacts().get(0).getPaymentTerms().getBills().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.OFCURRENTMONTH))); + assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getDay(), is(equalTo(Integer.parseInt("10")))); + assertThat(response.getContacts().get(0).getPaymentTerms().getSales().getType(), is(equalTo(com.xero.models.accounting.PaymentTermType.DAYSAFTERBILLMONTH))); + assertThat(response.getContacts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-02-28T16:27:11.763-08:00")))); + assertThat(response.getContacts().get(0).getHasValidationErrors(), is(equalTo(false))); + //System.out.println(response.getContacts().get(0).toString()); + } + + @Test + public void getContactHistoryTest() throws IOException { + System.out.println("@Test - getContactHistoryTest"); + + UUID contactID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + HistoryRecords response = accountingApi.getContactHistory(xeroTenantId, contactID); + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Edited"))); + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Name changed from Foo9987 to Bar8156."))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-02-28T16:15:22.350-08:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void createContactHistoryTest() throws IOException { + System.out.println("@Test - createContactHistoryTest - not implemented at this time"); + + UUID contactID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + HistoryRecords historyRecords = new HistoryRecords(); + HistoryRecords response = accountingApi.createContactHistory(xeroTenantId, contactID, historyRecords); + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-02-28T16:15:24.272-08:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void createContactAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - createContactAttachmentByFileNameTest"); + + UUID contactID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + String fileName = "sample5.jpg"; + + Attachments response = accountingApi.createContactAttachmentByFileName(xeroTenantId, contactID, fileName, body); + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("27e37b01-6996-4ebe-836c-95fd472ad674")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Contacts/8138a266-fb42-49b2-a104-014b7045753d/Attachments/sample5.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + + @Test + public void getContactAttachmentsTest() throws IOException { + System.out.println("@Test - getContactAttachmentsTest"); + + UUID contactID = UUID.fromString("04e0a3e3-b116-456a-9f32-9706f0d33afa"); + Attachments response = accountingApi.getContactAttachments(xeroTenantId, contactID); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("04e0a3e3-b116-456a-9f32-9706f0d33afa")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Contacts/8138a266-fb42-49b2-a104-014b7045753d/Attachments/sample5.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + + + @Test + public void getContactCISSettingsTest() throws IOException { + System.out.println("@Test - getContactCISSettingsTest - not implemented"); + + //UUID contactID = null; + //CISSettings response = api.getContactCISSettings(contactID); + + // TODO: test validations + } + +} diff --git a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java new file mode 100644 index 00000000..f371a4ea --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java @@ -0,0 +1,320 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiCreditNotesTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File body; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + ClassLoader classLoader = getClass().getClassLoader(); + body = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createCreditNoteTest() throws IOException { + System.out.println("@Test - createCreditNote"); + Boolean summarizeErrors = null; + CreditNotes creditNotes = new CreditNotes(); + CreditNotes response = accountingApi.createCreditNote(xeroTenantId, creditNotes, summarizeErrors); + + assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT))); + assertThat(response.getCreditNotes().get(0).getStatus(), is(equalTo(com.xero.models.accounting.CreditNote.StatusEnum.DRAFT))); + assertThat(response.getCreditNotes().get(0).getSubTotal(), is(equalTo(40.0))); + assertThat(response.getCreditNotes().get(0).getSubTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getCreditNotes().get(0).getTotalTax(), is(equalTo(6.0))); + assertThat(response.getCreditNotes().get(0).getTotalTax().toString(), is(equalTo("6.0"))); + assertThat(response.getCreditNotes().get(0).getTotal(), is(equalTo(46.0))); + assertThat(response.getCreditNotes().get(0).getTotal().toString(), is(equalTo("46.0"))); + assertThat(response.getCreditNotes().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T11:05:02.650-08:00")))); + assertThat(response.getCreditNotes().get(0).getCreditNoteID(), is(equalTo(UUID.fromString("f9256f04-5a99-4680-acb9-6b4639cc439a")))); + assertThat(response.getCreditNotes().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getCreditNotes().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getCreditNotes().get(0).getRemainingCredit(), is(equalTo(46.0))); + assertThat(response.getCreditNotes().get(0).getRemainingCredit().toString(), is(equalTo("46.0"))); + assertThat(response.getCreditNotes().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("An existing Credit Note with the specified CreditNoteID could not be found"))); + assertThat(response.getCreditNotes().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getCreditNotes().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getDescription(), is(equalTo("Foobar"))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getQuantity(), is(equalTo(2.0))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getTaxType(), is(equalTo("INPUT2"))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("400"))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(6.0))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(40.0))); + //System.out.println(response.getCreditNotes().get(0).toString()); + } + + @Test + public void createCreditNoteAllocationTest() throws IOException { + System.out.println("@Test - createCreditNoteAllocation"); + UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Allocations allocations = new Allocations(); + Allocations response = accountingApi.createCreditNoteAllocation(xeroTenantId, creditNoteID, allocations); + + assertThat(response.getAllocations().get(0).getAmount(), is(equalTo(1.0))); + assertThat(response.getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 04)))); + //System.out.println(response.getAllocations().get(0).toString()); + } + + @Test + public void createCreditNoteAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - createCreditNoteAttachmentByFileName"); + UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + String fileName = "sample5.jpg"; + Attachments response = accountingApi.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("91bbae3f-5de5-4e3d-875f-8662f25897bd")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/CreditNotes/249f15fa-f2a7-4acc-8769-0984103f2225/Attachments/sample5.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + + @Test + public void createCreditNoteHistoryTest() throws IOException { + System.out.println("@Test - createCreditNoteHistory"); + UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords historyRecords = new HistoryRecords(); + HistoryRecords response = accountingApi.createCreditNoteHistory(xeroTenantId, creditNoteID, historyRecords); + + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T15:29:04.585-08:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getCreditNoteTest() throws IOException { + System.out.println("@Test - getCreditNote"); + UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + CreditNotes response = accountingApi.getCreditNote(xeroTenantId, creditNoteID); + + assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCRECCREDIT))); + assertThat(response.getCreditNotes().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 04)))); + assertThat(response.getCreditNotes().get(0).getStatus(), is(equalTo(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED))); + assertThat(response.getCreditNotes().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getCreditNotes().get(0).getSubTotal(), is(equalTo(30.0))); + assertThat(response.getCreditNotes().get(0).getSubTotal().toString(), is(equalTo("30.0"))); + assertThat(response.getCreditNotes().get(0).getTotalTax(), is(equalTo(4.5))); + assertThat(response.getCreditNotes().get(0).getTotalTax().toString(), is(equalTo("4.5"))); + assertThat(response.getCreditNotes().get(0).getTotal(), is(equalTo(34.5))); + assertThat(response.getCreditNotes().get(0).getTotal().toString(), is(equalTo("34.5"))); + assertThat(response.getCreditNotes().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T10:59:06.157-08:00")))); + assertThat(response.getCreditNotes().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getCreditNotes().get(0).getCreditNoteID(), is(equalTo(UUID.fromString("249f15fa-f2a7-4acc-8769-0984103f2225")))); + assertThat(response.getCreditNotes().get(0).getCreditNoteNumber(), is(equalTo("CN-0005"))); + assertThat(response.getCreditNotes().get(0).getReference(), is(equalTo("US Tour"))); + assertThat(response.getCreditNotes().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getCreditNotes().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getCreditNotes().get(0).getRemainingCredit(), is(equalTo(32.5))); + assertThat(response.getCreditNotes().get(0).getRemainingCredit().toString(), is(equalTo("32.5"))); + assertThat(response.getCreditNotes().get(0).getHasAttachments(), is(equalTo(true))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getReference(), is(equalTo("Too much"))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 13)))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getAmount(), is(equalTo(2.0))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("6b037c9b-2e5d-4905-84d3-eabfb3438242")))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getHasAccount(), is(equalTo(false))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); + //System.out.println(response.getCreditNotes().get(0).toString()); + } + + @Test + public void getCreditNoteAttachmentsTest() throws IOException { + System.out.println("@Test - getCreditNoteAttachments"); + UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Attachments response = accountingApi.getCreditNoteAttachments(xeroTenantId, creditNoteID); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("b7eb1fc9-a0f9-4e8e-9373-6689f5350832")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.png"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/png"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/CreditNotes/249f15fa-f2a7-4acc-8769-0984103f2225/Attachments/HelloWorld.png"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("76091")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + @Test + public void getCreditNoteHistoryTest() throws IOException { + System.out.println("@Test - getCreditNoteHistory"); + UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords response = accountingApi.getCreditNoteHistory(xeroTenantId, creditNoteID); + + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Cash Refunded"))); + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Payment made to Liam Gallagher on 14 March 2019 for 2.00. There is 32.50 credit remaining on this credit note."))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T10:59:06.157-08:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + + @Test + public void getCreditNotesTest() throws IOException { + System.out.println("@Test - getCreditNotes"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + Integer page = null; + CreditNotes response = accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, page); + + assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCRECCREDIT))); + assertThat(response.getCreditNotes().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 04)))); + assertThat(response.getCreditNotes().get(0).getStatus(), is(equalTo(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED))); + assertThat(response.getCreditNotes().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getCreditNotes().get(0).getSubTotal(), is(equalTo(30.0))); + assertThat(response.getCreditNotes().get(0).getSubTotal().toString(), is(equalTo("30.0"))); + assertThat(response.getCreditNotes().get(0).getTotalTax(), is(equalTo(4.5))); + assertThat(response.getCreditNotes().get(0).getTotalTax().toString(), is(equalTo("4.5"))); + assertThat(response.getCreditNotes().get(0).getTotal(), is(equalTo(34.5))); + assertThat(response.getCreditNotes().get(0).getTotal().toString(), is(equalTo("34.5"))); + assertThat(response.getCreditNotes().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T10:59:06.157-08:00")))); + assertThat(response.getCreditNotes().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getCreditNotes().get(0).getCreditNoteID(), is(equalTo(UUID.fromString("249f15fa-f2a7-4acc-8769-0984103f2225")))); + assertThat(response.getCreditNotes().get(0).getCreditNoteNumber(), is(equalTo("CN-0005"))); + assertThat(response.getCreditNotes().get(0).getReference(), is(equalTo("US Tour"))); + assertThat(response.getCreditNotes().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getCreditNotes().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getCreditNotes().get(0).getRemainingCredit(), is(equalTo(32.5))); + assertThat(response.getCreditNotes().get(0).getRemainingCredit().toString(), is(equalTo("32.5"))); + assertThat(response.getCreditNotes().get(0).getHasAttachments(), is(equalTo(true))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getReference(), is(equalTo("Too much"))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 13)))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getAmount(), is(equalTo(2.0))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("6b037c9b-2e5d-4905-84d3-eabfb3438242")))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getHasAccount(), is(equalTo(false))); + assertThat(response.getCreditNotes().get(0).getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void updateCreditNoteTest() throws IOException { + System.out.println("@Test - updateCreditNote"); + UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + CreditNotes creditNotes = new CreditNotes(); + CreditNotes response = accountingApi.updateCreditNote(xeroTenantId, creditNoteID, creditNotes); + + assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT))); + assertThat(response.getCreditNotes().get(0).getDate(), is(equalTo(LocalDate.of(2019, 01, 04)))); + assertThat(response.getCreditNotes().get(0).getStatus(), is(equalTo(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED))); + assertThat(response.getCreditNotes().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getDescription(), is(equalTo("Foobar"))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getQuantity(), is(equalTo(2.0))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getTaxType(), is(equalTo("INPUT2"))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("400"))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(6.0))); + assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(40.0))); + assertThat(response.getCreditNotes().get(0).getSubTotal(), is(equalTo(40.0))); + assertThat(response.getCreditNotes().get(0).getSubTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getCreditNotes().get(0).getTotalTax(), is(equalTo(6.0))); + assertThat(response.getCreditNotes().get(0).getTotalTax().toString(), is(equalTo("6.0"))); + assertThat(response.getCreditNotes().get(0).getTotal(), is(equalTo(46.0))); + assertThat(response.getCreditNotes().get(0).getTotal().toString(), is(equalTo("46.0"))); + assertThat(response.getCreditNotes().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T11:05:04.223-08:00")))); + assertThat(response.getCreditNotes().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getCreditNotes().get(0).getCreditNoteID(), is(equalTo(UUID.fromString("f9256f04-5a99-4680-acb9-6b4639cc439a")))); + assertThat(response.getCreditNotes().get(0).getReference(), is(equalTo("HelloWorld"))); + assertThat(response.getCreditNotes().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getCreditNotes().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getCreditNotes().get(0).getRemainingCredit(), is(equalTo(46.0))); + assertThat(response.getCreditNotes().get(0).getRemainingCredit().toString(), is(equalTo("46.0"))); + //System.out.println(response.getCreditNotes().get(0).toString()); + } + /* + @Test + public void updateCreditNoteAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - updateCreditNoteAttachmentByFileName"); + UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + String fileName = "sample5.jpg"; + + Attachments response = accountingApi.updateCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("103e49f1-e47c-4b4d-b5e8-77d9d00fa70a")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/CreditNotes/249f15fa-f2a7-4acc-8769-0984103f2225/Attachments/HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + */ +} diff --git a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java new file mode 100644 index 00000000..3b571f08 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java @@ -0,0 +1,152 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiEmployeesTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createEmployeeTest() throws IOException { + System.out.println("@Test - createEmployee"); + Employees employees = new Employees(); + Employees response = accountingApi.createEmployee(xeroTenantId, employees); + + assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("e1ada26b-a10e-4065-a941-af34b53740e3")))); + assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); + assertThat(response.getEmployees().get(0).getFirstName(), is(equalTo("Nick"))); + assertThat(response.getEmployees().get(0).getLastName(), is(equalTo("Fury"))); + assertThat(response.getEmployees().get(0).getExternalLink().getUrl(), is(equalTo("http://twitter.com/#!/search/Nick+Fury"))); + assertThat(response.getEmployees().get(0).getExternalLink().getDescription(), is(equalTo("Go to external link"))); + assertThat(response.getEmployees().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:18:56.463-07:00")))); + //System.out.println(response.getEmployees().get(0).toString()); + } + + @Test + public void getEmployeeTest() throws IOException { + System.out.println("@Test - getEmployee"); + UUID employeeID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Employees response = accountingApi.getEmployee(xeroTenantId, employeeID); + + assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("972615c5-ad3d-47a0-b579-20370d374578")))); + assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); + assertThat(response.getEmployees().get(0).getFirstName(), is(equalTo("Tony"))); + assertThat(response.getEmployees().get(0).getLastName(), is(equalTo("Stark"))); + assertThat(response.getEmployees().get(0).getExternalLink().getUrl(), is(equalTo("http://twitter.com/#!/search/Stark+Industries"))); + assertThat(response.getEmployees().get(0).getExternalLink().getDescription(), is(equalTo("Go to external link"))); + assertThat(response.getEmployees().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:18:01.593-07:00")))); + //System.out.println(response.getEmployees().get(0).toString()); + } + + + @Test + public void getEmployeesTest() throws IOException { + System.out.println("@Test - getEmployees"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + Employees response = accountingApi.getEmployees(xeroTenantId, ifModifiedSince, where, order); + + assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("972615c5-ad3d-47a0-b579-20370d374578")))); + assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); + assertThat(response.getEmployees().get(0).getFirstName(), is(equalTo("Tony"))); + assertThat(response.getEmployees().get(0).getLastName(), is(equalTo("Stark"))); + assertThat(response.getEmployees().get(0).getExternalLink().getUrl(), is(equalTo("http://twitter.com/#!/search/Stark+Industries"))); + assertThat(response.getEmployees().get(0).getExternalLink().getDescription(), is(equalTo("Go to external link"))); + assertThat(response.getEmployees().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:18:01.593-07:00")))); + //System.out.println(response.getEmployees().get(0).toString()); + } + + @Test + public void updateEmployeeTest() throws IOException { + System.out.println("@Test - updateEmployee"); + UUID employeeID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Employees employees = new Employees(); + Employees response = accountingApi.updateEmployee(xeroTenantId, employeeID, employees); + + assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("ad3db144-6362-459c-8c36-5d31d196e629")))); + assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); + assertThat(response.getEmployees().get(0).getFirstName(), is(equalTo("Bruce"))); + assertThat(response.getEmployees().get(0).getLastName(), is(equalTo("Banner"))); + assertThat(response.getEmployees().get(0).getExternalLink().getUrl(), is(equalTo("http://twitter.com/#!/search/Nick+Fury"))); + assertThat(response.getEmployees().get(0).getExternalLink().getDescription(), is(equalTo("Go to external link"))); + assertThat(response.getEmployees().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:24:41.303-07:00")))); + //System.out.println(response.getEmployees().get(0).toString()); + } +} diff --git a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java new file mode 100644 index 00000000..d9b255a2 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java @@ -0,0 +1,226 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiExpenseClaimsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File body; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + ClassLoader classLoader = getClass().getClassLoader(); + body = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createExpenseClaimTest() throws IOException { + System.out.println("@Test - createExpenseClaim"); + ExpenseClaims expenseClaims = new ExpenseClaims(); + Boolean summarizeErrors = null; + ExpenseClaims response = accountingApi.createExpenseClaim(xeroTenantId, expenseClaims, summarizeErrors); + + assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); + assertThat(response.getExpenseClaims().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED))); + assertThat(response.getExpenseClaims().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); + assertThat(response.getExpenseClaims().get(0).getUser().getFirstName(), is(equalTo("API "))); + assertThat(response.getExpenseClaims().get(0).getUser().getLastName(), is(equalTo("Team"))); + assertThat(response.getExpenseClaims().get(0).getUser().getEmailAddress(), is(equalTo("api@xero.com"))); + assertThat(response.getExpenseClaims().get(0).getUser().getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-11-29T04:06:19.217-08:00")))); + assertThat(response.getExpenseClaims().get(0).getUser().getIsSubscriber(), is(equalTo(true))); + assertThat(response.getExpenseClaims().get(0).getUser().getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); + assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 11)))); + assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("dc1c7f6d-0a4c-402f-acac-551d62ce5816")))); + assertThat(response.getExpenseClaims().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:37:30.107-07:00")))); + assertThat(response.getExpenseClaims().get(0).getTotal(), is(equalTo(40.0))); + assertThat(response.getExpenseClaims().get(0).getTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getExpenseClaims().get(0).getAmountDue(), is(equalTo(40.0))); + assertThat(response.getExpenseClaims().get(0).getAmountDue().toString(), is(equalTo("40.0"))); + assertThat(response.getExpenseClaims().get(0).getAmountPaid(), is(equalTo(0.0))); + assertThat(response.getExpenseClaims().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); + //assertThat(response.getExpenseClaims().get(0).getPayments(), is(equalTo("CONTAINER_PLACEHOLDER"))); + //assertThat(response.getExpenseClaims().get(0).getPaymentDueDate(), is(equalTo(LocalDate.of(YYYY, MM, DD)))); + //assertThat(response.getExpenseClaims().get(0).getReportingDate(), is(equalTo(LocalDate.of(YYYY, MM, DD)))); + //assertThat(response.getExpenseClaims().get(0).getReceiptID(), is(equalTo(UUID.fromString("UUID_PLACEHOLDER")))); + //System.out.println(response.getExpenseClaims().get(0).toString()); + } + + @Test + public void createExpenseClaimHistoryTest() throws IOException { + System.out.println("@Test - createExpenseClaimHistory not implemented"); + UUID expenseClaimID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords historyRecords = new HistoryRecords(); + //HistoryRecords response = accountingApi.createExpenseClaimHistory(expenseClaimID, historyRecords); + + // TODO: test validations + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getExpenseClaimTest() throws IOException { + System.out.println("@Test - getExpenseClaim"); + UUID expenseClaimID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + ExpenseClaims response = accountingApi.getExpenseClaim(xeroTenantId, expenseClaimID); + + assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); + assertThat(response.getExpenseClaims().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED))); + assertThat(response.getExpenseClaims().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); + assertThat(response.getExpenseClaims().get(0).getUser().getFirstName(), is(equalTo("API "))); + assertThat(response.getExpenseClaims().get(0).getUser().getLastName(), is(equalTo("Team"))); + assertThat(response.getExpenseClaims().get(0).getUser().getEmailAddress(), is(equalTo("api@xero.com"))); + assertThat(response.getExpenseClaims().get(0).getUser().getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-11-29T04:06:19.217-08:00")))); + assertThat(response.getExpenseClaims().get(0).getUser().getIsSubscriber(), is(equalTo(true))); + assertThat(response.getExpenseClaims().get(0).getUser().getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); + assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 11)))); + assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("dc1c7f6d-0a4c-402f-acac-551d62ce5816")))); + assertThat(response.getExpenseClaims().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:37:31.767-07:00")))); + assertThat(response.getExpenseClaims().get(0).getTotal(), is(equalTo(40.0))); + assertThat(response.getExpenseClaims().get(0).getTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getExpenseClaims().get(0).getAmountDue(), is(equalTo(40.0))); + assertThat(response.getExpenseClaims().get(0).getAmountDue().toString(), is(equalTo("40.0"))); + assertThat(response.getExpenseClaims().get(0).getAmountPaid(), is(equalTo(0.0))); + assertThat(response.getExpenseClaims().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); + //System.out.println(response.getExpenseClaims().get(0).toString()); + } + + @Test + public void getExpenseClaimHistoryTest() throws IOException { + System.out.println("@Test - getExpenseClaimHistory"); + UUID expenseClaimID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords response = accountingApi.getExpenseClaimHistory(xeroTenantId, expenseClaimID); + + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Voided"))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:37:36.747-07:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getExpenseClaimsTest() throws IOException { + System.out.println("@Test - getExpenseClaims"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + ExpenseClaims response = accountingApi.getExpenseClaims(xeroTenantId, ifModifiedSince, where, order); + + // TODO: test validations + assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); + assertThat(response.getExpenseClaims().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED))); + assertThat(response.getExpenseClaims().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); + assertThat(response.getExpenseClaims().get(0).getUser().getFirstName(), is(equalTo("API "))); + assertThat(response.getExpenseClaims().get(0).getUser().getLastName(), is(equalTo("Team"))); + assertThat(response.getExpenseClaims().get(0).getUser().getEmailAddress(), is(equalTo("api@xero.com"))); + assertThat(response.getExpenseClaims().get(0).getUser().getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-11-29T04:06:19.217-08:00")))); + assertThat(response.getExpenseClaims().get(0).getUser().getIsSubscriber(), is(equalTo(true))); + assertThat(response.getExpenseClaims().get(0).getUser().getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); + assertThat(response.getExpenseClaims().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:37:31.767-07:00")))); + assertThat(response.getExpenseClaims().get(0).getTotal(), is(equalTo(40.0))); + assertThat(response.getExpenseClaims().get(0).getTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getExpenseClaims().get(0).getAmountDue(), is(equalTo(40.0))); + assertThat(response.getExpenseClaims().get(0).getAmountDue().toString(), is(equalTo("40.0"))); + assertThat(response.getExpenseClaims().get(0).getAmountPaid(), is(equalTo(0.0))); + assertThat(response.getExpenseClaims().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); + //System.out.println(response.getExpenseClaims().get(0).toString()); + } + + @Test + public void updateExpenseClaimTest() throws IOException { + System.out.println("@Test - updateExpenseClaim"); + UUID expenseClaimID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + ExpenseClaims expenseClaims = new ExpenseClaims(); + ExpenseClaims response = accountingApi.updateExpenseClaim(xeroTenantId, expenseClaimID, expenseClaims); + + // TODO: test validations + assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); + assertThat(response.getExpenseClaims().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED))); + assertThat(response.getExpenseClaims().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); + assertThat(response.getExpenseClaims().get(0).getUser().getFirstName(), is(equalTo("API "))); + assertThat(response.getExpenseClaims().get(0).getUser().getLastName(), is(equalTo("Team"))); + assertThat(response.getExpenseClaims().get(0).getUser().getEmailAddress(), is(equalTo("api@xero.com"))); + assertThat(response.getExpenseClaims().get(0).getUser().getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-11-29T04:06:19.217-08:00")))); + assertThat(response.getExpenseClaims().get(0).getUser().getIsSubscriber(), is(equalTo(true))); + assertThat(response.getExpenseClaims().get(0).getUser().getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); + assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 11)))); + assertThat(response.getExpenseClaims().get(0).getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("dc1c7f6d-0a4c-402f-acac-551d62ce5816")))); + assertThat(response.getExpenseClaims().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:37:31.767-07:00")))); + assertThat(response.getExpenseClaims().get(0).getTotal(), is(equalTo(40.0))); + assertThat(response.getExpenseClaims().get(0).getTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getExpenseClaims().get(0).getAmountDue(), is(equalTo(40.0))); + assertThat(response.getExpenseClaims().get(0).getAmountDue().toString(), is(equalTo("40.0"))); + assertThat(response.getExpenseClaims().get(0).getAmountPaid(), is(equalTo(0.0))); + assertThat(response.getExpenseClaims().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); + //System.out.println(response.getExpenseClaims().get(0).toString()); + } +} diff --git a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java new file mode 100644 index 00000000..1414333e --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java @@ -0,0 +1,375 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiInvoicesTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File body; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + ClassLoader classLoader = getClass().getClassLoader(); + body = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createInvoiceTest() throws IOException { + System.out.println("@Test - createInvoice"); + Invoices invoices = new Invoices(); + Boolean summarizeErrors = null; + Invoices response = accountingApi.createInvoice(xeroTenantId, invoices, summarizeErrors); + + assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); + assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 10)))); + assertThat(response.getInvoices().get(0).getDueDate(), is(equalTo(LocalDate.of(2018, 12, 9)))); + assertThat(response.getInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getInvoices().get(0).getInvoiceNumber(), is(equalTo("INV-0007"))); + assertThat(response.getInvoices().get(0).getReference(), is(equalTo("Website Design"))); + assertThat(response.getInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getInvoices().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getInvoices().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED))); + assertThat(response.getInvoices().get(0).getSentToContact(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getSubTotal(), is(equalTo(40.0))); + assertThat(response.getInvoices().get(0).getSubTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getInvoices().get(0).getTotalTax(), is(equalTo(0.0))); + assertThat(response.getInvoices().get(0).getTotalTax().toString(), is(equalTo("0.0"))); + assertThat(response.getInvoices().get(0).getTotal(), is(equalTo(40.0))); + assertThat(response.getInvoices().get(0).getTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getInvoices().get(0).getInvoiceID(), is(equalTo(UUID.fromString("ed255415-e141-4150-aab7-89c3bbbb851c")))); + assertThat(response.getInvoices().get(0).getIsDiscounted(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getAmountDue(), is(equalTo(40.0))); + assertThat(response.getInvoices().get(0).getAmountDue().toString(), is(equalTo("40.0"))); + assertThat(response.getInvoices().get(0).getAmountPaid(), is(equalTo(0.0))); + assertThat(response.getInvoices().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); + assertThat(response.getInvoices().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T10:58:46.117-07:00")))); + assertThat(response.getInvoices().get(0).getHasErrors(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getInvoices().get(0).getContact().getName(), is(equalTo("Liam Gallagher"))); + assertThat(response.getInvoices().get(0).getContact().getFirstName(), is(equalTo("Liam"))); + assertThat(response.getInvoices().get(0).getContact().getLastName(), is(equalTo("Gallagher"))); + assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getFirstName(), is(equalTo("Debbie"))); + assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getLastName(), is(equalTo("Gwyther"))); + assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getEmailAddress(), is(equalTo("debbie@rockstar.com"))); + assertThat(response.getInvoices().get(0).getContact().getContactGroups().get(0).getName(), is(equalTo("Oasis"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("5f7a612b-fdcc-4d33-90fa-a9f6bc6db32f")))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getDescription(), is(equalTo("Acme Tires"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getQuantity(), is(equalTo(2.0))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxType(), is(equalTo("NONE"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(0.))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(40.0))); + //System.out.println(response.getInvoices().get(0).toString()); + } + + @Test + public void createInvoiceHistoryTest() throws IOException { + System.out.println("@Test - createInvoiceHistory"); + UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords historyRecords = new HistoryRecords(); + HistoryRecords response = accountingApi.createInvoiceHistory(xeroTenantId, invoiceID, historyRecords); + + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T12:08:03.349-07:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getInvoiceTest() throws IOException { + System.out.println("@Test - getInvoiceTest"); + UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Invoices response = accountingApi.getInvoice(xeroTenantId, invoiceID); + + assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); + assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,06)))); + assertThat(response.getInvoices().get(0).getDueDate(), is(equalTo(LocalDate.of(2019, 03, 12)))); + assertThat(response.getInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getInvoices().get(0).getInvoiceNumber(), is(equalTo("INV-0006"))); + assertThat(response.getInvoices().get(0).getReference(), is(equalTo("Tour"))); + assertThat(response.getInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getInvoices().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getInvoices().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Invoice.StatusEnum.PAID))); + assertThat(response.getInvoices().get(0).getSentToContact(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getSubTotal(), is(equalTo(148062.76))); + assertThat(response.getInvoices().get(0).getSubTotal().toString(), is(equalTo("148062.76"))); + assertThat(response.getInvoices().get(0).getTotalTax(), is(equalTo(0.0))); + assertThat(response.getInvoices().get(0).getTotalTax().toString(), is(equalTo("0.0"))); + assertThat(response.getInvoices().get(0).getTotal(), is(equalTo(148062.76))); + assertThat(response.getInvoices().get(0).getTotal().toString(), is(equalTo("148062.76"))); + assertThat(response.getInvoices().get(0).getInvoiceID(), is(equalTo(UUID.fromString("a03ffcd2-5d91-4c7e-b483-318584e9e439")))); + assertThat(response.getInvoices().get(0).getIsDiscounted(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getAmountDue(), is(equalTo(0.0))); + assertThat(response.getInvoices().get(0).getAmountDue().toString(), is(equalTo("0.0"))); + assertThat(response.getInvoices().get(0).getAmountPaid().toString(), is(equalTo("148062.76"))); + assertThat(response.getInvoices().get(0).getAmountPaid(), is(equalTo(148062.76))); + assertThat(response.getInvoices().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-07T09:59:28.133-08:00")))); + assertThat(response.getInvoices().get(0).getHasErrors(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getInvoices().get(0).getContact().getName(), is(equalTo("Liam Gallagher"))); + assertThat(response.getInvoices().get(0).getContact().getFirstName(), is(equalTo("Liam"))); + assertThat(response.getInvoices().get(0).getContact().getLastName(), is(equalTo("Gallagher"))); + assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getFirstName(), is(equalTo("Debbie"))); + assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getLastName(), is(equalTo("Gwyther"))); + assertThat(response.getInvoices().get(0).getContact().getContactPersons().get(0).getEmailAddress(), is(equalTo("debbie@rockstar.com"))); + assertThat(response.getInvoices().get(0).getContact().getContactGroups().get(0).getName(), is(equalTo("Oasis"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("b18f39d9-7739-4246-9288-72afe939d2d5")))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getDescription(), is(equalTo("Guitars Fender Strat"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(148062.76))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getItemCode(), is(equalTo("123"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxType(), is(equalTo("NONE"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(0.0))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(148062.76))); + assertThat(response.getInvoices().get(0).getHasAttachments(), is(equalTo(true))); + assertThat(response.getInvoices().get(0).getFullyPaidOnDate(), is(equalTo(LocalDate.of(2019,03,18)))); + assertThat(response.getInvoices().get(0).getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,18)))); + assertThat(response.getInvoices().get(0).getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getInvoices().get(0).getPayments().get(0).getAmount(), is(equalTo(148062.76))); + assertThat(response.getInvoices().get(0).getPayments().get(0).getReference(), is(equalTo("Yahoo"))); + assertThat(response.getInvoices().get(0).getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("38928000-e9a0-420c-8884-f624bab2a351")))); + assertThat(response.getInvoices().get(0).getPayments().get(0).getHasAccount(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("3a2fe7e0-fac7-4ea2-afb2-31cedaabd294")))); + assertThat(response.getInvoices().get(0).getAttachments().get(0).getFileName(), is(equalTo("helo-heros.jpg"))); + assertThat(response.getInvoices().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Invoices/a03ffcd2-5d91-4c7e-b483-318584e9e439/Attachments/helo-heros.jpg"))); + assertThat(response.getInvoices().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getInvoices().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/jpeg"))); + assertThat(response.getInvoices().get(0).getStatusAttributeString(), is(equalTo("ERROR"))); + assertThat(response.getInvoices().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Invoice # must be unique."))); + //System.out.println(response.getInvoices().get(0).toString()); + } + + @Test + public void getInvoiceAttachmentsTest() throws IOException { + System.out.println("@Test - getInvoiceAttachments"); + UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Attachments response = accountingApi.getInvoiceAttachments(xeroTenantId, invoiceID); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("9808ad7f-c8d4-41cf-995e-bc29cb76fd2c")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("foobar.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Invoices/4074292c-09b3-456d-84e7-add864c6c39b/Attachments/foobar.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + @Test + public void getInvoiceHistoryTest() throws IOException { + System.out.println("@Test - getInvoiceHistory"); + UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords response = accountingApi.getInvoiceHistory(xeroTenantId, invoiceID); + + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Paid"))); + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Payment received from Liam Gallagher on 19 March 2019 for 148,062.76. This invoice has been fully paid."))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-07T09:59:28.133-08:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getInvoicesTest() throws IOException { + System.out.println("@Test - getInvoices"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + String ids = null; + String invoiceNumbers = null; + String contactIDs = null; + String statuses = null; + Integer page = null; + Boolean includeArchived = null; + Boolean createdByMyApp = null; + Integer unitdp = null; + Invoices response = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); + + assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); + assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2018,10,19)))); + assertThat(response.getInvoices().get(0).getDueDate(), is(equalTo(LocalDate.of(2018,12,29)))); + assertThat(response.getInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getInvoices().get(0).getInvoiceNumber(), is(equalTo("INV-0001"))); + assertThat(response.getInvoices().get(0).getReference(), is(equalTo("Red Fish, Blue Fish"))); + assertThat(response.getInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getInvoices().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getInvoices().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Invoice.StatusEnum.VOIDED))); + assertThat(response.getInvoices().get(0).getSentToContact(), is(equalTo(true))); + assertThat(response.getInvoices().get(0).getSubTotal(), is(equalTo(40.0))); + assertThat(response.getInvoices().get(0).getSubTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getInvoices().get(0).getTotalTax(), is(equalTo(0.0))); + assertThat(response.getInvoices().get(0).getTotalTax().toString(), is(equalTo("0.0"))); + assertThat(response.getInvoices().get(0).getTotal(), is(equalTo(40.0))); + assertThat(response.getInvoices().get(0).getTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getInvoices().get(0).getInvoiceID(), is(equalTo(UUID.fromString("d4956132-ed94-4dd7-9eaa-aa22dfdf06f2")))); + assertThat(response.getInvoices().get(0).getIsDiscounted(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getAmountDue(), is(equalTo(0.0))); + assertThat(response.getInvoices().get(0).getAmountDue().toString(), is(equalTo("0.0"))); + assertThat(response.getInvoices().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); + assertThat(response.getInvoices().get(0).getAmountPaid(), is(equalTo(0.0))); + assertThat(response.getInvoices().get(0).getAmountCredited().toString(), is(equalTo("0.0"))); + assertThat(response.getInvoices().get(0).getAmountCredited(), is(equalTo(0.0))); + assertThat(response.getInvoices().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:31:30.160-07:00")))); + assertThat(response.getInvoices().get(0).getHasErrors(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("a3675fc4-f8dd-4f03-ba5b-f1870566bcd7")))); + assertThat(response.getInvoices().get(0).getContact().getName(), is(equalTo("Barney Rubble-83203"))); + //System.out.println(response.getInvoices().get(0).toString()); + } + + @Test + public void getOnlineInvoiceTest() throws IOException { + System.out.println("@Test - getOnlineInvoice"); + UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + OnlineInvoices response = accountingApi.getOnlineInvoice(xeroTenantId, invoiceID); + + assertThat(response.getOnlineInvoices().get(0).getOnlineInvoiceUrl(), is(equalTo("https://in.xero.com/bCWCCfytGdTXoJam9HENWlQt07G6zcDaj4gQojHu"))); + //System.out.println(response.getOnlineInvoices().get(0).toString()); + } + + @Test + public void updateInvoiceTest() throws IOException { + System.out.println("@Test - updateInvoice"); + UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Invoices invoices = new Invoices(); + Invoices response = accountingApi.updateInvoice(xeroTenantId, invoiceID, invoices); + + assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); + assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,10)))); + assertThat(response.getInvoices().get(0).getDueDate(), is(equalTo(LocalDate.of(2019, 03, 11)))); + assertThat(response.getInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getInvoices().get(0).getInvoiceNumber(), is(equalTo("INV-0008"))); + assertThat(response.getInvoices().get(0).getReference(), is(equalTo("My the Force be With You"))); + assertThat(response.getInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getInvoices().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getInvoices().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Invoice.StatusEnum.SUBMITTED))); + assertThat(response.getInvoices().get(0).getSentToContact(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getSubTotal(), is(equalTo(500.0))); + assertThat(response.getInvoices().get(0).getSubTotal().toString(), is(equalTo("500.0"))); + assertThat(response.getInvoices().get(0).getTotalTax(), is(equalTo(75.0))); + assertThat(response.getInvoices().get(0).getTotalTax().toString(), is(equalTo("75.0"))); + assertThat(response.getInvoices().get(0).getTotal(), is(equalTo(575.0))); + assertThat(response.getInvoices().get(0).getTotal().toString(), is(equalTo("575.0"))); + assertThat(response.getInvoices().get(0).getInvoiceID(), is(equalTo(UUID.fromString("4074292c-09b3-456d-84e7-add864c6c39b")))); + assertThat(response.getInvoices().get(0).getIsDiscounted(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getAmountDue(), is(equalTo(575.0))); + assertThat(response.getInvoices().get(0).getAmountDue().toString(), is(equalTo("575.0"))); + assertThat(response.getInvoices().get(0).getAmountPaid().toString(), is(equalTo("0.0"))); + assertThat(response.getInvoices().get(0).getAmountPaid(), is(equalTo(0.0))); + assertThat(response.getInvoices().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T11:42:08.987-07:00")))); + assertThat(response.getInvoices().get(0).getHasErrors(), is(equalTo(false))); + assertThat(response.getInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("be392c72-c121-4f83-9512-03ac71e54c20")))); + assertThat(response.getInvoices().get(0).getContact().getName(), is(equalTo("Luke Skywalker"))); + assertThat(response.getInvoices().get(0).getContact().getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("6de1bf9f-de95-4c47-9287-37305db758c9")))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getDescription(), is(equalTo("Light Saber"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(500.00))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxType(), is(equalTo("OUTPUT2"))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(75.0))); + assertThat(response.getInvoices().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(500.00))); + //System.out.println(response.getInvoices().get(0).toString()); + } + /* + @Test + public void updateInvoiceAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - updateInvoiceAttachmentByFileName"); + UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + String fileName = "sample5.jpg"; + Attachments response = accountingApi.updateInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("08085449-fda3-45f4-a685-ff44c8a29ee3")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Invoices/4074292c-09b3-456d-84e7-add864c6c39b/Attachments/HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } +*/ + @Test + public void getInvoiceRemindersTest() throws IOException { + System.out.println("@Test - getInvoiceReminders"); + InvoiceReminders response = accountingApi.getInvoiceReminders(xeroTenantId); + + assertThat(response.getInvoiceReminders().get(0).getEnabled(), is(equalTo(false))); + //System.out.println(response.getInvoiceReminders().get(0).toString()); + } +} diff --git a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java new file mode 100644 index 00000000..ae41254d --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java @@ -0,0 +1,202 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiItemsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createItemTest() throws IOException { + System.out.println("@Test - createItem"); + Items items = new Items(); + Items response = accountingApi.createItem(xeroTenantId, items); + + assertThat(response.getItems().get(0).getCode(), is(equalTo("abc65591"))); + assertThat(response.getItems().get(0).getName(), is(equalTo("Hello11350"))); + assertThat(response.getItems().get(0).getIsSold(), is(equalTo(true))); + assertThat(response.getItems().get(0).getIsPurchased(), is(equalTo(true))); + assertThat(response.getItems().get(0).getDescription(), is(equalTo("foobar"))); + assertThat(response.getItems().get(0).getIsTrackedAsInventory(), is(equalTo(false))); + assertThat(response.getItems().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T12:17:51.707-07:00")))); + assertThat(response.getItems().get(0).getItemID(), is(equalTo(UUID.fromString("a4544d51-48f6-441f-a623-99ecbced6ab7")))); + assertThat(response.getItems().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Price List Item with Code 'abc' already exists"))); + //System.out.println(response.getItems().get(0).toString()); + } + + @Test + public void createItemHistoryTest() throws IOException { + System.out.println("@Test - createItemHistory - not implemented"); + UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords historyRecords = new HistoryRecords(); + //HistoryRecords response = accountingApi.createItemHistory(itemID, historyRecords); + // TODO: test validations + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getItemTest() throws IOException { + System.out.println("@Test - getItem"); + UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Items response = accountingApi.getItem(xeroTenantId, itemID); + + assertThat(response.getItems().get(0).getCode(), is(equalTo("123"))); + assertThat(response.getItems().get(0).getInventoryAssetAccountCode(), is(equalTo("630"))); + assertThat(response.getItems().get(0).getName(), is(equalTo("Guitars"))); + assertThat(response.getItems().get(0).getIsSold(), is(equalTo(true))); + assertThat(response.getItems().get(0).getIsPurchased(), is(equalTo(true))); + assertThat(response.getItems().get(0).getDescription(), is(equalTo("Guitars Fender Strat"))); + assertThat(response.getItems().get(0).getPurchaseDescription(), is(equalTo("Brand new Fender Strats"))); + assertThat(response.getItems().get(0).getPurchaseDetails().getUnitPrice(), is(equalTo(2500.0))); + assertThat(response.getItems().get(0).getPurchaseDetails().getCoGSAccountCode(), is(equalTo("310"))); + assertThat(response.getItems().get(0).getPurchaseDetails().getTaxType(), is(equalTo("INPUT2"))); + assertThat(response.getItems().get(0).getSalesDetails().getUnitPrice(), is(equalTo(5000.0))); + assertThat(response.getItems().get(0).getSalesDetails().getAccountCode(), is(equalTo("200"))); + assertThat(response.getItems().get(0).getSalesDetails().getTaxType(), is(equalTo("OUTPUT2"))); + assertThat(response.getItems().get(0).getIsTrackedAsInventory(), is(equalTo(true))); + assertThat(response.getItems().get(0).getTotalCostPool(), is(equalTo(25000.0))); + assertThat(response.getItems().get(0).getTotalCostPool().toString(), is(equalTo("25000.0"))); + assertThat(response.getItems().get(0).getQuantityOnHand(), is(equalTo(10.0))); + assertThat(response.getItems().get(0).getQuantityOnHand().toString(), is(equalTo("10.0"))); + assertThat(response.getItems().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T12:41:49.387-07:00")))); + assertThat(response.getItems().get(0).getItemID(), is(equalTo(UUID.fromString("c8c54d65-f3f2-452d-926e-bf450b12fb07")))); + //System.out.println(response.getItems().get(0).toString()); + } + + @Test + public void getItemHistoryTest() throws IOException { + System.out.println("@Test - getItemHistory"); + UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords response = accountingApi.getItemHistory(xeroTenantId, itemID); + + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Created"))); + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Item 123 - Guitars created."))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-07T09:57:56-08:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getItemsTest() throws IOException { + System.out.println("@Test - getItems"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + Integer unitdp = null; + Items response = accountingApi.getItems(xeroTenantId, ifModifiedSince, where, order, unitdp); + + assertThat(response.getItems().get(0).getCode(), is(equalTo("123"))); + assertThat(response.getItems().get(0).getName(), is(equalTo("Guitars"))); + assertThat(response.getItems().get(0).getIsSold(), is(equalTo(true))); + assertThat(response.getItems().get(0).getIsPurchased(), is(equalTo(false))); + assertThat(response.getItems().get(0).getDescription(), is(equalTo("Guitars Fender Strat"))); + assertThat(response.getItems().get(0).getSalesDetails().getUnitPrice(), is(equalTo(5000.0))); + assertThat(response.getItems().get(0).getSalesDetails().getAccountCode(), is(equalTo("200"))); + assertThat(response.getItems().get(0).getSalesDetails().getTaxType(), is(equalTo("OUTPUT2"))); + assertThat(response.getItems().get(0).getIsTrackedAsInventory(), is(equalTo(false))); + assertThat(response.getItems().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-07T09:57:56.267-08:00")))); + assertThat(response.getItems().get(0).getItemID(), is(equalTo(UUID.fromString("c8c54d65-f3f2-452d-926e-bf450b12fb07")))); + //System.out.println(response.getItems().get(0).toString()); + } + + @Test + public void updateItemTest() throws IOException { + System.out.println("@Test - updateItem"); + UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Items items = new Items(); + Items response = accountingApi.updateItem(xeroTenantId, itemID, items); + + assertThat(response.getItems().get(0).getCode(), is(equalTo("abc38306"))); + assertThat(response.getItems().get(0).getName(), is(equalTo("Hello8746"))); + assertThat(response.getItems().get(0).getIsSold(), is(equalTo(true))); + assertThat(response.getItems().get(0).getIsPurchased(), is(equalTo(true))); + assertThat(response.getItems().get(0).getDescription(), is(equalTo("Hello Xero"))); + assertThat(response.getItems().get(0).getIsTrackedAsInventory(), is(equalTo(false))); + assertThat(response.getItems().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T12:29:18.924-07:00")))); + assertThat(response.getItems().get(0).getItemID(), is(equalTo(UUID.fromString("a7e87086-e0ae-4df2-83d7-e26e9a6b7786")))); + //System.out.println(response.getItems().get(0).toString()); + } + + @Test + public void deleteItemTest() throws IOException { + System.out.println("@Test - deleteItem"); + UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + accountingApi.deleteItem(xeroTenantId, itemID); + } +} diff --git a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java new file mode 100644 index 00000000..a8590ba5 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java @@ -0,0 +1,165 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiJournalsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void getJournalTest() throws IOException { + System.out.println("@Test - getJournal"); + UUID journalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Journals response = accountingApi.getJournal(xeroTenantId, journalID); + + assertThat(response.getJournals().get(0).getJournalID(), is(equalTo(UUID.fromString("1b31feeb-aa23-404c-8c19-24c827c53661")))); + assertThat(response.getJournals().get(0).getJournalDate(), is(equalTo(LocalDate.of(2018,10,19)))); + assertThat(response.getJournals().get(0).getJournalNumber(), is(equalTo("1"))); + assertThat(response.getJournals().get(0).getCreatedDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:30:43.467-07:00")))); + assertThat(response.getJournals().get(0).getReference(), is(equalTo("Red Fish, Blue Fish"))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getJournalLineID(), is(equalTo(UUID.fromString("81e6b1bf-d812-4f87-8dc4-698558ae043e")))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountID(), is(equalTo(UUID.fromString("b94495d0-44ab-4199-a1d0-427a4877e100")))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountCode(), is(equalTo("610"))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountType(), is(equalTo(com.xero.models.accounting.AccountType.CURRENT))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountName(), is(equalTo("Accounts Receivable"))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getNetAmount(), is(equalTo(40.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getNetAmount().toString(), is(equalTo("40.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getGrossAmount(), is(equalTo(40.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getGrossAmount().toString(), is(equalTo("40.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getTaxAmount(), is(equalTo(0.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getTaxAmount().toString(), is(equalTo("0.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getJournalLineID(), is(equalTo(UUID.fromString("ad221a8c-ebee-4c1b-88ed-d574e27e8803")))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountID(), is(equalTo(UUID.fromString("e0a5d892-9f9f-44f0-a153-5cb7db125170")))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountCode(), is(equalTo("200"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountType(), is(equalTo(com.xero.models.accounting.AccountType.REVENUE))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountName(), is(equalTo("Sales"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getDescription(), is(equalTo("Acme Tires"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getNetAmount(), is(equalTo(-40.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getNetAmount().toString(), is(equalTo("-40.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getGrossAmount(), is(equalTo(-40.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getGrossAmount().toString(), is(equalTo("-40.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxAmount(), is(equalTo(0.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxAmount().toString(), is(equalTo("0.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxType(), is(equalTo("NONE"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxName(), is(equalTo("No GST"))); + //System.out.println(response.getJournals().get(0).toString()); + } + + + @Test + public void getJournalsTest() throws IOException { + System.out.println("@Test - getJournals"); + OffsetDateTime ifModifiedSince = null; + Integer offset = null; + Boolean paymentsOnly = null; + Journals response = accountingApi.getJournals(xeroTenantId, ifModifiedSince, offset, paymentsOnly); + + assertThat(response.getJournals().get(0).getJournalID(), is(equalTo(UUID.fromString("1b31feeb-aa23-404c-8c19-24c827c53661")))); + assertThat(response.getJournals().get(0).getJournalDate(), is(equalTo(LocalDate.of(2018,10,19)))); + assertThat(response.getJournals().get(0).getJournalNumber(), is(equalTo("1"))); + assertThat(response.getJournals().get(0).getCreatedDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:30:43.467-07:00")))); + assertThat(response.getJournals().get(0).getReference(), is(equalTo("Red Fish, Blue Fish"))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getJournalLineID(), is(equalTo(UUID.fromString("81e6b1bf-d812-4f87-8dc4-698558ae043e")))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountID(), is(equalTo(UUID.fromString("b94495d0-44ab-4199-a1d0-427a4877e100")))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountCode(), is(equalTo("610"))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountType(), is(equalTo(com.xero.models.accounting.AccountType.CURRENT))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getAccountName(), is(equalTo("Accounts Receivable"))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getNetAmount(), is(equalTo(40.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getNetAmount().toString(), is(equalTo("40.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getGrossAmount(), is(equalTo(40.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getGrossAmount().toString(), is(equalTo("40.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getTaxAmount(), is(equalTo(0.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(0).getTaxAmount().toString(), is(equalTo("0.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getJournalLineID(), is(equalTo(UUID.fromString("ad221a8c-ebee-4c1b-88ed-d574e27e8803")))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountID(), is(equalTo(UUID.fromString("e0a5d892-9f9f-44f0-a153-5cb7db125170")))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountCode(), is(equalTo("200"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountType(), is(equalTo(com.xero.models.accounting.AccountType.REVENUE))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getAccountName(), is(equalTo("Sales"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getDescription(), is(equalTo("Acme Tires"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getNetAmount(), is(equalTo(-40.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getNetAmount().toString(), is(equalTo("-40.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getGrossAmount(), is(equalTo(-40.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getGrossAmount().toString(), is(equalTo("-40.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxAmount(), is(equalTo(0.0))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxAmount().toString(), is(equalTo("0.0"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxType(), is(equalTo("NONE"))); + assertThat(response.getJournals().get(0).getJournalLines().get(1).getTaxName(), is(equalTo("No GST"))); + //System.out.println(response.getJournals().get(0).toString()); + } +} diff --git a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java new file mode 100644 index 00000000..c8811f7e --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java @@ -0,0 +1,169 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiLinkedTransactionsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createLinkedTransactionTest() throws IOException { + System.out.println("@Test - createLinkedTransaction"); + LinkedTransactions linkedTransactions = new LinkedTransactions(); + LinkedTransactions response = accountingApi.createLinkedTransaction(xeroTenantId, linkedTransactions); + + assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("a848644a-f20f-4630-98c3-386bd7505631")))); + assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("b0df260d-3cc8-4ced-9bd6-41924f624ed3")))); + assertThat(response.getLinkedTransactions().get(0).getLinkedTransactionID(), is(equalTo(UUID.fromString("e9684b6c-4df9-45a0-917b-85cc29857008")))); + assertThat(response.getLinkedTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.LinkedTransaction.StatusEnum.DRAFT))); + assertThat(response.getLinkedTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.LinkedTransaction.TypeEnum.BILLABLEEXPENSE))); + assertThat(response.getLinkedTransactions().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T17:37:35-07:00")))); + assertThat(response.getLinkedTransactions().get(0).getSourceTransactionTypeCode(), is(equalTo(com.xero.models.accounting.LinkedTransaction.SourceTransactionTypeCodeEnum.ACCPAY))); + assertThat(response.getLinkedTransactions().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("The SourceLineItemID and SourceTransactionID do not match"))); + //System.out.println(response.getLinkedTransactions().get(0).toString()); + } + + @Test + public void deleteLinkedTransactionTest() throws IOException { + System.out.println("@Test - deleteLinkedTransaction"); + UUID linkedTransactionID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + accountingApi.deleteLinkedTransaction(xeroTenantId, linkedTransactionID); + } + + @Test + public void getLinkedTransactionTest() throws IOException { + System.out.println("@Test - getLinkedTransaction"); + UUID linkedTransactionID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + LinkedTransactions response = accountingApi.getLinkedTransaction(xeroTenantId, linkedTransactionID); + + assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("aec416dd-38ea-40dc-9f0b-813c8c71f87f")))); + assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("77e0b23b-5b79-4f4b-ae20-c9031d41442f")))); + assertThat(response.getLinkedTransactions().get(0).getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getLinkedTransactions().get(0).getTargetTransactionID(), is(equalTo(UUID.fromString("83693fc1-5b05-4807-b190-109d4a85dd5f")))); + assertThat(response.getLinkedTransactions().get(0).getTargetLineItemID(), is(equalTo(UUID.fromString("d5128ff1-0f39-4d2a-a6d5-46dfaf5f075c")))); + assertThat(response.getLinkedTransactions().get(0).getLinkedTransactionID(), is(equalTo(UUID.fromString("5cf7d9c0-b9a7-4433-a2dc-ae3c11bba39b")))); + assertThat(response.getLinkedTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.LinkedTransaction.StatusEnum.ONDRAFT))); + assertThat(response.getLinkedTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.LinkedTransaction.TypeEnum.BILLABLEEXPENSE))); + assertThat(response.getLinkedTransactions().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T16:46:31-07:00")))); + assertThat(response.getLinkedTransactions().get(0).getSourceTransactionTypeCode(), is(equalTo(com.xero.models.accounting.LinkedTransaction.SourceTransactionTypeCodeEnum.ACCPAY))); + //System.out.println(response.getLinkedTransactions().get(0).toString()); + } + + @Test + public void getLinkedTransactionsTest() throws IOException { + System.out.println("@Test - getLinkedTransactions"); + Integer page = null; + String linkedTransactionID = null; + String sourceTransactionID = null; + String contactID = null; + String status = null; + String targetTransactionID = null; + LinkedTransactions response = accountingApi.getLinkedTransactions(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); + + assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("aec416dd-38ea-40dc-9f0b-813c8c71f87f")))); + assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("77e0b23b-5b79-4f4b-ae20-c9031d41442f")))); + assertThat(response.getLinkedTransactions().get(0).getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getLinkedTransactions().get(0).getTargetTransactionID(), is(equalTo(UUID.fromString("83693fc1-5b05-4807-b190-109d4a85dd5f")))); + assertThat(response.getLinkedTransactions().get(0).getTargetLineItemID(), is(equalTo(UUID.fromString("d5128ff1-0f39-4d2a-a6d5-46dfaf5f075c")))); + assertThat(response.getLinkedTransactions().get(0).getLinkedTransactionID(), is(equalTo(UUID.fromString("5cf7d9c0-b9a7-4433-a2dc-ae3c11bba39b")))); + assertThat(response.getLinkedTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.LinkedTransaction.StatusEnum.ONDRAFT))); + assertThat(response.getLinkedTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.LinkedTransaction.TypeEnum.BILLABLEEXPENSE))); + assertThat(response.getLinkedTransactions().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T16:46:31-07:00")))); + assertThat(response.getLinkedTransactions().get(0).getSourceTransactionTypeCode(), is(equalTo(com.xero.models.accounting.LinkedTransaction.SourceTransactionTypeCodeEnum.ACCPAY))); + //System.out.println(response.getLinkedTransactions().get(0).toString()); + } + + @Test + public void updateLinkedTransactionTest() throws IOException { + System.out.println("@Test - updateLinkedTransaction"); + UUID linkedTransactionID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + LinkedTransactions linkedTransactions = new LinkedTransactions(); + LinkedTransactions response = accountingApi.updateLinkedTransaction(xeroTenantId, linkedTransactionID, linkedTransactions); + + assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("a848644a-f20f-4630-98c3-386bd7505631")))); + assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("b0df260d-3cc8-4ced-9bd6-41924f624ed3")))); + assertThat(response.getLinkedTransactions().get(0).getContactID(), is(equalTo(UUID.fromString("4e1753b9-018a-4775-b6aa-1bc7871cfee3")))); + assertThat(response.getLinkedTransactions().get(0).getLinkedTransactionID(), is(equalTo(UUID.fromString("e9684b6c-4df9-45a0-917b-85cc29857008")))); + assertThat(response.getLinkedTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.LinkedTransaction.StatusEnum.DRAFT))); + assertThat(response.getLinkedTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.LinkedTransaction.TypeEnum.BILLABLEEXPENSE))); + assertThat(response.getLinkedTransactions().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T17:37:35-07:00")))); + assertThat(response.getLinkedTransactions().get(0).getSourceTransactionTypeCode(), is(equalTo(com.xero.models.accounting.LinkedTransaction.SourceTransactionTypeCodeEnum.ACCPAY))); + //System.out.println(response.getLinkedTransactions().get(0).toString()); + } +} \ No newline at end of file diff --git a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java new file mode 100644 index 00000000..473be892 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java @@ -0,0 +1,255 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiManualJournalsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File body; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + ClassLoader classLoader = getClass().getClassLoader(); + body = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createManualJournalTest() throws IOException { + System.out.println("@Test - createManualJournal"); + ManualJournals manualJournals = new ManualJournals(); + ManualJournals response = accountingApi.createManualJournal(xeroTenantId, manualJournals); + + assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Foo bar"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount(), is(equalTo(100.0))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount().toString(), is(equalTo("100.0"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getAccountCode(), is(equalTo("400"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getDescription(), is(equalTo("Hello there"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getTaxType(), is(equalTo("NONE"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getIsBlank(), is(equalTo(false))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount(), is(equalTo(-100.0))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount().toString(), is(equalTo("-100.0"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getAccountCode(), is(equalTo("400"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getDescription(), is(equalTo("Goodbye"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTaxType(), is(equalTo("NONE"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTracking().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("6a68adde-f210-4465-b0a9-0d8cc6f50762")))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTracking().get(0).getTrackingOptionID(), is(equalTo(UUID.fromString("dc54c220-0140-495a-b925-3246adc0075f")))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTracking().get(0).getName(), is(equalTo("Simpsons"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTracking().get(0).getOption(), is(equalTo("Bart"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getIsBlank(), is(equalTo(false))); + assertThat(response.getManualJournals().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,13)))); + assertThat(response.getManualJournals().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); + assertThat(response.getManualJournals().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ManualJournal.StatusEnum.DRAFT))); + assertThat(response.getManualJournals().get(0).getShowOnCashBasisReports(), is(equalTo(true))); + assertThat(response.getManualJournals().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-14T13:39:32.920-07:00")))); + assertThat(response.getManualJournals().get(0).getManualJournalID(), is(equalTo(UUID.fromString("d312dd5e-a53e-46d1-9d51-c569ef4570b7")))); + assertThat(response.getManualJournals().get(0).getWarnings().get(0).getMessage(), is(equalTo("Account code '476' has been removed as it does not match a recognised account."))); + assertThat(response.getManualJournals().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("The total debits (100.00) must equal total credits (-10.00)"))); + //System.out.println(response.getManualJournals().get(0).toString()); + } + + + @Test + public void createManualJournalAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - createManualJournalAttachmentByFileName"); + UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + String fileName = "sample5.jpg"; + Attachments response = accountingApi.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("47ac97ff-d4f9-48a0-8a8e-49fae29129e7")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("foobar.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/ManualJournals/0b159335-606b-485f-b51b-97b3b32bad32/Attachments/foobar.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + @Test + public void getManualJournalTest() throws IOException { + System.out.println("@Test - getManualJournal"); + UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + ManualJournals response = accountingApi.getManualJournal(xeroTenantId, manualJournalID); + + assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("These aren't the droids you are looking for"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount(), is(equalTo(100.0))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount().toString(), is(equalTo("100.0"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getAccountCode(), is(equalTo("429"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getDescription(), is(equalTo("These aren't the droids you are looking for"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getTaxType(), is(equalTo("NONE"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getIsBlank(), is(equalTo(false))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount(), is(equalTo(-100.0))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount().toString(), is(equalTo("-100.0"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getAccountCode(), is(equalTo("200"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getDescription(), is(equalTo("Yes the are"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTaxType(), is(equalTo("NONE"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getIsBlank(), is(equalTo(false))); + assertThat(response.getManualJournals().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); + assertThat(response.getManualJournals().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); + assertThat(response.getManualJournals().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ManualJournal.StatusEnum.POSTED))); + assertThat(response.getManualJournals().get(0).getShowOnCashBasisReports(), is(equalTo(true))); + assertThat(response.getManualJournals().get(0).getHasAttachments(), is(equalTo(true))); + assertThat(response.getManualJournals().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T19:19:48.147-07:00")))); + assertThat(response.getManualJournals().get(0).getManualJournalID(), is(equalTo(UUID.fromString("99cb8353-ce73-4a5d-8e0d-8b0edf86cfc4")))); + assertThat(response.getManualJournals().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("166ca8f8-8bc6-4780-8466-a0e474d586ea")))); + assertThat(response.getManualJournals().get(0).getAttachments().get(0).getFileName(), is(equalTo("giphy.gif"))); + assertThat(response.getManualJournals().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/manualjournal/99cb8353-ce73-4a5d-8e0d-8b0edf86cfc4/Attachments/giphy.gif"))); + assertThat(response.getManualJournals().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/gif"))); + assertThat(response.getManualJournals().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("495727")))); + //System.out.println(response.getManualJournals().get(0).toString()); + } + + @Test + public void getManualJournalAttachmentsTest() throws IOException { + System.out.println("@Test - getManualJournalAttachments"); + UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Attachments response = accountingApi.getManualJournalAttachments(xeroTenantId, manualJournalID); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("16e86f32-3e25-4209-8662-c0dfd91b654c")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/ManualJournals/0b159335-606b-485f-b51b-97b3b32bad32/Attachments/HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + @Test + public void getManualJournalsTest() throws IOException { + System.out.println("@Test - getManualJournals"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + Integer page = null; + ManualJournals response = accountingApi.getManualJournals(xeroTenantId, ifModifiedSince, where, order, page); + + assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Reversal: These aren't the droids you are looking for"))); + assertThat(response.getManualJournals().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,20)))); + assertThat(response.getManualJournals().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); + assertThat(response.getManualJournals().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ManualJournal.StatusEnum.POSTED))); + assertThat(response.getManualJournals().get(0).getShowOnCashBasisReports(), is(equalTo(true))); + assertThat(response.getManualJournals().get(0).getHasAttachments(), is(equalTo(false))); + assertThat(response.getManualJournals().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T19:19:48.083-07:00")))); + assertThat(response.getManualJournals().get(0).getManualJournalID(), is(equalTo(UUID.fromString("0b159335-606b-485f-b51b-97b3b32bad32")))); + //System.out.println(response.getManualJournals().get(0).toString()); + } + + @Test + public void updateManualJournalTest() throws IOException { + System.out.println("@Test - updateManualJournal"); + UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + ManualJournals manualJournals = new ManualJournals(); + ManualJournals response = accountingApi.updateManualJournal(xeroTenantId, manualJournalID, manualJournals); + + assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Hello Xero"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount(), is(equalTo(100.0))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount().toString(), is(equalTo("100.0"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getAccountCode(), is(equalTo("400"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getDescription(), is(equalTo("Hello there"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getTaxType(), is(equalTo("NONE"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getIsBlank(), is(equalTo(false))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount(), is(equalTo(-100.0))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount().toString(), is(equalTo("-100.0"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getAccountCode(), is(equalTo("400"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getDescription(), is(equalTo("Goodbye"))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getTaxType(), is(equalTo("NONE"))); + assertThat(response.getManualJournals().get(0).getHasAttachments(), is(equalTo(false))); + assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getIsBlank(), is(equalTo(false))); + assertThat(response.getManualJournals().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,10)))); + assertThat(response.getManualJournals().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); + assertThat(response.getManualJournals().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ManualJournal.StatusEnum.DRAFT))); + assertThat(response.getManualJournals().get(0).getShowOnCashBasisReports(), is(equalTo(true))); + assertThat(response.getManualJournals().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T19:28:56.820-07:00")))); + assertThat(response.getManualJournals().get(0).getManualJournalID(), is(equalTo(UUID.fromString("07eac261-78ef-47a0-a0eb-a57b74137877")))); + //System.out.println(response.getManualJournals().get(0).toString()); + } + /* + @Test + public void updateManualJournalAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - updateManualJournalAttachmentByFileName"); + UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + String fileName = "sample5.jpg"; + Attachments response = accountingApi.updateManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("16e86f32-3e25-4209-8662-c0dfd91b654c")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/ManualJournals/0b159335-606b-485f-b51b-97b3b32bad32/Attachments/HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + */ +} diff --git a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java new file mode 100644 index 00000000..ce733ba8 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java @@ -0,0 +1,124 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiOrganisationsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void getOrganisationsTest() throws IOException { + System.out.println("@Test - getOrganisations"); + Organisations response = accountingApi.getOrganisations(xeroTenantId); + + assertThat(response.getOrganisations().get(0).getOrganisationID(), is(equalTo(UUID.fromString("b2c885a9-4bb9-4a00-9b6e-6c2bf60b1a2b")))); + assertThat(response.getOrganisations().get(0).getApIKey(), is(equalTo("CTJ60UH519MXQIXEJSDPDALS3EOZ5Y"))); + assertThat(response.getOrganisations().get(0).getName(), is(equalTo("Dev Evangelist - Sid Test 3 (NZ-2016-02)"))); + assertThat(response.getOrganisations().get(0).getLegalName(), is(equalTo("Dev Evangelist - Sid Test 3 (NZ-2016-02)"))); + assertThat(response.getOrganisations().get(0).getPaysTax(), is(equalTo(true))); + assertThat(response.getOrganisations().get(0).getVersion(), is(equalTo(com.xero.models.accounting.Organisation.VersionEnum.NZ))); + assertThat(response.getOrganisations().get(0).getOrganisationType(), is(equalTo(com.xero.models.accounting.Organisation.OrganisationTypeEnum.COMPANY))); + assertThat(response.getOrganisations().get(0).getBaseCurrency(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getOrganisations().get(0).getCountryCode(), is(equalTo(com.xero.models.accounting.CountryCode.NZ))); + assertThat(response.getOrganisations().get(0).getIsDemoCompany(), is(equalTo(false))); + assertThat(response.getOrganisations().get(0).getOrganisationStatus(), is(equalTo("ACTIVE"))); + assertThat(response.getOrganisations().get(0).getFinancialYearEndDay(), is(equalTo(31))); + assertThat(response.getOrganisations().get(0).getFinancialYearEndMonth(), is(equalTo(3))); + assertThat(response.getOrganisations().get(0).getTaxNumber(), is(equalTo("071-138-054"))); + assertThat(response.getOrganisations().get(0).getSalesTaxBasis(), is(equalTo(com.xero.models.accounting.Organisation.SalesTaxBasisEnum.PAYMENTS))); + assertThat(response.getOrganisations().get(0).getSalesTaxPeriod(), is(equalTo(com.xero.models.accounting.Organisation.SalesTaxPeriodEnum.TWOMONTHS))); + assertThat(response.getOrganisations().get(0).getDefaultSalesTax(), is(equalTo("Tax Exclusive"))); + assertThat(response.getOrganisations().get(0).getDefaultPurchasesTax(), is(equalTo("Tax Exclusive"))); + assertThat(response.getOrganisations().get(0).getPeriodLockDate(), is(equalTo(LocalDate.of(2018,12,30)))); + assertThat(response.getOrganisations().get(0).getEndOfYearLockDate(), is(equalTo(LocalDate.of(2018,12,30)))); + assertThat(response.getOrganisations().get(0).getCreatedDateUTC(), is(equalTo(OffsetDateTime.parse("2016-02-18T12:29:53-08:00")))); + assertThat(response.getOrganisations().get(0).getTimezone(), is(equalTo(com.xero.models.accounting.TimeZone.NEWZEALANDSTANDARDTIME))); + assertThat(response.getOrganisations().get(0).getOrganisationEntityType(), is(equalTo(com.xero.models.accounting.Organisation.OrganisationEntityTypeEnum.COMPANY))); + assertThat(response.getOrganisations().get(0).getShortCode(), is(equalTo("!mBdtL"))); + assertThat(response.getOrganisations().get(0).getPropertyClass(), is(equalTo(com.xero.models.accounting.Organisation.PropertyClassEnum.PREMIUM))); + assertThat(response.getOrganisations().get(0).getEdition(), is(equalTo(com.xero.models.accounting.Organisation.EditionEnum.BUSINESS))); + //assertThat(response.getOrganisations().get(0).getRegistrationNumber(), is(equalTo("STRING_ONLY_PLACEHOLDER"))); + //assertThat(response.getOrganisations().get(0).getLineOfBusiness(), is(equalTo("STRING_ONLY_PLACEHOLDER"))); + //assertThat(response.getOrganisations().get(0).getAddresses(), is(equalTo("CONTAINER_PLACEHOLDER"))); + //assertThat(response.getOrganisations().get(0).getPhones(), is(equalTo("CONTAINER_PLACEHOLDER"))); + //assertThat(response.getOrganisations().get(0).getExternalLinks(), is(equalTo("CONTAINER_PLACEHOLDER"))); + //assertThat(response.getOrganisations().get(0).getPaymentTerms(), is(equalTo("MODEL_PLACEHOLDER"))); + //System.out.println(response.getOrganisations().get(0).toString()); + } +} diff --git a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java new file mode 100644 index 00000000..9fd654b6 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java @@ -0,0 +1,196 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiOverpaymentsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File body; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + ClassLoader classLoader = getClass().getClassLoader(); + body = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createOverpaymentAllocationTest() throws IOException { + System.out.println("@Test - createOverpaymentAllocation"); + UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Allocations allocations = new Allocations(); + Allocations response = accountingApi.createOverpaymentAllocation(xeroTenantId, overpaymentID, allocations); + + // TODO: test validations + assertThat(response.getAllocations().get(0).getInvoice().getInvoiceID(), is(equalTo(UUID.fromString("c45720a1-ade3-4a38-a064-d15489be6841")))); + assertThat(response.getAllocations().get(0).getAmount(), is(equalTo(1.0))); + assertThat(response.getAllocations().get(0).getAmount().toString(), is(equalTo("1.0"))); + assertThat(response.getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); + //System.out.println(response.getAllocations().get(0).toString()); + } + + @Test + public void createOverpaymentHistoryTest() throws IOException { + System.out.println("@Test - createOverpaymentHistory - this is not implemented"); + UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords historyRecords = new HistoryRecords(); + //HistoryRecords response = accountingApi.createOverpaymentHistory(overpaymentID, historyRecords); + // TODO: test validations + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getOverpaymentTest() throws IOException { + System.out.println("@Test - getOverpayment"); + UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Overpayments response = accountingApi.getOverpayment(xeroTenantId, overpaymentID); + + //assertThat(response.getOverpayments().get(0).getType(), is(equalTo(com.xero.models.accounting.Overpayment.TypeEnum.SPEND-OVERPAYMENT))); + assertThat(response.getOverpayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); + assertThat(response.getOverpayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Overpayment.StatusEnum.AUTHORISED))); + assertThat(response.getOverpayments().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); + assertThat(response.getOverpayments().get(0).getSubTotal(), is(equalTo(3000.0))); + assertThat(response.getOverpayments().get(0).getSubTotal().toString(), is(equalTo("3000.0"))); + assertThat(response.getOverpayments().get(0).getTotalTax(), is(equalTo(0.0))); + assertThat(response.getOverpayments().get(0).getTotalTax().toString(), is(equalTo("0.0"))); + assertThat(response.getOverpayments().get(0).getTotal(), is(equalTo(3000.0))); + assertThat(response.getOverpayments().get(0).getTotal().toString(), is(equalTo("3000.0"))); + assertThat(response.getOverpayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-12T15:15:52.890-07:00")))); + assertThat(response.getOverpayments().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getOverpayments().get(0).getOverpaymentID(), is(equalTo(UUID.fromString("ed7f6041-c915-4667-bd1d-54c48e92161e")))); + assertThat(response.getOverpayments().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getOverpayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getOverpayments().get(0).getRemainingCredit(), is(equalTo(2999.0))); + assertThat(response.getOverpayments().get(0).getRemainingCredit().toString(), is(equalTo("2999.0"))); + assertThat(response.getOverpayments().get(0).getAllocations().get(0).getAmount(), is(equalTo(1.0))); + assertThat(response.getOverpayments().get(0).getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); + assertThat(response.getOverpayments().get(0).getAllocations().get(0).getInvoice().getInvoiceID(), is(equalTo(UUID.fromString("c45720a1-ade3-4a38-a064-d15489be6841")))); + assertThat(response.getOverpayments().get(0).getHasAttachments(), is(equalTo(true))); + assertThat(response.getOverpayments().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("247dd942-5245-47a7-adb1-4d9ea075b431")))); + assertThat(response.getOverpayments().get(0).getAttachments().get(0).getFileName(), is(equalTo("giphy.gif"))); + assertThat(response.getOverpayments().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/banktransaction/ed7f6041-c915-4667-bd1d-54c48e92161e/Attachments/giphy.gif"))); + assertThat(response.getOverpayments().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/gif"))); + assertThat(response.getOverpayments().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("495727")))); + assertThat(response.getOverpayments().get(0).getLineItems().get(0).getDescription(), is(equalTo("Broken TV deposit"))); + assertThat(response.getOverpayments().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); + assertThat(response.getOverpayments().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(3000.0))); + assertThat(response.getOverpayments().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("800"))); + assertThat(response.getOverpayments().get(0).getLineItems().get(0).getTaxType(), is(equalTo("NONE"))); + assertThat(response.getOverpayments().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(0.0))); + assertThat(response.getOverpayments().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(3000.0))); + //System.out.println(response.getOverpayments().get(0).toString()); + } + + @Test + public void getOverpaymentHistoryTest() throws IOException { + System.out.println("@Test - getOverpaymentHistory"); + UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords response = accountingApi.getOverpaymentHistory(xeroTenantId, overpaymentID); + + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Applied"))); + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Credit applied on 12 March 2019 for 1.00."))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-12T15:15:52.877-07:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getOverpaymentsTest() throws IOException { + System.out.println("@Test - getOverpayments"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + Integer page = null; + Integer unitdp = null; + Overpayments response = accountingApi.getOverpayments(xeroTenantId, ifModifiedSince, where, order, page,unitdp); + + assertThat(response.getOverpayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); + assertThat(response.getOverpayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Overpayment.StatusEnum.AUTHORISED))); + assertThat(response.getOverpayments().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); + assertThat(response.getOverpayments().get(0).getSubTotal(), is(equalTo(500.0))); + assertThat(response.getOverpayments().get(0).getSubTotal().toString(), is(equalTo("500.0"))); + assertThat(response.getOverpayments().get(0).getTotalTax(), is(equalTo(0.0))); + assertThat(response.getOverpayments().get(0).getTotalTax().toString(), is(equalTo("0.0"))); + assertThat(response.getOverpayments().get(0).getTotal(), is(equalTo(500.0))); + assertThat(response.getOverpayments().get(0).getTotal().toString(), is(equalTo("500.0"))); + assertThat(response.getOverpayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-12T15:08:55.123-07:00")))); + assertThat(response.getOverpayments().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getOverpayments().get(0).getOverpaymentID(), is(equalTo(UUID.fromString("098b4dcb-5622-4699-87f8-9d40c4ccceb3")))); + assertThat(response.getOverpayments().get(0).getRemainingCredit(), is(equalTo(500.0))); + assertThat(response.getOverpayments().get(0).getRemainingCredit().toString(), is(equalTo("500.0"))); + assertThat(response.getOverpayments().get(0).getHasAttachments(), is(equalTo(false))); + //System.out.println(response.getOverpayments().get(0).toString()); + } +} diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java new file mode 100644 index 00000000..83e7e8c3 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java @@ -0,0 +1,112 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiPaymentServicesTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createPaymentServiceTest() throws IOException { + System.out.println("@Test - createPaymentService"); + PaymentServices paymentServices = new PaymentServices(); + PaymentServices response = accountingApi.createPaymentService(xeroTenantId, paymentServices); + + assertThat(response.getPaymentServices().get(0).getPaymentServiceID(), is(equalTo(UUID.fromString("54b3b4f6-0443-4fba-bcd1-61ec0c35ca55")))); + assertThat(response.getPaymentServices().get(0).getPaymentServiceName(), is(equalTo("PayUpNow"))); + assertThat(response.getPaymentServices().get(0).getPaymentServiceUrl(), is(equalTo("https://www.payupnow.com/"))); + assertThat(response.getPaymentServices().get(0).getPayNowText(), is(equalTo("Time To Pay"))); + assertThat(response.getPaymentServices().get(0).getPaymentServiceType(), is(equalTo("Custom"))); + assertThat(response.getPaymentServices().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Payment service could not be found"))); + //System.out.println(response.getPaymentServices().get(0).toString()); + } + + @Test + public void getPaymentServicesTest() throws IOException { + System.out.println("@Test - getPaymentServices"); + PaymentServices response = accountingApi.getPaymentServices(xeroTenantId); + + assertThat(response.getPaymentServices().get(0).getPaymentServiceID(), is(equalTo(UUID.fromString("54b3b4f6-0443-4fba-bcd1-61ec0c35ca55")))); + assertThat(response.getPaymentServices().get(0).getPaymentServiceName(), is(equalTo("PayUpNow"))); + assertThat(response.getPaymentServices().get(0).getPaymentServiceUrl(), is(equalTo("https://www.payupnow.com/"))); + assertThat(response.getPaymentServices().get(0).getPayNowText(), is(equalTo("Time To Pay"))); + assertThat(response.getPaymentServices().get(0).getPaymentServiceType(), is(equalTo("Custom"))); + //System.out.println(response.getPaymentServices().get(0).toString()); + } +} \ No newline at end of file diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java new file mode 100644 index 00000000..fcf52291 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java @@ -0,0 +1,203 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiPaymentsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createPaymentTest() throws IOException { + System.out.println("@Test - createPayment"); + Payments payments = new Payments(); + Payments response = accountingApi.createPayment(xeroTenantId, payments); + + assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0004"))); + assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("970"))); + assertThat(response.getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); + assertThat(response.getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getPayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getPayments().get(0).getAmount(), is(equalTo(1.0))); + assertThat(response.getPayments().get(0).getAmount().toString(), is(equalTo("1.0"))); + assertThat(response.getPayments().get(0).getIsReconciled(), is(equalTo(false))); + assertThat(response.getPayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Payment.StatusEnum.AUTHORISED))); + assertThat(response.getPayments().get(0).getPaymentType(), is(equalTo(com.xero.models.accounting.Payment.PaymentTypeEnum.ACCRECPAYMENT))); + assertThat(response.getPayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-12T16:10:38.623-07:00")))); + assertThat(response.getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("61ed71fc-01bf-4eb8-8419-8a18789ff45f")))); + assertThat(response.getPayments().get(0).getHasAccount(), is(equalTo(true))); + assertThat(response.getPayments().get(0).getHasValidationErrors(), is(equalTo(true))); + assertThat(response.getPayments().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Payment amount exceeds the amount outstanding on this document"))); + //System.out.println(response.getPayments().get(0).toString()); + } + + @Test + public void createPaymentHistoryTest() throws IOException { + System.out.println("@Test - createPaymentHistory"); + UUID paymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords historyRecords = new HistoryRecords(); + //HistoryRecords response = accountingApi.createPaymentHistory(paymentID, historyRecords); + // TODO: test validations + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void deletePaymentTest() throws IOException { + System.out.println("@Test - deletePayment"); + UUID paymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Payments payments = new Payments(); + Payments response = accountingApi.deletePayment(xeroTenantId, paymentID, payments); + + assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0006"))); + assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("980"))); + assertThat(response.getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,18)))); + assertThat(response.getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getPayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getPayments().get(0).getAmount(), is(equalTo(148062.76))); + assertThat(response.getPayments().get(0).getAmount().toString(), is(equalTo("148062.76"))); + assertThat(response.getPayments().get(0).getReference(), is(equalTo("Yahoo"))); + assertThat(response.getPayments().get(0).getIsReconciled(), is(equalTo(false))); + assertThat(response.getPayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Payment.StatusEnum.DELETED))); + assertThat(response.getPayments().get(0).getPaymentType(), is(equalTo(com.xero.models.accounting.Payment.PaymentTypeEnum.ACCRECPAYMENT))); + assertThat(response.getPayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-12T16:17:21.940-07:00")))); + assertThat(response.getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("38928000-e9a0-420c-8884-f624bab2a351")))); + assertThat(response.getPayments().get(0).getHasAccount(), is(equalTo(true))); + assertThat(response.getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); + //System.out.println(response.getPayments().get(0).toString()); + } + + @Test + public void getPaymentTest() throws IOException { + System.out.println("@Test - getPayment"); + UUID paymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Payments response = accountingApi.getPayment(xeroTenantId, paymentID); + + assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0002"))); + assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("970"))); + assertThat(response.getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2018,11,28)))); + assertThat(response.getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getPayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getPayments().get(0).getAmount(), is(equalTo(46.0))); + assertThat(response.getPayments().get(0).getAmount().toString(), is(equalTo("46.0"))); + assertThat(response.getPayments().get(0).getIsReconciled(), is(equalTo(false))); + assertThat(response.getPayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Payment.StatusEnum.AUTHORISED))); + assertThat(response.getPayments().get(0).getPaymentType(), is(equalTo(com.xero.models.accounting.Payment.PaymentTypeEnum.ACCRECPAYMENT))); + assertThat(response.getPayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:36:32.690-07:00")))); + assertThat(response.getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("99ea7f6b-c513-4066-bc27-b7c65dcd76c2")))); + assertThat(response.getPayments().get(0).getHasAccount(), is(equalTo(true))); + assertThat(response.getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); + //System.out.println(response.getPayments().get(0).toString()); + } + + @Test + public void getPaymentHistoryTest() throws IOException { + System.out.println("@Test - getPaymentHistory"); + UUID paymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords response = accountingApi.getPaymentHistory(xeroTenantId, paymentID); + + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Created"))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:36:32.690-07:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getPaymentsTest() throws IOException { + System.out.println("@Test - getPayments"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + Payments response = accountingApi.getPayments(xeroTenantId, ifModifiedSince, where, order); + + assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0002"))); + assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("970"))); + assertThat(response.getPayments().get(0).getDate(), is(equalTo(LocalDate.of(2018,11,28)))); + assertThat(response.getPayments().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getPayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getPayments().get(0).getAmount(), is(equalTo(46.0))); + assertThat(response.getPayments().get(0).getAmount().toString(), is(equalTo("46.0"))); + assertThat(response.getPayments().get(0).getIsReconciled(), is(equalTo(false))); + assertThat(response.getPayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Payment.StatusEnum.AUTHORISED))); + assertThat(response.getPayments().get(0).getPaymentType(), is(equalTo(com.xero.models.accounting.Payment.PaymentTypeEnum.ACCRECPAYMENT))); + assertThat(response.getPayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2018-11-02T09:36:32.690-07:00")))); + assertThat(response.getPayments().get(0).getPaymentID(), is(equalTo(UUID.fromString("99ea7f6b-c513-4066-bc27-b7c65dcd76c2")))); + assertThat(response.getPayments().get(0).getHasAccount(), is(equalTo(true))); + assertThat(response.getPayments().get(0).getHasValidationErrors(), is(equalTo(false))); + //System.out.println(response.getPayments().get(0).toString()); + } +} diff --git a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java new file mode 100644 index 00000000..9474a12d --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java @@ -0,0 +1,193 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiPrepaymentsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 30 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createPrepaymentAllocationTest() throws IOException { + System.out.println("@Test - createPrepaymentAllocation"); + UUID prepaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Allocations allocations = new Allocations(); + Allocations response = accountingApi.createPrepaymentAllocation(xeroTenantId, prepaymentID, allocations); + + assertThat(response.getAllocations().get(0).getAmount(), is(equalTo(1.0))); + assertThat(response.getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); + assertThat(response.getAllocations().get(0).getInvoice().getInvoiceID(), is(equalTo(UUID.fromString("c7c37b83-ac95-45ea-88ba-8ad83a5f22fe")))); + //System.out.println(response.getAllocations().get(0).toString()); + } + + @Test + public void createPrepaymentHistoryTest() throws IOException { + System.out.println("@Test - createPrepaymentHistory"); + UUID prepaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords historyRecords = new HistoryRecords(); + //HistoryRecords response = accountingApi.createPrepaymentHistory(prepaymentID, historyRecords); + // TODO: test validations + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getPrepaymentTest() throws IOException { + System.out.println("@Test - getPrepayment"); + UUID prepaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Prepayments response = accountingApi.getPrepayment(xeroTenantId, prepaymentID); + + assertThat(response.getPrepayments().get(0).getType().toString(), is(equalTo("RECEIVE-PREPAYMENT"))); + assertThat(response.getPrepayments().get(0).getContact().getName(), is(equalTo("Luke Skywalker"))); + assertThat(response.getPrepayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); + assertThat(response.getPrepayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Prepayment.StatusEnum.AUTHORISED))); + assertThat(response.getPrepayments().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getPrepayments().get(0).getLineItems().get(0).getDescription(), is(equalTo("Light Speeder"))); + assertThat(response.getPrepayments().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); + assertThat(response.getPrepayments().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(3000.0))); + assertThat(response.getPrepayments().get(0).getLineItems().get(0).getTaxType(), is(equalTo("OUTPUT2"))); + assertThat(response.getPrepayments().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); + assertThat(response.getPrepayments().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(450.0))); + assertThat(response.getPrepayments().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(3000.0))); + assertThat(response.getPrepayments().get(0).getSubTotal(), is(equalTo(3000.0))); + assertThat(response.getPrepayments().get(0).getSubTotal().toString(), is(equalTo("3000.0"))); + assertThat(response.getPrepayments().get(0).getTotalTax(), is(equalTo(450.0))); + assertThat(response.getPrepayments().get(0).getTotalTax().toString(), is(equalTo("450.0"))); + assertThat(response.getPrepayments().get(0).getTotal(), is(equalTo(3450.0))); + assertThat(response.getPrepayments().get(0).getTotal().toString(), is(equalTo("3450.0"))); + assertThat(response.getPrepayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:13:44.850-07:00")))); + assertThat(response.getPrepayments().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getPrepayments().get(0).getPrepaymentID(), is(equalTo(UUID.fromString("ce0cddef-cf5a-4e59-b638-f225679115a7")))); + assertThat(response.getPrepayments().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getPrepayments().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getPrepayments().get(0).getRemainingCredit(), is(equalTo(3449.0))); + assertThat(response.getPrepayments().get(0).getRemainingCredit().toString(), is(equalTo("3449.0"))); + assertThat(response.getPrepayments().get(0).getHasAttachments(), is(equalTo(true))); + assertThat(response.getPrepayments().get(0).getAllocations().get(0).getAmount(), is(equalTo(1.0))); + assertThat(response.getPrepayments().get(0).getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); + assertThat(response.getPrepayments().get(0).getAllocations().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0004"))); + assertThat(response.getPrepayments().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("2ca06aa0-3629-474a-9401-553d4b7fa9b0")))); + assertThat(response.getPrepayments().get(0).getAttachments().get(0).getFileName(), is(equalTo("giphy.gif"))); + assertThat(response.getPrepayments().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/banktransaction/ce0cddef-cf5a-4e59-b638-f225679115a7/Attachments/giphy.gif"))); + assertThat(response.getPrepayments().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/gif"))); + assertThat(response.getPrepayments().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal(495727)))); + //System.out.println(response.getPrepayments().get(0).toString()); + } + + @Test + public void getPrepaymentHistoryTest() throws IOException { + System.out.println("@Test - getPrepaymentHistory"); + UUID prepaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords response = accountingApi.getPrepaymentHistory(xeroTenantId, prepaymentID); + + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Cash Refunded"))); + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Payment made to Tony Stark on 21 March 2019 for 2,300.00. There is no credit remaining on this prepayment."))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T07:58:10.407-07:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getPrepaymentsTest() throws IOException { + System.out.println("@Test - getPrepayments"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + Integer page = null; + Integer unitdp = null; + Prepayments response = accountingApi.getPrepayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + + assertThat(response.getPrepayments().get(0).getType().toString(), is(equalTo("RECEIVE-PREPAYMENT"))); + assertThat(response.getPrepayments().get(0).getContact().getName(), is(equalTo("Luke Skywalker"))); + assertThat(response.getPrepayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); + assertThat(response.getPrepayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Prepayment.StatusEnum.AUTHORISED))); + assertThat(response.getPrepayments().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getPrepayments().get(0).getSubTotal(), is(equalTo(3000.0))); + assertThat(response.getPrepayments().get(0).getSubTotal().toString(), is(equalTo("3000.0"))); + assertThat(response.getPrepayments().get(0).getTotalTax(), is(equalTo(450.0))); + assertThat(response.getPrepayments().get(0).getTotalTax().toString(), is(equalTo("450.0"))); + assertThat(response.getPrepayments().get(0).getTotal(), is(equalTo(3450.0))); + assertThat(response.getPrepayments().get(0).getTotal().toString(), is(equalTo("3450.0"))); + assertThat(response.getPrepayments().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T07:59:47.730-07:00")))); + assertThat(response.getPrepayments().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getPrepayments().get(0).getPrepaymentID(), is(equalTo(UUID.fromString("ce0cddef-cf5a-4e59-b638-f225679115a7")))); + assertThat(response.getPrepayments().get(0).getRemainingCredit(), is(equalTo(3450.0))); + assertThat(response.getPrepayments().get(0).getRemainingCredit().toString(), is(equalTo("3450.0"))); + assertThat(response.getPrepayments().get(0).getHasAttachments(), is(equalTo(true))); + //System.out.println(response.getPrepayments().get(0).toString()); + } +} diff --git a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java new file mode 100644 index 00000000..3db7f0e0 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java @@ -0,0 +1,276 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiPurchaseOrdersTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createPurchaseOrderTest() throws IOException { + System.out.println("@Test - createPurchaseOrder"); + PurchaseOrders purchaseOrders = new PurchaseOrders(); + Boolean summarizeErrors = null; + PurchaseOrders response = accountingApi.createPurchaseOrder(xeroTenantId, purchaseOrders, summarizeErrors); + + // TODO: test validations + assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("792b7e40-b9f2-47f0-8624-b09f4b0166dd")))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getDescription(), is(equalTo("Foobar"))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxType(), is(equalTo("INPUT2"))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("710"))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(3.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(20.0))); + assertThat(response.getPurchaseOrders().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); + assertThat(response.getPurchaseOrders().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderNumber(), is(equalTo("PO-0004"))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getPurchaseOrders().get(0).getStatus(), is(equalTo(com.xero.models.accounting.PurchaseOrder.StatusEnum.DRAFT))); + assertThat(response.getPurchaseOrders().get(0).getSentToContact(), is(equalTo(false))); + assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderID(), is(equalTo(UUID.fromString("56204648-8fbe-46f8-b09c-2125f7939533")))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getPurchaseOrders().get(0).getSubTotal(), is(equalTo(20.0))); + assertThat(response.getPurchaseOrders().get(0).getSubTotal().toString(), is(equalTo("20.0"))); + assertThat(response.getPurchaseOrders().get(0).getTotalTax(), is(equalTo(3.0))); + assertThat(response.getPurchaseOrders().get(0).getTotalTax().toString(), is(equalTo("3.0"))); + assertThat(response.getPurchaseOrders().get(0).getTotal(), is(equalTo(23.0))); + assertThat(response.getPurchaseOrders().get(0).getTotal().toString(), is(equalTo("23.0"))); + assertThat(response.getPurchaseOrders().get(0).getTotalDiscount(), is(equalTo(0.0))); + assertThat(response.getPurchaseOrders().get(0).getTotalDiscount().toString(), is(equalTo("0.0"))); + assertThat(response.getPurchaseOrders().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:22:26.077-07:00")))); + assertThat(response.getPurchaseOrders().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Order number must be unique"))); + assertThat(response.getPurchaseOrders().get(0).getWarnings().get(0).getMessage(), is(equalTo("Only AUTHORISED and BILLED purchase orders may have SentToContact updated."))); + //System.out.println(response.getPurchaseOrders().get(0).toString()); + } + + @Test + public void createPurchaseOrderHistoryTest() throws IOException { + System.out.println("@Test - createPurchaseOrderHistory"); + UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords historyRecords = new HistoryRecords(); + HistoryRecords response = accountingApi.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID, historyRecords); + + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:39:39.354-07:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getPurchaseOrderTest() throws IOException { + System.out.println("@Test - getPurchaseOrder"); + UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + PurchaseOrders response = accountingApi.getPurchaseOrder(xeroTenantId, purchaseOrderID); + + assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("8a9d3eca-e052-43bc-9b87-221d0648c045")))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getDescription(), is(equalTo("Brand new Fender Strats"))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(2500.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getItemCode(), is(equalTo("123"))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxType(), is(equalTo("INPUT2"))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("630"))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(337.5))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(2250.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTracking().get(0).getName(), is(equalTo("Simpsons"))); + assertThat(response.getPurchaseOrders().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,25)))); + assertThat(response.getPurchaseOrders().get(0).getDeliveryDate(), is(equalTo(LocalDate.of(2019,03,27)))); + assertThat(response.getPurchaseOrders().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderNumber(), is(equalTo("PO-0006"))); + assertThat(response.getPurchaseOrders().get(0).getReference(), is(equalTo("foobar"))); + assertThat(response.getPurchaseOrders().get(0).getBrandingThemeID(), is(equalTo(UUID.fromString("414d4a87-46d6-4cfc-ab42-4e29d22e5076")))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getPurchaseOrders().get(0).getStatus(), is(equalTo(com.xero.models.accounting.PurchaseOrder.StatusEnum.DRAFT))); + assertThat(response.getPurchaseOrders().get(0).getSentToContact(), is(equalTo(false))); + assertThat(response.getPurchaseOrders().get(0).getDeliveryAddress(), is(equalTo("101 Grafton Road\nRoseneath\nWellington\n6011\nNew Zealand"))); + assertThat(response.getPurchaseOrders().get(0).getAttentionTo(), is(equalTo("CEO"))); + assertThat(response.getPurchaseOrders().get(0).getTelephone(), is(equalTo("64 123-2222"))); + assertThat(response.getPurchaseOrders().get(0).getDeliveryInstructions(), is(equalTo("Drop off at front door"))); + assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderID(), is(equalTo(UUID.fromString("15369a9f-17b6-4235-83c4-0029256d1c37")))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getPurchaseOrders().get(0).getSubTotal(), is(equalTo(2250.0))); + assertThat(response.getPurchaseOrders().get(0).getSubTotal().toString(), is(equalTo("2250.0"))); + assertThat(response.getPurchaseOrders().get(0).getTotalTax(), is(equalTo(337.5))); + assertThat(response.getPurchaseOrders().get(0).getTotalTax().toString(), is(equalTo("337.5"))); + assertThat(response.getPurchaseOrders().get(0).getTotal(), is(equalTo(2587.5))); + assertThat(response.getPurchaseOrders().get(0).getTotal().toString(), is(equalTo("2587.5"))); + assertThat(response.getPurchaseOrders().get(0).getTotalDiscount(), is(equalTo(250.0))); + assertThat(response.getPurchaseOrders().get(0).getTotalDiscount().toString(), is(equalTo("250.0"))); + assertThat(response.getPurchaseOrders().get(0).getHasAttachments(), is(equalTo(true))); + assertThat(response.getPurchaseOrders().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-26T11:47:09.823-07:00")))); + assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("7d94ccdc-ef7b-4806-87ac-8442f25e593b")))); + assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.png"))); + assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/png"))); + assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/PurchaseOrders/15369a9f-17b6-4235-83c4-0029256d1c37/Attachments/HelloWorld.png"))); + assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("76091")))); + assertThat(response.getPurchaseOrders().get(0).getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getPurchaseOrders().get(0).toString()); + } + + @Test + public void getPurchaseOrderHistoryTest() throws IOException { + System.out.println("@Test - getPurchaseOrderHistory"); + UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords response = accountingApi.getPurchaseOrderHistory(xeroTenantId, purchaseOrderID); + + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Note"))); + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:22:28.670-07:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getPurchaseOrdersTest() throws IOException { + System.out.println("@Test - getPurchaseOrders"); + OffsetDateTime ifModifiedSince = null; + String status = null; + String dateFrom = null; + String dateTo = null; + String order = null; + Integer page = null; + PurchaseOrders response = accountingApi.getPurchaseOrders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page); + + assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("0f7b54b8-bfa4-4c5d-9c22-73dbd5796e54")))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getDescription(), is(equalTo("Foobar"))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(0.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(20.0))); + assertThat(response.getPurchaseOrders().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); + assertThat(response.getPurchaseOrders().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderNumber(), is(equalTo("PO-0001"))); + assertThat(response.getPurchaseOrders().get(0).getAttentionTo(), is(equalTo("Jimmy"))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getPurchaseOrders().get(0).getStatus(), is(equalTo(com.xero.models.accounting.PurchaseOrder.StatusEnum.DELETED))); + assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderID(), is(equalTo(UUID.fromString("f9627f0d-b715-4039-bb6a-96dc3eae5ec5")))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getPurchaseOrders().get(0).getSubTotal(), is(equalTo(20.0))); + assertThat(response.getPurchaseOrders().get(0).getSubTotal().toString(), is(equalTo("20.0"))); + assertThat(response.getPurchaseOrders().get(0).getTotalTax(), is(equalTo(0.0))); + assertThat(response.getPurchaseOrders().get(0).getTotalTax().toString(), is(equalTo("0.0"))); + assertThat(response.getPurchaseOrders().get(0).getTotal(), is(equalTo(20.0))); + assertThat(response.getPurchaseOrders().get(0).getTotal().toString(), is(equalTo("20.0"))); + assertThat(response.getPurchaseOrders().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:18:23.443-07:00")))); + //System.out.println(response.getPurchaseOrders().get(0).toString()); + } + + @Test + public void updatePurchaseOrderTest() throws IOException { + System.out.println("@Test - updatePurchaseOrder"); + UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + PurchaseOrders purchaseOrders = new PurchaseOrders(); + PurchaseOrders response = accountingApi.updatePurchaseOrder(xeroTenantId, purchaseOrderID, purchaseOrders); + + assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("d1d9b2cd-c9f2-4445-8d98-0b8096cf4dae")))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getDescription(), is(equalTo("Foobar"))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(20.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxType(), is(equalTo("INPUT2"))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("710"))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(3.0))); + assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(20.0))); + assertThat(response.getPurchaseOrders().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); + assertThat(response.getPurchaseOrders().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderNumber(), is(equalTo("PO-0005"))); + assertThat(response.getPurchaseOrders().get(0).getAttentionTo(), is(equalTo("Jimmy"))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getPurchaseOrders().get(0).getStatus(), is(equalTo(com.xero.models.accounting.PurchaseOrder.StatusEnum.DRAFT))); + assertThat(response.getPurchaseOrders().get(0).getSentToContact(), is(equalTo(false))); + assertThat(response.getPurchaseOrders().get(0).getPurchaseOrderID(), is(equalTo(UUID.fromString("f9fc1120-c937-489e-84bc-e822190cfe9c")))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyRate(), is(equalTo(1.0))); + assertThat(response.getPurchaseOrders().get(0).getCurrencyRate().toString(), is(equalTo("1.0"))); + assertThat(response.getPurchaseOrders().get(0).getSubTotal(), is(equalTo(20.0))); + assertThat(response.getPurchaseOrders().get(0).getSubTotal().toString(), is(equalTo("20.0"))); + assertThat(response.getPurchaseOrders().get(0).getTotalTax(), is(equalTo(3.0))); + assertThat(response.getPurchaseOrders().get(0).getTotalTax().toString(), is(equalTo("3.0"))); + assertThat(response.getPurchaseOrders().get(0).getTotal(), is(equalTo(23.0))); + assertThat(response.getPurchaseOrders().get(0).getTotal().toString(), is(equalTo("23.0"))); + assertThat(response.getPurchaseOrders().get(0).getTotalDiscount(), is(equalTo(0.0))); + assertThat(response.getPurchaseOrders().get(0).getTotalDiscount().toString(), is(equalTo("0.0"))); + assertThat(response.getPurchaseOrders().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:39:36.853-07:00")))); + //System.out.println(response.getPurchaseOrders().get(0).toString()); + } +} diff --git a/src/test/java/com/xero/api/client/helo-heros.jpg b/src/test/java/com/xero/api/client/helo-heros.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e67595465a8c6b1ee7fa19e3cc072df2d9e5a708 GIT binary patch literal 40053 zcmeFZcUY6nvp*bq2WirKQ(EXX5ETUh0TJm;@J63<&h@*_x!&^c``xhFPd2l&Gqbz*J+t?Q^SSdCzy$+ceO&+v2>@`D z_yU}-l4sq3dbtAtMn(Wh002M@pe11fkP;CkF~^Zy_=9PQIE91-Kt?P{h%W#MH-O>~ z1^{wNc>cx3B$xiCA#xy*|Ci585`{mQjo79#-U~qfciZj+v41exD`Fks>VpS9ZUC>_ zo)AAbK_#=_RYWO&_xM+-Dl0E54^WVkSJIGE)sR;gBm#MP4LM~1Kp;B*A2~=hqKp2; z*Aj&POQr;gzp(-UkO2Tt5&4qKDJaNiko_YcsX+$$zt|y@MKRk=<-}>k*s=xUYEtN&{H@-l`wExm4WwHIKC)$8CD+~6Ae?JlDXJ!8Bms~+k z1(22XU-;QSa>~oeJtO&>CsB%Lr2p8CMEV)oKNzt3g5z%*;uw_tCI9d729%QiUH==C z{WnbUHx?n*Q~tMlg+DSAQ z|EUfDkntsw8v+0v^i)Q{XfSQ?uPecZ& zrtwFXKg;S5`rXHWPhbFjpb&uc+pB-ezimY%`eU>IW8MooJGpoZx;Xi|1vm*R$ttM% z`U<)O6=ao&^t43Hf3Hu{Kda-fc}SdXZ|I`yP zxdqV{zt`|@8VA5%>zwrN@3zeU(u4r`{_rG@2|00m{-n#q_ussj|0>Cdvm4+_%+-H= z2FU(Zvf%%&|9j2+;q$xQ@A3Uz66e+La{mgkVEC{3@%x%Y%kCKz^gsg$^b3@Aa)mg% z$+|#%fl#LhKzUg?AOHl0J|No1ElAMW&BM!2OL(uXOIXm$RZG}X*+|alfsUJ}*Uj(% zH?wf#yDs70F6yqrU~NGVR0Hb!z}GFvNf7Gm;}@s_)e`>0T!V;zR|ACw|BwWEYYAH! z-4@h=1h@$*%PPsr2@_ifxVmfHxvu+nTjD1z;lG6p4GonIRg{GUcmUG=jK# zxrhC)g#V2jB;YOt;-e+}=c+6$_;0TozZ?J6A8}Crx6Xh>s{;Qv>u>n)_-G6MC;i6) z|FOV-Ebt!-{Ko?SvB3ZTEbw0*o|_-hg9s)1Z-Db10F)RP{^j-vD$2?M)UN3pk^goh z0RS*Bi4A~^M@)~G=mL`hNO?)Y07`i!d3iZyUQ%rU^=}_UPE}r=msIt?e*pbM^cOF& zKfEqnDERJDM$)HrHi>q}xGlS$cLSKI0jng^WF*1>Qf3k|W|H%MfB?~Nr6Bo}{xl=L z{S!pc(9#hJ8i+nM2^kqFIT;1TZ!t+Ce@Btz%oHp_@>eNYO`WKO{n-?vGM`h6T&w9} zzcY>zRdf!BrlGya!O6ufCN6R5vZRu-imIBrhR*dHx_USD4b1METUc6I+qk&8xqEne z-46^34he;Zg~vRKjf+o6Ov=iBoRgdPK^aw)QlC-*$&zS9(&>kE%TU zIC+PAcki~Gl&`Kj!;Xz9PWDsOQM`gYZ{|{Gqk62Qzoq(*rJ)Z2Ub`4h7hS%sO6~yH z%9Nh%?=u*_67B2VLcFOBgWLQRS#u*w)VJym>v$H}8-U9fiiT z6jNROA@<2{1jZKgeb+0L{xJjLj76nYmA@6f&!#aR9OY0`cRGp3 zq#@!>zIcw8A{>QWh9L*looX|p)KBLxAMPL48BF+ne7B?q-5t(7QVB_T4T10)bjV3A zvRNW8tL%jarvDN;(Hb zClMyj0rmE~D9D;gBKHfNv#)`7vW)C|ic*zNTy_hCE;{wKH);%nooU9@_|sTritHT{ zn6~1NiivG&;2#9)8gi@LO17E=xY|R@cT<%ROrrw1uH>YsfOTE@!lJf!T9B;Eq zR=YSSy=0+#6C(5_T7zE$>*$E*JS**_fR8gn-u6CxNT$>LzK^tWg?!nSE zV_YO90naix$%r-qc`3K-k~;)FOd*+D@mT6eUS-;m#}2K;l>`Q30?|z=1m1Ii-@7=h z()V7m&pNUD%#SOWvs2R6EtD0Y%DZi}AI<^S?@O&Q;Ux0iJ(VPG z_B^1ZU~^@xcjeE?yn2J}Hp%~O)=|QCmzAoKzLjk_xb+LlS@qg!6C6wPj-ZTK>9Fb3 zKMhq*%)xg6S9deo44tlq?JewocTB2+eW<)Zngj*x2n@`0-R)Xw(b#f42lVKG0zT`i zI52#ACdzV?#Lo`<{q$q!Ar5o$=HY69+89{J(N-5*&e{3S$kbyOJuk4&2(Jk@yLh1OQ_Y1sv|q?8ZIb`dohsqbtCGR zbAerX8-f9ymfF1&Rnq3lvc zILY`1LFQ0L7L(TPbzUnnYP?9RC?Z8s_Mqp@%W`fa(bR&otpvG_6OeUza4K-EG7>Qr^JKWcV+qU(xj^4wRSgEq&D zF-@*TTH6)%*t;puc%n%Tw7h%s40DW~AE!;jIS;8Z6_Qz63=+D)Kvk7U4hXvPl6ju` zo^8mIpx#|3`SsaRy2wyS>dyd;eH#^mn5!UHSoQsNGFzbVde>4p7rh#T7$SQYAwAk^6N?EMq;j}FriMg`8yQ9$4 z`?W0o!K5%rGI1nUE|a89cpJz#3>#;?!h3Iw;cl+$ zaym0OG-55mO3}?*u1ZTECe)sWYM1E0$lh&54i;Nq`RLvK1LVOHRG9v{Y6IJ<;4((l zWV3(YHHY=nvVsGB?@=f@EMx)vvmLaTMB>cOiLTD(QqfuCn|PnTGOx3QlRDMp z%pVm>kYg)>L1gBZR9|}H`XhjZ1f)X%Q*etDj>GPmN@v+~`45I_4d>fiR**P|!Vtm_ z+y~rE*0P4g159RKs!N~LcD8)xCy45d&lI&p>TNm}IyL}zlBs@-U^*QI^j07ocuOq% z8D7I7eYJxQvY@QL;q$;YHkHzTq41I#`HJNxvJZumme`@G#O?Js(Bjfh$zl2!qo$<8 zWM4^N3kKb<-oDE2IWAshKp!??O6g^}RTJSv*NNpP&1jx)i0e!D5m08U+4<6tou+`b zZ3h5c%1fcB@noh*g;Co!R{iY0ItaorA{F-L^YOO1p|t+u+hAM021B&??SAIQiXn6< z)z@q)42n-%g5@%xkbgQy`3Xg4JM$4QlTPv8QIAPSApwE{OBrb-z`lr#zjKFEA( z@*-LnL0c2JmaGP<&$4pLb$MiQj}Gay)Kvh)NvEg4j4&UER^wBBU?Uw;)(vf+Ds33d zpS8a2aBBZh(Ue2Yk3pBCuI0Uum$U`i(N;bc#bGTLXgg`f-l4$QTACfp_o?bccZ zMpPOI;e_9Im`g@UCU)iYpJ#TZM+0rA`^jgc2+d9&;(h7~e8Ofh`{n)ooV;FjTeBv^aaK>WK|$%~(Q*2^E2U9|fsU16 zicS@MY{_bTytdGd(#3Bkm6bIe^|ewt(89qDgDjQ0%Tmka9)*+TJYL?BLvAp(*Rt;C z0PqySsB5Jz|3h9E<~A~wG0x(m4Ls9h$Ru}EK;Rckm&Dhuo83U+s5F4~@>%#Pl0Z9( zzN{>OyTq}hRBNC=*$||T`L*Otix@43S;v(e^jsTsp&_wipy^~pV6Qq`cq?4~zzhW)B@-Z+rQ zaf-D(PQYB)1NiI_v>O(omMfe6KsLLpE^Z|V53bL;JJ(D}FZLWsXyMp5$MLtZz-W*> zddH)WTO3*1us`qR=-bk)CpppjLh_YF*2a}FzU{@Jb3oiVph3Eh2gQL~>kF5I+vtM~ z-oAUv`!hKyAwpk5(%)}L+2-JN{hLwUv$17V6tZFS5u6V%i<#|xUb4kKltAFcg^%56 z%b(x+aup&iN8K${5TZcyy)by&Ap*GLkL4G)D#s?n+XcSMEpM?ptwAx2B5pHr!s!n*J=$f`6l>QWgr(i9hquU z+mFn36Yq4)9|8z54$haBoHHN2cxb3Q5@(o*3>8KQnxJ+OPH_IpE0(^ zsFCRGRW99lqf~uGbjLLNgf@>fY^*A;KUCi1_}9VL@^iqW&Vv-GEGdkkIdLKP!7kO$ z?$q0JbZaYNMJ?r(d%xIh<-2@UmfC02FDj7;U%APK>3cO0(bdC*yG+$5kXo$JghRaa z(gtFXNqakPZS^r`Ns4^vff(V+%(_btIQh!SANG5A4T%{{O`R2l7a`1Fzu%F0esU_1 zfGQKrx&kq~qmK@g8QN2E4WE5q12b$379%f+)b)2vLSpV9aF^l-1s;Lf+7&Tk_%6tPg7{Z!xNW!5>s&S#R5YC{(7p1FHd-Y9hH`i&Cbj z&a`Z!INRh%jcE=C5L}I5jJe6Y$W7=tajNcJD2N>tnLbD`$O5;c0HWb3X_`rdhn+O= zFGzB2NxUpBV$J&;kU-$5!-5kIn*AF1gg=;s2D|vD7;;6kg>pWaBM%a8d4*onPUYh) zB>!%+1J+q}oX`jS2 zjZ6&-J_ihp%>#Q|1s)xEBj#0)rpJRVBfb`&-o@E6)&*?0-13T`r)F8ats?A{uCBwH zRf^0a3hy{CKFpNZ#erX@!TVr2qLif;PLWzZ3w^E1J^Ksmve%YDu{S@InP1?I$?aYN zv7_4{2}>k6uQHtDN>@5a^Tp-P;?aY1z`X8p-Pk2 zvchO5s}Fi!&)W@<*NA8Oa3w~xRTLyt^|(Ui8&#CQ++$vst7UGU_mCItQ#Yp93y{Gzhdfnr9~Ha{%1{ zLIo88{JcK3VnH>Ws(aNZt-J~*e+u4SrY|`wQWgNfuFQf=S3{;s^>TlX8E3iW1M8H0 zoIOaOUzSx2Hram&(1TZAE;CodnAX6YP(1_UdN#o|^)B(%pDpgitlwc}RymyWMbvAI(N{$BK^ zVa{| z9uFPM%?n1O4W&3`Kn=H5K?^mLyky1UmakwMMCoD(v)W{smr)q+Rb(G9x|5+6v-2U7 zPtUe1+pMEt6rsKk;Yu}se2Y@CSkps!pYRkbFvN`-@a5?}LH>w;RvuT)J=K+52?{K; z(|MWOz_@p0s#<(KKws3b5&Q(O;wv~?gOlC7k&Skh9|=}Mn=nUaU2j@eVZ?FJlS-0O z9j5^#MAHg`%0Dy^I@jnI6i__6#>Ze5#L6@HWh@?9Kij{@2Ghav=OEVh1ibT_xU+|z z+ga&O*oc*NI;G@U8g*J}+ofH2$QkEjIpF9yiz+I3KeNl8zI3Va{W(BJBUgQhnn_?$ zyWyy7=XKSWEo6hl4sDlDX3(PMpeoj8puxp9cwerEo%2QX`1%hu?L%}iEiNK-jp06n z#;N5eyg+&LvTRAk$2&?_bVHu~+JJe`HjlkY^KQ$+8sFOPoA#sW_~8oU#(YJ+B6@=| zZ;CXe7S68d(0diMES5eREGK81uMQLvAt6)sNw56T*9idCyX5DfvM|WVn_CanQTu(G@q}VpluV<3*N|W z^D;f8P2bhY5$M-P-Osj2V;Ayipt`3R#SeapQe|~WaobaDEEE%a(So(?L4JlfV5*BM zziX?f_t{uvquFat?{e#w$@Cc>c_)7T+L0iBG& zh)#?5rKB%ooA2~w{Y2mG^GJ}@MnyTqpH)fS8+z_w_f{m}y)cTun{2G6!s6s*8(CY= z>QsE#;85Y3b~o@GU{hyZ##tc)w>+cYa;q!otk{H1`Q>1ER(298mse4b9>^ggc?^-& z=sV?Dk?ZN;x_o(yhFUy zeakx-Cgz^D6osEA{x;)7X2pqc#JYrJg>Je)3kH%<1&FBP-v!~9AIw}y+x;Bfn5kj{ zDz{mO%OZM=5zgQ^2OcaVDi|Bu4_BI2a!%yWE5pGzM>{;oU#00^(@P;Wyhw6I^b~)2 z6@ruD=!S4_g?A!DS5VA2h+$mVMRi-#x-eK~lZ%qupk1zDrO(`!f`Z=N`_~M0eVM%R zm1o@P_Km42f!AJHz7lRV0@`7I{8Stk@rZ4d^Lvoi%s4nq08qvnI#_XuML4H*d> zEu7^X((NFO@{S(k!k#;RvnfBa8HjlGCK(@l8ARV=Ewcb6z4Cxs=y^aNyWRwv3tFCV(#n>FTm+7gOqNUv@ldR zQwq4rWQV5&cZ#NpQ!-(Lf8ZCu4ytp8J|A4!*gO@ zmbkCH_g76WtC@tmG{3RK6sVug(M3~Iev+DkQ3&)eKO%@v!iAu~fo1xyZI}hFl8$k> z#P{&z>yKaq!mu{Ju3n@(dDK*lN8b^W*%kL3%VRhJ7lQ@VVr4R%R9eanS6??6V%V<_ zzHv5**9^V2zhR{Q|;skxq>&X>-EoL%f8x-DS;> z=|3O1kr-sZS3?zn=4jBC-77M_tY;8DjO?GPu;x73kMMrO&j!&e;(Zc8}E< zX+(C>)pkukUM$hHO=)xWoeFxL1K4&qtb#QW47e_Hta5)yr#n?qFvyc%1tN`qLmg0( znQeKe<4u4gMn1(-X5uog+UR~Sdhb+r7HwWAxdxdNsmW4MNpI!(I)s9Kt?A^!2jbc= zs6hfZHuO=aAU+6_Td}(6pm`e75dBqxiMtN9D?P_G8BlHMy?fg1+s_Y1>o%<>(=GaG zo-W6#)Ta4qFIF14NmehnuQNSf>nejzx3}6a=#rv*S!_3O5;Z`$e{&8FI(xG`?9-Yrms|w-9%%l zJTUpcKHRw8RT^rVI!|a75KA_R53i0bWup0pppyO}+rYKw0il7(PJzg4?JB*Qy^}TD z4MiVm?jYKtsYJ;ficaP1J;99H;<)2M1^f-17Ut#0v2IlwU?MDdF5{TLI9`8ZFN zxHIk4*{J_AVxchWT|v%GO4BbSB8OuskR7=H4}TmqZYfn%iTop+)tvZ zOD!<*P&1_sR^xrx_?x`)GYM^lOBz?cfpkOA2)&-;evWhsd>g4FbBS~N{OkB zj`ST_ZbR>1M|5tqWbmCXI9WL+diF4#5$_e#gJ6;ga-=}?T-ia@FGT9nJ*gK+J5gR- zEPwhSgy;3{%Yn%qbLf+cKXV%S1Eivi7A$<-{OBq|cxQR$)8A=b_;%tfk#9^+tJrgNVp(qg(R3rZmhH_OBTrb5N@}FmJWs(g zL&v+TwDql3)#iFPZdmlb;$y#JI!JMQO0Z^9IN$p$qNj1&@1@?r!aKI8u`k#3hltK~ zXKmJeuS}cFj<6fq?khgYn2x%k+8c=_!A=b|aVYtX8hfJ|57key11H zmq_DHne|kp%ky`x4M)vxCJA>1r92E^qRL<2ZEz&jY1?sRK6o^=L|1O-pMD&T-EpKP z2BTNtoPBHHlupiu@n9g0r%FCY{B5Ps@S3+NdztTrZu5OPR9n+N#O9#7QS@HL?1YNxU61IR3fIest(US(M*#;)}ph<)ot>T@1|Cb7qa( z79jm+PYQ+*)IR-j$LPpv6Sa#qtYd7T_Q66uo*S%tGO!C zHxj866=GcMcf8 z*0wK8cf?{)D5iPz9jBNli~cs7oMTfH+jfXIJ)b(&G^wi*n~}2D;#T$ouPvy}(;OV3 za=PwU98JP5ulkyK#h6Ssq#wM_y=b*!p=&O?$ab-tYfX*Md;KzTSK%emS!EJkrfsK) zSnay7EH?NgHInyapgj*rIoIAL^IS96i+NFB1n|;QDE=|t>g-vkB>>m0LxO&Y`<-6@A*~4zE7SYZV@XOa}PKB>$ z4Sn4olPpM(Nx#~S?zF-l#;1Y!RyoF%N2EsDOgQgvzcLi7vQ&w@ z=#mkmwiCq)sT9u^gL;Tt89{GKn}fK4waUP+B{2XO=ND`lZ!jdvt!3@|v~q8>(b@Aw zW~b%l7DE8szWV_b<$&WUBaC)&3iK5V6!a}oO?kA=2sL&jmZU9xqjBX)Y8ILeu_fo- z)RMv=ZefL{H)`vwK$dUjuCI3kJ&Fyz#a;F_t}*4YUg(RUAYUOXmO8LJ;>FI!cJkp( zaH<^f+QRmDO{_{ABCr(NHBe_|wP?#@STMK5lOWuZn)`W2Q1{Mgi|dFY=@q(-%AgWu z8iQH6T!~`XsMSe1dO03W4+CK(dIcD9BCE%J_Bv>$RFJpZv+tiO1fOQ^&Rq5gpi!VM zkv_GJyGLb~kBc~(!(kDTr^YaM%uq-eOfWE(> zyyh%*m+;9dQFVmVS}XK%!)c2pfjpcuDZ`4&VC!em&IafA$%^dLbi>B8GW^w*Wm?s! zpizlyhEl0ETCR&AU$Kpj-d^Ec?N^m3y}8E{?ZhwCvmCRD;zKpNIa`bj3@-sJKEE@d7Uf4k; z(By-B{97{{`CsqK)W27{LYXA@g^P}T?2e)X!grOpFWlHEH0850iPs7CFaN@x>3i_> z)|-ph+7juO{jRQGxXQ&l+azJ(YyNlvUOqNiCR$Hi|2nA8duxQ8iu>mPhW1GRwM88p z%;MLA%`Zmfzb4D(vMvsq>(cJsTZ-`n0WQNYZ6T-#Vt8xp;pChrzZjN2_u%Z`3SJHpvV3>Ms#)eP~U+|y_o8|tCOLiePN_l>F zm2$@yIXIwM!-$!gUDDUH;6kpJ*iUy>(PT^sIVSV>0mo*Y@IIT z=~bxeHwmg$cdqFZ;j5nWaS`EoGAgB}ee8%CGOWw;{a$mDq|J%zGs9)fER%P+cah_R zus4cx=(bLp`cKOmKH-&W{iGNQZLK#uBilX~aSWSfeD)DYAZWtareP%5t3n5g(Ibk-q3gTW;e#e(qlU^VxF0VJd9^2>iV%veV zZL-RzSg>Z^b4 zd~}uoXZ?PJ zr@F+RSmSHLC49PcU!;5cgYoe9bL(C1s1)Y!{D4_ye7#(uL`6E~Yb!S6ktfzt<>9!`k-up|B)E=&_$fp`LEAiR7$-%jM)6I**|uE6^4nM z7lQyYM3l~H&6JeD$HI?O zWJN7i`Z;n6+zuo>7f1o`KrbPOdSEl$q~io$WVI{)I3XeKKi$N>;ecR)3y=2 zq8F}yj2!e{RWz39zw->M_uA# z1gYDSD|WJce~WYM@%UNYPmcL zaVjrD?zA-(pP3x)_Y@c1L;;|OjPU?q>+F(aO-^~=Hj?*SYsV`bmv;IJg4A34 z(zIW@Jf_X8D{IK`k>Sx(baUj|J4)#E^B%8ar!=wK2n%4tO&`j{;O9`tYGGfmjaFw& z`HeE-L!)RzO({1gZ(n9;qE!ifkFK#Qe;A4uo4!+q-lJNw{~lU})w|ioOrFnKZp(H_ zk9LIe)9r_h)I(&STn<5cNl=e64WpBWa{%%7t0G6-B8n@p}hMdeJw3;iQm&}(K3HTZ+D9Ph>n z0)@^RgaM~A=ooztsC8(0;i(a*!&gL%4oq0T)y$8Gt$p0_%i5>EL7UB!x)k!A&R0lJ zv68Sf%Q!*ddo5I;&%gRsf8<^6wR+UTtivS8{Q1@iB321_VafBDCM1`o&mZb{1w?61 zzo5USX|m=3!e8rG>vFla_oD5zQH$n`rq)i>4*PU^-sFa{d{@q*9;8iY9*@8>SoCHoCVnl~R0Rc|R?iTk?mq~{s8wywt`rEmjsoc_dr`7?Y8(YTztmOs`b zP(?U`m;Vr#x#3oet9C#({tg)Qq5a|th!|?!AL?{lX4Z%E z51L@r1fmc%szWFWycI4Oy~lySH>K}l=jtcoOVeqG3c&$6hK(3~o~r5GZY+qgMq za~6$d8YD(MP+R?)*#<4LK{?O)y1j2`=V4i^x+}OI0}r*(Tg(_*z+8a ztfALCMhUaVOhV&UU7GSNn;Wyf@?5tFP#r}svAYKg>0z0R8;;$H2NlRSaNAh%G5tw` z3}O0&Zzj7W>!@*FHKtejIhn`1pN1*EqW7w$mU>)pTMc*L+$pCHt_%IV^Pz143kq{v zx^Qm`Ri!^|h*-LteGV9Y5WTb*(sG!KI=zn-iu&2OhGc>Bd4SWG_g}qp@aw_mPGTJs(d(5=M z^18+63rPx{*3Lr;2X>?pmO!*XIuc`I&)PRXgclA$u)y5VueyB|mLQDAPQ{LGr!z%^ zQ?$0C@_tV&B-lsserHd$>AjFV#5ihkC5hI%MD*N+_<(X2K)b$ddl*sWI)GG2udmmJmM=6d~ z44MromH8I#R#!G=+4$6N&*9S(;2AJhkkMOpa*kT#@yC|}+VqDl1IpCfwwAlz*jN`T zz^AlXTMDnPLO%Z-{JK%%`H7EG>qDti+%1ok;IB>EmtaA-0!&4}3Y>om&VYlvyt2CS zs+V}qdyG|2P;K+x=7u14z8)?LqZ*fK*GGL>cqi>U`9A3q3)*~ePMDk#IzkCfJba^S zvza2;FkbInAj5Pwxi7@4d_h0hPc-BDqaBLGO)k*v8@xD5?eZAM9pB>u$FI;}?I*IS zdh{1fW1q7l;vVr4*1JT`r}usJR`&Ww9#7O@>aMjAMv7kk6vndG3Q2$4NqN=n{4jG! zFob=h2|=N)Ft;_oRLAk-fYl7kPiHe!JC% zhlAcc0}hnfpTGo|39zRtX$Q^c?p3YKXK<{q078i`kz6B5_+b}a!lMg7ElG@5E`8kE zng$l3ds1C~#WzwPtg}Q|6yBasuZx>?Z+iO4`Ld{}yadmckBlZ{UH3&YZpes_Whk%0$Zb(cge@|e9zY1!t z$eVZth@4c(31#yi>9JV!Yq?Dc|Nb$Y5lTp{hJo)D%>QJOwNJ?87iH01oPJzQG6XtF zYVj@e3d#ODVqViwG`IQwLhcEyM0Cb+4m3abyaY`Lh9lR`0RTd9u+WP2L8N>G!)@Xb z7SDW*Zy5d8R(86_nb&NrmVWBT{gNQnOVJnHrzQ*Jmmjg3!;#(9W}XEGFH?9nar1q- z3VX6Hdr|Qx_3@iR-_WB=fr=80GV8z#3NP&Vl6F*@t_|tSgHcZ zh6CS@rp(L%+_2vGWqntca`fYbtUkF9r&+O5Wj!CoZo}S1>um>;_NkJbMM3NK*POSi zngTaBHWKC+Rn`k#1RAsOw74tSFiU=N%yBM`vFr0U9s0G&47E4;h#vzOZu3mpPI?^s zbcXo*AZTM3c=uqf%;PN9IqA~Sb6&OM z2ywsjhUC47;99gk`xyQvBF>S~ZNjfX#_=lh&ZI9m(5bw+HH)Q7;gYLQHTtI5J2Jr| z<*j9ml{KCQ!{QhXW`Hx{B{6!@vhAS^n+b<9&UEC4#0_7eBsJ$fPM~_`6Oy7RJqr=c z6s~jau0CP*fk-S9?~Ymi-GE=Z7O%x1I<3XB?9S!X3nxD!!%kHZJ-T@7Q-v+KV%&cB z4E)kWyJdyFcc8?=%lekL%`J~dq(tAQ4rS>9{BA2c20=BCq68W|Qb56hj5WkA1bTsV zHgi2__9i(aB^j~)UUk~~xA<*=C%S8r#wsZ+2!_2NK2@T-%@NR>sV`j89srvYwLr#K zFZ8C!_#oe@)Us5!EBQv#n9ZH0eX-=Ti;n4!be8;Z%#TRQW!+N9Ygst?z6IZaj;y+u zS3@m(idhNcm>Z??_p|HyjoWyo+oD(e+?TqYKCS?0uXOjk>g4*)&vaIV5A&$T9pAys zJTKWsU?p;wZ_nynaR?*sIvX-ezZuKmqT$ zX1&GKn4=Pgb(_pd^TUY8Rv4EYVR5w#mVP~+X3e|UPtYe{UY6OkXQh4L%AY)(UDq|z zP;xt*o3g{)AFm7DL)~yWQNu#|O{nn~ai$f}T=aAL5pnL%@=ON6!iFE{daU45}f2;dhxiCZcA zj^TLvvzOYUcmd2IGNzt*)GD!^UH#PCN{MDeC`{G(!dd`JUtyNI1b;&xUj5M6OMkJ; zKIh=eiMBHOv->V{X^V(}aff~0;V$hLJ7 zAsu6!wR5F8SIy@7uiHvh8+-Jufg~+c$YO03_yk-7H?*P_l#M~@V2;XGip)+`ZKtJS zH)M{oUtiB#x@*?QYHUy5h^=_D8(Ad{9VYcgYiXh-;z9S^vEs=udnk76q_n!P*;tFe zm-rx>weAro@e<4!Z`P_28Yenq5up=VyGj_om+{`u<(m0oO??GFfJ)2zCqV?O${af| zU2+X6Q-9oK;b6S5Shb6I;lOxCT`RpTHnLAY%e$qn9rD`t^H{!RT|m0Z+Z5-6bm{Dg z6YefLm_Jse2f?faQVX2(u~@Tf%Cmlm!xD4c1cm}KPq^?%r95qBJrvZ-vYAKTxFU|U*#`(0p;%->J-E^tvV(Wq%c$Y z?fI^50>fFHGWnY%&w?$|3`@<^!N zivjAWGJw5EX}+0I@!{px4gGn@y#A}+c?r7r3pd)dY3pzcXdZPy+BFvkM2I||c=kAN zM+<#R-*q%3LvAFxJDRFG(u;Uvn)nQmjPNmkFRI>z0hc~dEYgCNDcTsA%72`@W%i@4 zs`J}~+Enagq!NoU)v#j9>|hrrbD@HZ*?R11bDGp@4O@ljt8b%QP2k#EMu~0@C~a6V zlZ`ph!&{3dd3?LoW7i}pXqgPBy0VmrrR#58_MU7vb@Co9U9OUo`pfY*Bt4*=Iz&!Uiq`Pqp!+5GI&Exuh{;|Eb8YvcF5-E zXv7+_pZM%>>EcYM5blK|#l_UPJb&nzC%vA$Z)z=v6PJB+&)0VO_Fylx{S_R%@3#J8 z)kbrc-V6&Yj7nE^dM$eb z>R71A0M1=hUG9*?b3n~(-*RI9#?THQ@g~prU0ZOnaxK0u9}%m}V`#h4`Z#04U_bIp ziLl@`rZFLKpJS=lsS%_=M`FDiTQsNTIO^RVsN=}p~tx^_k7 zd;Ei4!7Gwd3~|9>%DGF11RBDv$jfRSUt8vT-xMy5ta(?K`DzJg=?D2%Nk=TlBYc2t z@QLuv6p$E(eGks_9m(*rF{a;UHsPR&Fum_5Gl9OeBP~Y4qR1O_yzil=c{`fdW82|E zgcO7sw>Cr&oh3eq-=d?7jlVOUdm)#mrt_v?s>P*_Ifl_M#Y=kL*fs*qX!-ptT;6K= zpg^)lD{k{{9OU9wh{a6OypL)3TRnflIGxQ5;aE}@Mh#xs`Q1EpJf3xJ2)(D*c-E+W zX^7&Ncc^U__2OV1DdTF6Zp`DGhOzx_&j_sn`kGl%n+|3>-;lH$+c3te7&^Jc3Y(I906)^I=`rh!#WfawI6 z+1#k~43RjsQ1KG0^AwKLljL3kqkTVK4XBA`j!a+GOFaj;g5&uWnkIq-=7GjoI;id^ zd#EOHI%C@FzIXDrnddG+olG=8vhwJ=-RZtZIcR(n6uH?aFgLT=V^K^zs2tafvkrUa zHM_s%b8=SwW|w}K`{t()sEvNhaLMN+=I`tP6k*AVN414vHVs)2j~Ag9o%suQizdHU zY`u>0Ps$4IIQ`yv8vbpJ7*~1-a6xC$!3`z2lELlQ_IC3fU$Q@YjoX%xTGDb*@xdDo z?Fg(b!H|c@5AFtZQsdaM94ni#2X6c{XJrVFGhrjO`PiAb+8+>kHmpH+!^H}s)kl7VY%nb$+4rur%R z(vOek@&6Y^R~gpi*Tzv=5D)?Bp_H_Aw-O>u=?0~9bPgsU-7O#kMLH(kjP8)`8r>TR zjN1R*`)wa~?Rs{e6ZiSmU6weW7wNN9+k&&igXFsAGz?!htKtvn>GDu+8ChgWUJXdY9>r((9Fr^=SIDZ&;X!nJ?A+P!8XI zsBz|!B!4NsKrQC+Xi|TuVb4j=YksOE1CnG5alaS@leo#uu_ekivrN&2OSif4LZ2sO zF-hce=!1gX?Df4xEin9E4=E8Ix6s1o$HRkmG* z2%1L{(VU<@r{$9fUOZhU1#fFusleL5J&+qEF(|=00&~T=XRNpT< zo6VuLq*vrD+#HYJa2>mxc+{2OK-1=&!^DY#ckF(OHPijE=n z8Z1}==htfDd89TnM8`cHNZ`59xEe+0p?Ize(AAq~QDTiPz@8%@9(Q5Y_v~=2Mc2tI z*?OJJuve=!{e6`LL-S3%-wm90DqUPfqK=$eeIENF=>1M%gm_dgVV&Sxi zHEM*rgQ&;gJ!e#o8Ufvi7mdi(Y3>Mszt-BLaSw8Li*f-Zd~J{2K+bo$Ox~j{wyr59y`Jsc3bLFM?2@ENF+c3b zUIjn=f`$1*h-E-U4VM#FY1siR%<*@}3DAfR0kqkj5msX(L;QQ90LvpX$%tdNSGvS@fdig7Cbfg;o4xm-UnW&=%wcOWvUJ- zN!!V>o*<3r@T)6o`{OV<%-o3rou0|Gz@qt8Vv7U%;Rfh%+-EHwK{#k`Xo}DWS zgE)_3dLBGeeLi72&f&APmzkH>fC<<=H7)`>!6@O*^6{xvrDTOa!D1b9gp=D5I&9?3 z&@rao<^UGGBxj0B9kdh9T=O*o+uOj+m`dLHw7rO7s)HKcwBLMs(j=5I;aq<@=fyJm!$ru z$FXuOC6e~)R|_-Dy<%at%lV4NSg#fEqrOEb@b3YvBHvx z-y>f9#`6>IkFu<|c5nO_tcgZLP_0hXS?<^`LvPVLG-zmB> zfoWZFRbp(NAfuK^m)j+Tu@<^; z8QFt^$Y(6j>^Mk)KKZ3`RkS)v*?2}qb^}{6`otF)Tm1g1l?N`lFcDU!CJHvQZKA#e%`Pv}*o8G5xHajWW!~6E>;BvfqwwQ^H)+7);4~e=4tZqv8k=`{ zXpZ?9FsBQnaqE5yXY8*@SAI@wJoe6Wrij%(<5%vvi{ozcR46$*9~xcM_ZY#nV(-!I zt+My?4T-^(_KottWS*m*OLglPheX)vkcY>%rM)UTDR(3;c2M8XZPo!#P3?`C(_#OH z%R$ThH`n{mo_8Nj!2Fs#z!apBW9A92$R{ozsBfh7M*;cQA6)nbS;#;9!G8S{xC z4aV(3$iFzETv5+Ead?$LhoI}Hvq{vFvlWD$oJ(1G6V$}uqIKXa+fN z04#DN=VLaPo-%l{PBWZETuX6a6NNQKV#9FE1 z(}B{XM5t25hBqbqzLDeZ7PFCkYVyv2Ck+Lq>ez#v<{=6!gAZHGnAby&9QaJ)bT!tz zD-#s*-lo=m^W=v?H~cBYK93B{(~9oeTxY@#url0oogB^3-!gF3-k$dj>{(LSALcPm ze{8G}GR2ntc5NuHVN{;|U!``ei|kpT?3Lp~cyYkbzG_#aOp@634o0#T@?^vSgi0%~%f3I^Q%J_r6$Gf`&k(ubM zO?Q?g{{L`9w^y3&o{SE_@?)_>^i56@Ys9ObYtz^SL>a`|xw;^d>q_0}pTfDk&4DBL zZ&SyG#~?Nx(%7LL#SCN7sAHpKttsVV#!!L+;Y@$`L;e1<%l{Xd-W4suPDQ$K(V?g)sKuZxTZ3!@CQ z8vh>G$&)UR6vi8GZl}Yis^WsZKB>}YSn!tE+L10S#|xmjUmS1Uk%IA>tFdOa|8N*E zFTnOqv#i-?o7eFtToL7OBmmk>YX$e&VG8GV^NZAz37mvJ0^e zz>HyJ{({w#!fV?m+X!uK!-rg!m)2~RMl14bLZ+diE#ylii238hJEdh+gsl9P2UgXk z(^p10Dasd2_b;}|@*@2{sVgn*U0_m_-?oqQ{5D-NP5Y+$TEep0?=gOcs3vHs4BtaXTQdKwkR24SgTmqdM`3KI2P_2mmpIb1B z1F5TorN)T9h)kvmM2~h;D3_7?f>L>c0vn~je7N6={4<$A5JMkm3&Nm6Vhy{RUB(^o z=2wIr78qlv93N(azVO$fly4u17Fejx5-OReK2=49)gq{D@1FijL3jXm_+23L9eLB zx3*cYF?$Qw=kdzwby>D}mJyFd*}Tuz;E?(W^h=fM^76)S!D9E48k$msX^LeIEvu;m zv}f&`sj`2XIqUss%CTIl@WZb!%?YwE`YdW2U?47h!L7MQsEx!;hNN>QjkQG2?mI_j}G>H!DJ1U>U@4GE3#~DcccMbD>f* z%3YMb3m^S&9?1isJ$zOMaZ=tKsZGo|Zg|Q7D{1b{a8deyi%sunmbk^a-Idc zT0ZLk)U6Ad9<0**6%LW0xaAN^Xbp{PiNtTu58uX)qI#M%?ti@z&)p zD+cfU4QFzQ(SJC$syAUri8nyL>3fiq{pg`6iC~lTGcGF*S#|2UKGZL1?_q_Cfagsw zD_bq7&=C(%5HXr(!%764SmWoqnk6eg_dIWKHcQ6lPDNS%Dmc4^Ig?6Z+u@cuEyTmk z?|j6&D&RX2z3MamNKWzo9LdJllRHh6jJqaZZ*C0+AdLdON$WN1{dho9Bcq|p1^$#q zc^iUI z)=9v>o6ry#8x5%G$ddu#KZSE7EU$5Cx zsQ=&x9oxNDAG|3#O=QnB3*8{f_kO8G!~_}VdGWEyD6YcIDB3x={`NC+8bb^z0Xw0i zkr#>&x$=&n#hm|F9rw;j6QxHPOKDg0=9H>&f|{yY%uc^|zLg~pNE6d3j4Jb4I6GM& zmC4EMJ)PEVAKHSS9K8qzeAD6st8ZwOn>Zc+PJOYJ=e#K6!FXC{U+DD3z?YJ{0ID-4*suGgd-6RERb*t8j3WELC7Mj% zvj1>CJJcTeLRE-E=T?<9c^<0{$8`R%-awL(NlWu-5$M{pL3eLg@CBX08H4~X#$fMe zWMdzF@zNo*G~kt z1klFJ{0Xl`Pe^poHe0dj_4Lk@_sOdYlLERE`H7i6Hw~W@tYr))JWrI7ZBy5T*TwzSL$5nUI(Z!HgaqD+--A%*d4#%f6n7P6f-Mt5M|x^o>31WQQG$wWzhi;(c@6h#tYd;sGj} zE1!(>B?-bo2gRp<3i2g!cETZ_j_t){{$nWLQdc`Ya0Z{U43R6?Qo-l8>-nMf~ z3W5WpWgHygz95WKHaFGJ(fUl~?S0EtjXq&?Q|zWeUm~&Ev?-Vu%LtLQmc&^&GE=~7 zl2vsg5~w7$elTajY|!dkXG=hBl#-un&wn^{auN>W(U1JB68q>e&;k1$B?hcFV;pCn zOv>O&umt@=9gbi1v$aWO9CvU6?K#fV1NOY*028B=8O7E_&<2}llwBZ!yk{*Ty~z^$ z!^4ZDLjD9DJ`JGoO8fajueRiQAb%x!sOtFxc2zBbwpI%-u|tjhSbPkw=JG0FnH|6jAF56e95w|n zBPR>SUX^O$J(5Krg5dE0nQJnPlUk}s#Xy4Z2dz^ADOAkWgLvOGnp>+b+{!;3fFA0fvxX+e}0$$DyYcyyEgaw6! zrIizq{2h@FRL(~aP#HwBnYcK8RWZ-V2k!zsw{P*cgiOIIe|Fvy%9p^7q*YLt?T6Us zqO7D@5|K9Y1`?U%C&q2Uy{Ffza+MWA)j1Qp;P|2w*z^SmLho4@7Ut)T(G4VhvIL_T zHV%d$x0QJsDlnF(kk5HbI{HDf|4aZR`|c;B1E#Ha%KbN6_7QKMY|ZS#bud(5-Z^YW zkt`AzQj~CQ(1?WQ&_L%^47VI&UgI}x;|TwF^w(+%4%})(rfmcjZ20!jsnUsQTNnc% z&BBk+dPaP~G!lxXVDh#`-J!9(Sl5t=hJVfm?54wd)P?MztV!UL{L@tUAi6=G*x`j> zS+4CBfvlAsA@f=~(?pL8x2hs@t$on;TQ6vPJe;cD*-n1JKg~}9p$KJu4On} zq&A;*94Rtz$;ZqQ{M-PYI2~yMb*7!qyftWSBld8|zWsUfzQKd|<0DqaM;5?CcZgwU)otWf96vZgp-PktXf(}G!8uQFF0I5>g0Q) z_)_-_1sY7*?2bgpq3uIuQXPd`Crm^0VEn3mvaj1K4%*#Pmp3!P-h04hHwx|AY11<;uN=o~?-8I|4jFf!m&?kSQm^L-H2M-n z!@b{asYJ^7XJB;U-}OYh-+wsEf8U?%2NC|!JP!1HXLVJKRRl%HvAJLQr*KFf<9gE($3-OJwB&KtrKHW;BT+={VZb-{*X#>+DbijW z0sk&q~xJ${+$@y~m4n$|_f@7oN%vPkWQY9V~s+34p6?zE^wHx|l!NDJsB4xOXi| z`u{gVAF%P12$y&HSrmZ$A3W+hBhwffvT4YkA-zr^`tySSOG7jNSFPlTWCd-l@$&1) z!N{%oe)3}{1`|k39>vZydz?^CyuL%> zMEpIWA2tcruZ+oQKT~+E4#(o z=SL7D_2|#2Sc8V9NoN_)t#ZJ>SWPi$+Ika)z;Mi8{y1Zms6I|Y?$*XBJ#3#z`E*jId3c3Qu&z{&bAQwI@Se-#_dFD4F;*3M92o=O$i@&LIr{-i zoW}2_7&bwn1up>PZFCh*p2msPOGEZ4YE$cHLJUs6LSgi~`qm%rzY^Z(%>`4*mV{2L z&wVizaLI5sAFRcfA=UUQR%=&^=S}^<=@;4C@d}-V6gEUcqP^)vUE~MksGX$0yUuZu zu{HJ+e@^m@qwo;4hz#bP^glkdepbn}8+Z z-aJaM*#_35u@}wxr)JXJB*%|ZFNVXx!j%xv-j5(++bV$-{)gkdzLbhJblkmI^qby@ zsQu*!?}ZTDTRBu71w~Yo?cM=xQEaj7XZHaGiF!P; zxe7GTQw=qV%6R)QV}IlNeJ2;PA#Z$l-6eInWIyGn(-kb?0(gfa#V+>t$xda4!H+7Z zLK37Qx=H>xUxn zrB0ywd5#}afc};7=rH0a5D;^*7-S78oi zc%c83OKl_MWJ$AKafq!??r^&S$zoun!V1tk5WU^9Vy zy_AIc`)3oIrp&o_Vwgz`SJu*e_nZ{x5&>{o)IOhE)~8(X(0#fJ-^UnoY=-K7DSwsM z2Z;=(`9b#O;*}}XI85s zqTvoqMoS;{)q_XuNH-YMAL;&}Ad-J0u^l+or70NXBTG&{9KQPUJi~lTV3I%?Ok}*}Uk+_%jxfstPBv3P>PL*J>hWZ_8ZrV1ACa}vUmVOEAnG)?b z6ic~KSvLK-q?>1I1(kmvfvhaDz0=$I&8^CPdYBLG`H_7CQmaRwlsbx2bRoC;`={jB z+IyG0hA4D8t&-e+$9b{NwP*m*rqe1PuudDfR|~Yt@6VSGeDO%Ft@H7$b|eQrLqjV! ze?trOrWdXigFKQ)KhMa_y6TQbxle5Ba<QPv3(-2N__DXf@>@PO~k$5Hiwb?T+#-=x>udfc;>VPqpENZnoU8D;+*vC#b_i( zWB6Jx_|(KiPR3XIE%k$zDrt!`y#4UcTwHE_w+H0}z5v+05BBDVCdM6Rh0iNe%cst&l}V z8tO<5VEkRIrpGDKe>i7xjKKuInp#opr8kww{GWnR&!|@9zW#>;b>i0q8uEfyDOV(p zYPPp-bPTcLF#Q*`@e}_|o=a{cnRBD6_#kz5UyL#+zd`R$n0wkipP^en{Fz~sdMg%? zk>j34zjiA8J%RAa0?VTW&mVUNp?wG)`kMO0rEKeE#woQ)UTwicYB%D3g6V_oy`uR` zu55cSwvI@$_#yrmHwN9}=O7n3fA{tlU^s%ZP>&I0%%*PdVd*?yce~x#x)(GeL|l$v zL6>HXRkn!9W_c1+{D$xzfUfE1m1ASbEbTe3^Aklt$C8^Y5(0QXKj{LicWTw-pMAP> zGQ9he0jKxcmTlwFJzVOf_$%hK)R|Y1La>xY=QBQ${e|=ed0)6M;Je)Hz!8KA)G^2M zM%Yvd=cVwDq^y<{GdV#c;V}#q18Q7TgEH484C{d0j>^m1JX}_uJ3iKUmh{FQN=$7& zaRos=t#3cO%8PDeEp|ja9&%v+7w<8Wm=%h@BiS`{>m}Oe_GWEc=0hv9e;~|Bswmy6 zO6aY~n3Aem980U~2N3PuB0~t9HMx1+h@`8Xp5K(gg@Tt^g$9=d-}F~9X@e$g_9Q_} zcK`P^J`^6kSe^%K%0J^b;cdx1{Z->{CK?$gR(Z*$%||?uBO68Gm4}r-HMdOUkMAtK zO7u_cl(D(++`?wmqyy~DEMAg_!Y#k^^SCA?n}re4UlP2$v(iN5g?4#8$fPi|CA)uA z2*+efpL826k-Nzr9p5o=ZmcEZxjVv%v?X0;G--Z%mem5;qVt3WX?PM_`-%5xv8$=q z;yH#EZ8;S9OC1SQulO#U_Yumh25mSM)$ z8DL&P0uy59fUHygS8*-x=r=m90NnTam;Yd$E?TRL*1gaVpQ=5u>U>5_{X=;0i?RSGk+Ktl|WS_NdKE}wr7@&4`2INOb47D}d&>DvimWvrF~Y$t4C6{r-i z(7r`rli7Rrs-BIfIy&^+N48Hh#C?yRtMfi@M0bv0P5N2VlKcO^D=tk-+nghQ_}9mL*~?|Qj$f6kvwm32B{wV zKDj7rR6k~KuxxIP>w7qB6MS&GoJRm-E+05C#Olb4jW&Ak+4{@~KCkuwbZjHH>00H? z_+&^(=pG+5iv#|$Zpel$pDsl>-Rh9MFhJtTxTC?T^_C0yKI?{W)EAUR*F?A+TdJSb zT9^Y*ge3O|OGXUKgA;0`Kbx_G8D$siW&2Hux1Qm9=szRY=Msd8&K^?q4;~NM7#6>r zUilhWrv>3rqnnw19{IoGKhroh;WnW!MZT+~z4m3?+hq%Qf>yl>`MXz(u0`a?3Tr@b zTu;Bibwl)^&$;;xNl&{h7bUv7{#B7S$kf|CFDh^QG;1IHyrJ*qNSl4;su4Wt4ke;VKx6>T&b~d zM+tgaKyxhuzX@v0I)*R>K>{HH3!$^hm&A6OQq5*Jx+IuQUa#!9-LR#Q$qo(d%ryS# zdRiwu=KWAwCz5|-^FDo}N^)F*P;R$=Gi7{kif2sgUA(v2P*fjxU5MgMBa3rBTVk8s z_ah7P*gCdpGoxi%j>LM=3G{1&-oRuBt4)h=X39yJt<5XXvXwRe%6*D&y0}eyl9H^9 z$jtw68qZFM{%Sr=>tH~ptg#Yc#wK4SJxac?Rod_%m%#YL(odFwtxm6>e{zxAc%jbG z)R`c%=WwF})Y9@R_X)7h{A0!zl?=2L6B=t_OQ(G}*-M~JSnaB!|6Zbuu(=amSU{1V zkf5f`W}oY~p;uAFMJYfbzY_ud!NKCQ*M_0o+wMti?p=N0+^s}L?A6*Bo(on-fT+bLh-!&(9(M};*hn6bfx0I+7DeM1C9_2rqpjY4c_pZ{?rH?-2FP$k7_M zqq~NM8UYpxxlf_O3yJS<LW%@pTu6-ucM+vesV} z$xGRpecb>}dw)^!HekKn>w7AT*zBNzsQROL10YJXtaZTi*Skml%a)d-8?c|N2_}TB zG52?Cx6hWo~O!eo=x26Oq-RBafi~`@u z2FyJqw;S8Rkwy2$C}^TD_kfkR)Jhx>#NON(gC>Pk7_L}*@5!ppH5I>WAHQ|qHBdcZ zx{jgjm6;cJEHvfvcmJv-2rU5YQ72ZQkAMw#((+56o8YAI*6`4urq&JX-ygdt^mnKt z2l^7J91RKu>UL5lc2Y#uo>bVhkO~grxTk1<8UWo%l+XZAg(#4nHqG<>#;y4=thP zdB}ow1}khdOz;YZy^JfbV5KVO`)h1XpT);ZnTB{f+TLKi2Vrq-z6Jd*XWnM|4+WrX zC2F8-)YioVH%V;M?)l!-+Qj>}N;#h$B(L52ny>N50_WVb5kcdPPdPKF)m`oyVQc+? z0qzN^^=vH^;|=rJ2oAosTK7P=VcPqe*RucN+|Cx|y#TFy^4)W1b%#CP##-lypB`5W zrks!KyFOMEOPBBKQ)m$p4}_kcFHISaueQppBs34Q&KGK?un!gdH+A3F)*i!_Twugb zJVDoWFW4E(RSIZq&EQ`f`ho!`VRGZ zM2aru_Q8VF&ak?iZ$FIaNY_5cH+}xG$I7{j^AvsT#Ni?^{xxTat?5}<`)UL&>IWr6 zf#=EDM-9KX#WwH@?cfP1S3&FZ?bUVZdx{WAj=87sj}UDkJ@+>>k|sreZh?C$}#l_=_T8@zKq^ z_?4%zs^W0vrCjM>j5KjY@B+)D76yk9p2mDsdW@Wp8Z-_%{d8A ze}nts^&GSGyvU-Rj;o7HhM|j1BTG7^O*IGcBfZRO$=Aw@x7#{ zEFrlCZ~z8wiHz)lMbocB&&Uq48(Qs}ZJQJpVsoz%Z~dAUaTxOh>sw6^Zb!tC+B=ZeXvv3B~^2#_KPR3>wCP1(L9faT>T|* z_U@hHwbxy|I?VX#PPZ4R-s4JpsC{%JmqDQoK07yt3bw2%4va;REnYuhBeU$foW3w= zFsk-xn)(H9TJ$nBRh;pUM;Dl>Q^T`O0@LKZ0O_940_Mvb3zW&#ubF$$9UJ)BLpmGU zsSxe?9!(b*SW;D7e0cGGX}j^w`;@vQDTHL!uCJZGr7yN^a^6hh5`j}Y>xMvIr8$9# z5nmnGPbEgmxS@LYy!Md*Pm9pZk3qjQ$^`^xIrYCi>wkm?F+MWlXNK42+OKw-POhuk zG29$*)Sr54P)nG-JFR#S@VtHH^0=oLK)#LCTg_fRFn>8omd=Y8skW7ZlcT=h`B<(A zwpU{>8bp2ORhJ^&Zl#)SLYNh7one?&z)$YYU)T`=2X~PB)heJ=dn_WM-0hkAO|ce} zC#U#r&j)b$cAgFzrB8gCAveBfY`h?$@zy2Cl&{G{A2X zOp7+om{epW$zSGFc=1YbCcqn(-XUoGUXIVNdY6di;8pgkMTX2T<)nG;=rE(5qw6W) z?aWj~&`fYm@E{ytH5OuhM&uU@oV~ZHKzB2l|A(Wc7N3~ooTMy_XEs=v)%g-AtD^7< zE)gs=Pz+{5Um!qaj`ZHU(WN4ShZeTo#Y1u@DL-xX$amQaobD^JIXSoKSd3~EE1m;A zxo1aZhP9d5mB=)hzkH#uW4zYhcJ;-cb?9S7vw@8yXF{_qzQ=z!NPVGeKBQegy-I0` z#lf8T^!|v*oLV_c#>$5(>*dUzx19u>0Kx4ox{no`ab9;=%|QC=4lS#GIeK)$axavy zy5;lB?15_uC!Ro$l9l{kPCGhKaiJGNV$(?GKb$uTt>15~U0o%Ppn17q)ZH7SLt_lA zbl*q+s?xW#mpylp_R*gUR!d4hnIz#j1GwpMa{E}$AfGF*_4ySJc!1{sO1L#&=zp`S z)?FKWWc4eeTp6CdSW##9w|<}&IUglr$dcVZEG_QuUBLf7GyBaj*}#hU4-Y~-3faIe zIr=&4X_g?BaTht0C|^LG9Z80yzA1RDQ-bA^`ocE7e97S{Q{S(C*8+s(`zn7)HutU} znS`L5sv*p)!y_sZ_Y%!=R|2y&_lsAO`<`)EU36z-;0XSdk_W9@V{f?xAWpAqm8*d0 zgOy$#KjWed&0!PX=MOQhE8t>DNlP9Q!}_VplT%jAXw1S2s~Vl2PygK?D%?p`+JAH# zmoPSqXahG*k>_R;PiMFljY4?8B{nGzGDCk=p9Qm+n=(bHyZ*{y$dqnxmW`4hZr%!s zpMmbK>@Ut@JG&HjWUL|ip?_|QUjLG_9*f+nWSe|D=6We*T)p zb6hHp6foQX*%YWt{!4qNJ)7oA>EhmG>4vkT&gce&1#F#O@=3n!)?qAnyYm?dtB=Ck zwP)PTzj58rse8Q}qEVwRF2aryJSPHbyq)|;|I#D@aZkKnQWO&`lq?(x3eR=zj;*DS0S3euvLPe`PUB8S8 zU@d)OC>S5X&=kGy9%RE;-<$uM$Y{fwOhu}OQdQ?@GjC}wHR$`-#-}eCSZSr3B)k5N zsbPIhB!d-YUj^B$kb_ldb=lGE{h;TY7R#{S;OEo3Q|nhCv~SRF;K+bW$tth5)OJL- zG)16WZcFyf1)?~?3l?R7bi}fN=cC@%8{X9v{no@H< z?P7CFfu_|q{?-eoP$6GNtKwqgOr=_>Z%$ HnIgF2c&J%QvYmp3AatJftnJ$}(tv z)Z4q2zjmUG$SpbiD$Uo zySkWKE{m`dZPZn<18WZw%Y+2fXZR3ma_l6l@8c2;a$Z(Em|!umSZu7&2toiC-P8SN zMeJ>MMxJb)ht>3`VqWn+Pej9G%Eg=@m-Y!IGo>{LD{QOH`tUd^cpiKCx2bWS zefoEwJl3qss)`9I`Q^3X#)wVSINS=)r>_{wQ!h5fn z50mUpzi{`+s9L5?9r2RM-YxxB{-R98{QU2K(`e7$^`|bEA=FiwVyRY+i~jm*$g0Jy zCxjz2dr-fM*t5mcQwE@P53^|9MHF3qYyBhgni{D5GqWGrS#~(1JBiX|Jx6exNDlw6 zOkzLT;S=ov<>}J7ryy%^F@l^F-J{gvJ%7wuvpkXW;_Q|46{!RkPwzQk`{Do?jr7q7 zOK6Y&*B4}0?&Kr92qb7F605bQ5-vYwN-VkO>00hFma8pYGuiiTY?1AQkCvFR#kZi6 zm#0JhkCaPdV|`}MW8*mpz?xLap+pKjDZ&Z4sQdV!)H`IY z;%smQv7bJ5iD6+0)uYh^i6&h2&yJJ7zxibm*&%6guDzw0MRh7fN3?!24FmSKof%?g zCi%CkTeG_n_KV6?gW7@Ce*oX9%2jhc(w{_2pF*^U3c#$$yhzIyG~|~8sVpar zHKyaT#L?fUKV-MrAOxuG=V*)}@!lH5b%Wb=VL<3EPmc9h#v2!s&4$oz8+DnzgA8$|^;IWTfQ5)!$2vH|RJd+urf&zt(xB z|7BrdwDN+2K*imx$)BAjE7!2$Gzb@I_im<*7-`VeLhvi8qq_J&vqeoY8TXCd6Gm@| z&w~g!{l6Oy=-k}-cH@$5v`yx`I~^D!37bD7TUkUa_hbXZ>qs(N>yQtP3!A>*n|}z< z4N9;i4}2kKD&Mid4<3=@NpP{~U4K?*H~DYXn!mbW+2n)%ykTRCk<7uXWU|Y5pfvKd zQj6~tD(+q5Q|V*e|J3dRH?SR?$h!q1vb75B+1u(ST^h^8XoJrrSZ8qK=CkiD?K)7Z z5&ZvPWJlVEe6HiQJygy~)bhN}RUSKCpmaqR(pv*ZFKi6|#w3`|f%>E!7J2+LW|2SE zAHkQUy(k%czp-}%{tpM+jZ+v^;?az z&K@A-Jo)jUSy-la3*QVbeF!ghxV?@PwLbx!kuNQ&D7@b~W2M3M*k%kH_+*}Zrwazo zU^wqdfMjM}zwNJ?31$oCp0aoJ+Y~}=GRUO1~ukN*wB0^}8 zvb{5JE%%TwS6sfWv=9Ms6xZr*L1wpO9;JFLiO^UNTN9qC0vi=On)9a&>rVe8@xoiz zYWt-wF3k$c+3Tme-PlVg;*xn^8t7=iyYb$51SolN>ZE#|4kYiJz=+bB5GKx}y>CesmO`+~7a|eevS##pAh-3KeUM3rWLH(Qar4PHP z^|&^{;uWmHF-poj5;j8y<>#BO;nIc4J9R6k9%>1q6uVypmvNlr-y z$e-{qxaxhRDmnH$%F~jd{_u_w27gUaE+C2Xz8ETf`M64?f>Z9>Mb)k{v+zQ{9J_KG> zN(Mev{}H|$B}&mKR55Kea@@{`LDGU~s8{Hg$0+%WpaK*@SN5LnZf^-nnS`==15?rJI=6(R*cJ zbXCrc@RG-k6;Q7yMnZi~uKNQlW2UFK;SqRiuFlCdZ%4!~-30rIWp-QpYvb8cmTtw8 zKfWOk*Dn4uE=hN^G6O2){=n|{rNLX9QjGik56{p5$mIm}GW|&DkL~Z+UNF~lF9t

w#hyEaQs>3q6qU5-T$)*me<_v~_ zQTr`dR+~iA zfCzX)C}|`~k?HPrumo7C1DP1z#$Mud0NWQ_2CN*qR&r_MNZRtXIwpzlxydTyhLGjK zihFZ~fhj$zQ)ibvvC3@m_~*uTZRZNMONY90R@_9L{i?XRAmT&%po1FCXKY6E*A3U= z48LQ`GUB_GSZ`_vswBH!Nme#%n%RRhw=9Sqjb)D;1N48|$moD!RL)i5QA1B4#pf{Y zJI~(VD<yJhq}5}!dT+^WXmV0iX;_ALO-UwA=(I=X8Gan*yi))lih#@LXj$t ztv!$^6v;}vB7r4i6A0nJp1h3Pse`4!-_uo`Nx9=CrLB1%42-JwGo^frNha{<{ogHq z-+0!KmQ_4}3ZG>owviR1$5t^kACSHqR?AG~Y74)&X8xN&(`@N@FD3nczx`QVa&LW^ z_IB<=OXWYPWxJEOK8rvm9RR9DzJc#~-6(GUz9?^}?p%O$sEHHK379xoYnC-IX{oNe z5Cv2(50AR-cYJmxMYiDx9%Y{Zo7d`%nG$aqi&P9PW5-xpf1Rv$;j($g>1Jf!%B9-t zkN29qC!b1(Zh$YX@a!o z=uQSf&@~z|v@Fs1U(fr4vJ%(S!vOMo-bxzVbQ*-=iAu0rnJV1|jweR+={Z`p&!?LA z+E}aj>IZM2DY2}Z@P%!MGm4}6;eTaac{tSD|DTwMFl`hiYLr`|WS47-nB>I9Id!&ERX`tuk{AE3MW?F_ z73xrG0OcB?#G5jPy>gn0X* zNHO6laiaTp1ANJDwS(DcuL{euTO}#R(amQc)&`;+_^Bm)57w{BcyUgk_u>hGzjXC; z-m%rodY5KKr}R#ZJt9@c9dPIGX6ZeOAVuE1%=ynt@2hh(L#tw6C@>j-`{8nYs@kgk zX}zlU(Z+%Y)~w@K`rT}&32DSIxuCfA9P`2Py)KoyJX5uZW8{rQBcuY;WJjaw)Ga@w z!MS%B>ds{gbPm|kwL0?t!h zSxwQ*QA{vDf@zX+((uqdPLB)^UH3ZCU^Z_!V@&Cse4FO6ahURa6gtB~Kb9G7CX&|+ zBk}F8@1QBBK!0pOBrYY*FwaEE^QNYVTtjT>HBJBI?7bi#YW{w8gPAMZ9r79fEnzKa zMQJ791@<-Vz-0G24fD_c$O6P8x98& zi{B;hQ|~Zwd)h05$kY6*^Bh@u7Aoe8;Mg)t>+UP_a>B@WZx9^G*%zqwxgnfZ{P^Fa z>X+<&$VrJd`ZTAVe>Sb@g+?R4pnP$1q6>Ti=i^2@YPSVEM!MWT*ZDj~dzdw#RsSI^ zz|!TnPqbX!+9mH`^5+;ar<13^RbFaTDxbz_V7!lWw3GBGq{W^Kon2~;kF8R4CcfHy z3Qyfh`g%#0_9S);JP60fN?<&M}dtUG_q&y7_8P%G?7PEJ8&n0X_O@6{k`9$^rq5F=75m%$b*coy!r1=g^ zol~pC#C|}XI9y!X`f%65h#h;i5+e`47h$G;M>?4&69;mgJr<7|nA;SnM#PT=)3Qv$ zEDo$y`Co0A>(RE4uwYNcQJFx>K~v7`XM#e^C2Mg)v}L(ZsUafpFytk@B@A zT<#B@jr-`5QL1Rqbf@LXx(|IWt&=i?p$yAIx+&BE!NY(X`!?;`Y{Dh5d+GW5Gx?y$ zSR8F~Z#8!-g~uyxyHYske`CV!>+MYM;KwbctsQb}@W<=>DC$)sW1|5a;`ey2^ z1C(DFn5*nhIki8+Y}DYr7NKGBFg{~k{99K=_1!I_uXyGsy~Z@qk)EBw{-zuXqT zST9KB^APgt=h%AA8D1L~m8#Nm)@8?P(wA^0)+^qWX=uiC_joQ(U2d$o~ z>6tdcmZ=)0^IS{|pi&!z@Z^(i-}M^}ckl4WhknU^;2(n2DfX#JxYVgY%;cA1@IRm4 zWH~r`oO{nHzLS%~4#rRI=#pAwYQq$<@%Fw-Fj-TJp{LoW?oq9|Ry~~WV;5EARKtIy z$iJKB2wW+m%1WF+!MKfw4WZdgSQ)fq-S1Vx`xW0NvLl zz~)S3z|MK}R{m_;d;aN_(IGGI?->tG zJ%Qmz>lz|LTYjX$R==qu`pedKMJEf@milPIMj5S3k54roSYI$TDlp7KS|lFIiwmqY zF(`~8xLj@$Q^F@NRuXljq;H<#^4CSx_)r6~rrq$Tw=LO+rHGm4N}}-6ss#M~?jOJ9 zA+Ox&oXqIB%wu=?CptLX9WH6t_p;TW__ErNU6_;@1%~DAX}7BhJd!(;t7O$|22c2= zDt5Hgd=cS%bKe)^=@;bdaj{XX+K0pWdf{;jTqu?;VSTr8t`U1={Nf+j?Z19&NtE}C zZqJuavTUBXdoSQcWZSd_u zh`H0fa}U(4bAvh?r>RCGk=85)@L=KrFt5r$cBt2zBTv}VsW9Xsl7$--u!CKV`iPDnEGaMK`qVWW(D8L z!_jI}%lKc%Xeb0cUH-$|i@#;;TK5YI%iw|2S$xd2<4G1H`4{oXz>@Ye)5oJ6f7!3M zouyi}3s#cy15b8OK{$C4eKBaFJ3}v7FD*>{_O8lPQMqg!JZ;&(PthQxf%V`D*E8CPI zn`C;NEFb%6^w$vK?R->k)@t^Bh0`>Z!Hh>^@7{G^GX0&+BX>0K9;^#OSeFC-{7eUw z5d2>nOX z(ls*Q5-OB+HJzqY)ovd$39F}mDN0Ylvqm{)SBAVP$V zS{8=}&FJ6>E>+RRz3afH96d?iH}HN|M~}_K`TG70mAqyE$Rd4cO@`; zU`_3f=)`4y^Q{QN3IeJy1?_4?y2kgFz%&t91`keH82$3K*7}-R$(dn&ghAPerA6pf=T@n0PUeKM-jG+AAeM)XzdF zKs9|_9B4xo0_a(zgV24*vVH~7A4p(p0d*|`Wm_i75<+;Ez&5up5Y}fA;3LvY3Iu7Y znFg>~Xt9*Jz?O%DsBSKoz`XB4a>Z|wA)CX>wp6hBKgl48#{)7a)7VA?KFH}5M@eAU zbPUkY7ZSsDEFj*uURDVyWg`W}rVF~S;UOnH?W7Ry0j<$I0L-}(ND^4r4TNA-L!e(lmgbNM zKR=y8V!0&IBY~SZ1me_I_klW9ggXsDiV&P~tBRz9e~5L!M(C|ooI}ZEfVO!k_JWgm zpUz-${rY$wWIsUNqHgZCkcQ-q1YHGxPHSw+`xDkj=@Qs^VjKqS23C$n%7PzlMHOqs z9jKK(gD7?#3BgGYnQ;Kp!^90bP%DilW`2vHEo*4N)6i%oM$K z!0~y|;Uonu_?K|19YXNmL0%q2>TU__tp5T7gr<|l=Y#R+$$k|3A7D<=3(^e@y#c&= z6OCK^Cu4aMwLaiVqw;@J63<&h@*_x!&^c``xhFPd2l&Gqbz*J+t?Q^SSdCzy$+ceO&+v2>@`D z_yU}-l4sq3dbtAtMn(Wh002M@pe11fkP;CkF~^Zy_=9PQIE91-Kt?P{h%W#MH-O>~ z1^{wNc>cx3B$xiCA#xy*|Ci585`{mQjo79#-U~qfciZj+v41exD`Fks>VpS9ZUC>_ zo)AAbK_#=_RYWO&_xM+-Dl0E54^WVkSJIGE)sR;gBm#MP4LM~1Kp;B*A2~=hqKp2; z*Aj&POQr;gzp(-UkO2Tt5&4qKDJaNiko_YcsX+$$zt|y@MKRk=<-}>k*s=xUYEtN&{H@-l`wExm4WwHIKC)$8CD+~6Ae?JlDXJ!8Bms~+k z1(22XU-;QSa>~oeJtO&>CsB%Lr2p8CMEV)oKNzt3g5z%*;uw_tCI9d729%QiUH==C z{WnbUHx?n*Q~tMlg+DSAQ z|EUfDkntsw8v+0v^i)Q{XfSQ?uPecZ& zrtwFXKg;S5`rXHWPhbFjpb&uc+pB-ezimY%`eU>IW8MooJGpoZx;Xi|1vm*R$ttM% z`U<)O6=ao&^t43Hf3Hu{Kda-fc}SdXZ|I`yP zxdqV{zt`|@8VA5%>zwrN@3zeU(u4r`{_rG@2|00m{-n#q_ussj|0>Cdvm4+_%+-H= z2FU(Zvf%%&|9j2+;q$xQ@A3Uz66e+La{mgkVEC{3@%x%Y%kCKz^gsg$^b3@Aa)mg% z$+|#%fl#LhKzUg?AOHl0J|No1ElAMW&BM!2OL(uXOIXm$RZG}X*+|alfsUJ}*Uj(% zH?wf#yDs70F6yqrU~NGVR0Hb!z}GFvNf7Gm;}@s_)e`>0T!V;zR|ACw|BwWEYYAH! z-4@h=1h@$*%PPsr2@_ifxVmfHxvu+nTjD1z;lG6p4GonIRg{GUcmUG=jK# zxrhC)g#V2jB;YOt;-e+}=c+6$_;0TozZ?J6A8}Crx6Xh>s{;Qv>u>n)_-G6MC;i6) z|FOV-Ebt!-{Ko?SvB3ZTEbw0*o|_-hg9s)1Z-Db10F)RP{^j-vD$2?M)UN3pk^goh z0RS*Bi4A~^M@)~G=mL`hNO?)Y07`i!d3iZyUQ%rU^=}_UPE}r=msIt?e*pbM^cOF& zKfEqnDERJDM$)HrHi>q}xGlS$cLSKI0jng^WF*1>Qf3k|W|H%MfB?~Nr6Bo}{xl=L z{S!pc(9#hJ8i+nM2^kqFIT;1TZ!t+Ce@Btz%oHp_@>eNYO`WKO{n-?vGM`h6T&w9} zzcY>zRdf!BrlGya!O6ufCN6R5vZRu-imIBrhR*dHx_USD4b1METUc6I+qk&8xqEne z-46^34he;Zg~vRKjf+o6Ov=iBoRgdPK^aw)QlC-*$&zS9(&>kE%TU zIC+PAcki~Gl&`Kj!;Xz9PWDsOQM`gYZ{|{Gqk62Qzoq(*rJ)Z2Ub`4h7hS%sO6~yH z%9Nh%?=u*_67B2VLcFOBgWLQRS#u*w)VJym>v$H}8-U9fiiT z6jNROA@<2{1jZKgeb+0L{xJjLj76nYmA@6f&!#aR9OY0`cRGp3 zq#@!>zIcw8A{>QWh9L*looX|p)KBLxAMPL48BF+ne7B?q-5t(7QVB_T4T10)bjV3A zvRNW8tL%jarvDN;(Hb zClMyj0rmE~D9D;gBKHfNv#)`7vW)C|ic*zNTy_hCE;{wKH);%nooU9@_|sTritHT{ zn6~1NiivG&;2#9)8gi@LO17E=xY|R@cT<%ROrrw1uH>YsfOTE@!lJf!T9B;Eq zR=YSSy=0+#6C(5_T7zE$>*$E*JS**_fR8gn-u6CxNT$>LzK^tWg?!nSE zV_YO90naix$%r-qc`3K-k~;)FOd*+D@mT6eUS-;m#}2K;l>`Q30?|z=1m1Ii-@7=h z()V7m&pNUD%#SOWvs2R6EtD0Y%DZi}AI<^S?@O&Q;Ux0iJ(VPG z_B^1ZU~^@xcjeE?yn2J}Hp%~O)=|QCmzAoKzLjk_xb+LlS@qg!6C6wPj-ZTK>9Fb3 zKMhq*%)xg6S9deo44tlq?JewocTB2+eW<)Zngj*x2n@`0-R)Xw(b#f42lVKG0zT`i zI52#ACdzV?#Lo`<{q$q!Ar5o$=HY69+89{J(N-5*&e{3S$kbyOJuk4&2(Jk@yLh1OQ_Y1sv|q?8ZIb`dohsqbtCGR zbAerX8-f9ymfF1&Rnq3lvc zILY`1LFQ0L7L(TPbzUnnYP?9RC?Z8s_Mqp@%W`fa(bR&otpvG_6OeUza4K-EG7>Qr^JKWcV+qU(xj^4wRSgEq&D zF-@*TTH6)%*t;puc%n%Tw7h%s40DW~AE!;jIS;8Z6_Qz63=+D)Kvk7U4hXvPl6ju` zo^8mIpx#|3`SsaRy2wyS>dyd;eH#^mn5!UHSoQsNGFzbVde>4p7rh#T7$SQYAwAk^6N?EMq;j}FriMg`8yQ9$4 z`?W0o!K5%rGI1nUE|a89cpJz#3>#;?!h3Iw;cl+$ zaym0OG-55mO3}?*u1ZTECe)sWYM1E0$lh&54i;Nq`RLvK1LVOHRG9v{Y6IJ<;4((l zWV3(YHHY=nvVsGB?@=f@EMx)vvmLaTMB>cOiLTD(QqfuCn|PnTGOx3QlRDMp z%pVm>kYg)>L1gBZR9|}H`XhjZ1f)X%Q*etDj>GPmN@v+~`45I_4d>fiR**P|!Vtm_ z+y~rE*0P4g159RKs!N~LcD8)xCy45d&lI&p>TNm}IyL}zlBs@-U^*QI^j07ocuOq% z8D7I7eYJxQvY@QL;q$;YHkHzTq41I#`HJNxvJZumme`@G#O?Js(Bjfh$zl2!qo$<8 zWM4^N3kKb<-oDE2IWAshKp!??O6g^}RTJSv*NNpP&1jx)i0e!D5m08U+4<6tou+`b zZ3h5c%1fcB@noh*g;Co!R{iY0ItaorA{F-L^YOO1p|t+u+hAM021B&??SAIQiXn6< z)z@q)42n-%g5@%xkbgQy`3Xg4JM$4QlTPv8QIAPSApwE{OBrb-z`lr#zjKFEA( z@*-LnL0c2JmaGP<&$4pLb$MiQj}Gay)Kvh)NvEg4j4&UER^wBBU?Uw;)(vf+Ds33d zpS8a2aBBZh(Ue2Yk3pBCuI0Uum$U`i(N;bc#bGTLXgg`f-l4$QTACfp_o?bccZ zMpPOI;e_9Im`g@UCU)iYpJ#TZM+0rA`^jgc2+d9&;(h7~e8Ofh`{n)ooV;FjTeBv^aaK>WK|$%~(Q*2^E2U9|fsU16 zicS@MY{_bTytdGd(#3Bkm6bIe^|ewt(89qDgDjQ0%Tmka9)*+TJYL?BLvAp(*Rt;C z0PqySsB5Jz|3h9E<~A~wG0x(m4Ls9h$Ru}EK;Rckm&Dhuo83U+s5F4~@>%#Pl0Z9( zzN{>OyTq}hRBNC=*$||T`L*Otix@43S;v(e^jsTsp&_wipy^~pV6Qq`cq?4~zzhW)B@-Z+rQ zaf-D(PQYB)1NiI_v>O(omMfe6KsLLpE^Z|V53bL;JJ(D}FZLWsXyMp5$MLtZz-W*> zddH)WTO3*1us`qR=-bk)CpppjLh_YF*2a}FzU{@Jb3oiVph3Eh2gQL~>kF5I+vtM~ z-oAUv`!hKyAwpk5(%)}L+2-JN{hLwUv$17V6tZFS5u6V%i<#|xUb4kKltAFcg^%56 z%b(x+aup&iN8K${5TZcyy)by&Ap*GLkL4G)D#s?n+XcSMEpM?ptwAx2B5pHr!s!n*J=$f`6l>QWgr(i9hquU z+mFn36Yq4)9|8z54$haBoHHN2cxb3Q5@(o*3>8KQnxJ+OPH_IpE0(^ zsFCRGRW99lqf~uGbjLLNgf@>fY^*A;KUCi1_}9VL@^iqW&Vv-GEGdkkIdLKP!7kO$ z?$q0JbZaYNMJ?r(d%xIh<-2@UmfC02FDj7;U%APK>3cO0(bdC*yG+$5kXo$JghRaa z(gtFXNqakPZS^r`Ns4^vff(V+%(_btIQh!SANG5A4T%{{O`R2l7a`1Fzu%F0esU_1 zfGQKrx&kq~qmK@g8QN2E4WE5q12b$379%f+)b)2vLSpV9aF^l-1s;Lf+7&Tk_%6tPg7{Z!xNW!5>s&S#R5YC{(7p1FHd-Y9hH`i&Cbj z&a`Z!INRh%jcE=C5L}I5jJe6Y$W7=tajNcJD2N>tnLbD`$O5;c0HWb3X_`rdhn+O= zFGzB2NxUpBV$J&;kU-$5!-5kIn*AF1gg=;s2D|vD7;;6kg>pWaBM%a8d4*onPUYh) zB>!%+1J+q}oX`jS2 zjZ6&-J_ihp%>#Q|1s)xEBj#0)rpJRVBfb`&-o@E6)&*?0-13T`r)F8ats?A{uCBwH zRf^0a3hy{CKFpNZ#erX@!TVr2qLif;PLWzZ3w^E1J^Ksmve%YDu{S@InP1?I$?aYN zv7_4{2}>k6uQHtDN>@5a^Tp-P;?aY1z`X8p-Pk2 zvchO5s}Fi!&)W@<*NA8Oa3w~xRTLyt^|(Ui8&#CQ++$vst7UGU_mCItQ#Yp93y{Gzhdfnr9~Ha{%1{ zLIo88{JcK3VnH>Ws(aNZt-J~*e+u4SrY|`wQWgNfuFQf=S3{;s^>TlX8E3iW1M8H0 zoIOaOUzSx2Hram&(1TZAE;CodnAX6YP(1_UdN#o|^)B(%pDpgitlwc}RymyWMbvAI(N{$BK^ zVa{| z9uFPM%?n1O4W&3`Kn=H5K?^mLyky1UmakwMMCoD(v)W{smr)q+Rb(G9x|5+6v-2U7 zPtUe1+pMEt6rsKk;Yu}se2Y@CSkps!pYRkbFvN`-@a5?}LH>w;RvuT)J=K+52?{K; z(|MWOz_@p0s#<(KKws3b5&Q(O;wv~?gOlC7k&Skh9|=}Mn=nUaU2j@eVZ?FJlS-0O z9j5^#MAHg`%0Dy^I@jnI6i__6#>Ze5#L6@HWh@?9Kij{@2Ghav=OEVh1ibT_xU+|z z+ga&O*oc*NI;G@U8g*J}+ofH2$QkEjIpF9yiz+I3KeNl8zI3Va{W(BJBUgQhnn_?$ zyWyy7=XKSWEo6hl4sDlDX3(PMpeoj8puxp9cwerEo%2QX`1%hu?L%}iEiNK-jp06n z#;N5eyg+&LvTRAk$2&?_bVHu~+JJe`HjlkY^KQ$+8sFOPoA#sW_~8oU#(YJ+B6@=| zZ;CXe7S68d(0diMES5eREGK81uMQLvAt6)sNw56T*9idCyX5DfvM|WVn_CanQTu(G@q}VpluV<3*N|W z^D;f8P2bhY5$M-P-Osj2V;Ayipt`3R#SeapQe|~WaobaDEEE%a(So(?L4JlfV5*BM zziX?f_t{uvquFat?{e#w$@Cc>c_)7T+L0iBG& zh)#?5rKB%ooA2~w{Y2mG^GJ}@MnyTqpH)fS8+z_w_f{m}y)cTun{2G6!s6s*8(CY= z>QsE#;85Y3b~o@GU{hyZ##tc)w>+cYa;q!otk{H1`Q>1ER(298mse4b9>^ggc?^-& z=sV?Dk?ZN;x_o(yhFUy zeakx-Cgz^D6osEA{x;)7X2pqc#JYrJg>Je)3kH%<1&FBP-v!~9AIw}y+x;Bfn5kj{ zDz{mO%OZM=5zgQ^2OcaVDi|Bu4_BI2a!%yWE5pGzM>{;oU#00^(@P;Wyhw6I^b~)2 z6@ruD=!S4_g?A!DS5VA2h+$mVMRi-#x-eK~lZ%qupk1zDrO(`!f`Z=N`_~M0eVM%R zm1o@P_Km42f!AJHz7lRV0@`7I{8Stk@rZ4d^Lvoi%s4nq08qvnI#_XuML4H*d> zEu7^X((NFO@{S(k!k#;RvnfBa8HjlGCK(@l8ARV=Ewcb6z4Cxs=y^aNyWRwv3tFCV(#n>FTm+7gOqNUv@ldR zQwq4rWQV5&cZ#NpQ!-(Lf8ZCu4ytp8J|A4!*gO@ zmbkCH_g76WtC@tmG{3RK6sVug(M3~Iev+DkQ3&)eKO%@v!iAu~fo1xyZI}hFl8$k> z#P{&z>yKaq!mu{Ju3n@(dDK*lN8b^W*%kL3%VRhJ7lQ@VVr4R%R9eanS6??6V%V<_ zzHv5**9^V2zhR{Q|;skxq>&X>-EoL%f8x-DS;> z=|3O1kr-sZS3?zn=4jBC-77M_tY;8DjO?GPu;x73kMMrO&j!&e;(Zc8}E< zX+(C>)pkukUM$hHO=)xWoeFxL1K4&qtb#QW47e_Hta5)yr#n?qFvyc%1tN`qLmg0( znQeKe<4u4gMn1(-X5uog+UR~Sdhb+r7HwWAxdxdNsmW4MNpI!(I)s9Kt?A^!2jbc= zs6hfZHuO=aAU+6_Td}(6pm`e75dBqxiMtN9D?P_G8BlHMy?fg1+s_Y1>o%<>(=GaG zo-W6#)Ta4qFIF14NmehnuQNSf>nejzx3}6a=#rv*S!_3O5;Z`$e{&8FI(xG`?9-Yrms|w-9%%l zJTUpcKHRw8RT^rVI!|a75KA_R53i0bWup0pppyO}+rYKw0il7(PJzg4?JB*Qy^}TD z4MiVm?jYKtsYJ;ficaP1J;99H;<)2M1^f-17Ut#0v2IlwU?MDdF5{TLI9`8ZFN zxHIk4*{J_AVxchWT|v%GO4BbSB8OuskR7=H4}TmqZYfn%iTop+)tvZ zOD!<*P&1_sR^xrx_?x`)GYM^lOBz?cfpkOA2)&-;evWhsd>g4FbBS~N{OkB zj`ST_ZbR>1M|5tqWbmCXI9WL+diF4#5$_e#gJ6;ga-=}?T-ia@FGT9nJ*gK+J5gR- zEPwhSgy;3{%Yn%qbLf+cKXV%S1Eivi7A$<-{OBq|cxQR$)8A=b_;%tfk#9^+tJrgNVp(qg(R3rZmhH_OBTrb5N@}FmJWs(g zL&v+TwDql3)#iFPZdmlb;$y#JI!JMQO0Z^9IN$p$qNj1&@1@?r!aKI8u`k#3hltK~ zXKmJeuS}cFj<6fq?khgYn2x%k+8c=_!A=b|aVYtX8hfJ|57key11H zmq_DHne|kp%ky`x4M)vxCJA>1r92E^qRL<2ZEz&jY1?sRK6o^=L|1O-pMD&T-EpKP z2BTNtoPBHHlupiu@n9g0r%FCY{B5Ps@S3+NdztTrZu5OPR9n+N#O9#7QS@HL?1YNxU61IR3fIest(US(M*#;)}ph<)ot>T@1|Cb7qa( z79jm+PYQ+*)IR-j$LPpv6Sa#qtYd7T_Q66uo*S%tGO!C zHxj866=GcMcf8 z*0wK8cf?{)D5iPz9jBNli~cs7oMTfH+jfXIJ)b(&G^wi*n~}2D;#T$ouPvy}(;OV3 za=PwU98JP5ulkyK#h6Ssq#wM_y=b*!p=&O?$ab-tYfX*Md;KzTSK%emS!EJkrfsK) zSnay7EH?NgHInyapgj*rIoIAL^IS96i+NFB1n|;QDE=|t>g-vkB>>m0LxO&Y`<-6@A*~4zE7SYZV@XOa}PKB>$ z4Sn4olPpM(Nx#~S?zF-l#;1Y!RyoF%N2EsDOgQgvzcLi7vQ&w@ z=#mkmwiCq)sT9u^gL;Tt89{GKn}fK4waUP+B{2XO=ND`lZ!jdvt!3@|v~q8>(b@Aw zW~b%l7DE8szWV_b<$&WUBaC)&3iK5V6!a}oO?kA=2sL&jmZU9xqjBX)Y8ILeu_fo- z)RMv=ZefL{H)`vwK$dUjuCI3kJ&Fyz#a;F_t}*4YUg(RUAYUOXmO8LJ;>FI!cJkp( zaH<^f+QRmDO{_{ABCr(NHBe_|wP?#@STMK5lOWuZn)`W2Q1{Mgi|dFY=@q(-%AgWu z8iQH6T!~`XsMSe1dO03W4+CK(dIcD9BCE%J_Bv>$RFJpZv+tiO1fOQ^&Rq5gpi!VM zkv_GJyGLb~kBc~(!(kDTr^YaM%uq-eOfWE(> zyyh%*m+;9dQFVmVS}XK%!)c2pfjpcuDZ`4&VC!em&IafA$%^dLbi>B8GW^w*Wm?s! zpizlyhEl0ETCR&AU$Kpj-d^Ec?N^m3y}8E{?ZhwCvmCRD;zKpNIa`bj3@-sJKEE@d7Uf4k; z(By-B{97{{`CsqK)W27{LYXA@g^P}T?2e)X!grOpFWlHEH0850iPs7CFaN@x>3i_> z)|-ph+7juO{jRQGxXQ&l+azJ(YyNlvUOqNiCR$Hi|2nA8duxQ8iu>mPhW1GRwM88p z%;MLA%`Zmfzb4D(vMvsq>(cJsTZ-`n0WQNYZ6T-#Vt8xp;pChrzZjN2_u%Z`3SJHpvV3>Ms#)eP~U+|y_o8|tCOLiePN_l>F zm2$@yIXIwM!-$!gUDDUH;6kpJ*iUy>(PT^sIVSV>0mo*Y@IIT z=~bxeHwmg$cdqFZ;j5nWaS`EoGAgB}ee8%CGOWw;{a$mDq|J%zGs9)fER%P+cah_R zus4cx=(bLp`cKOmKH-&W{iGNQZLK#uBilX~aSWSfeD)DYAZWtareP%5t3n5g(Ibk-q3gTW;e#e(qlU^VxF0VJd9^2>iV%veV zZL-RzSg>Z^b4 zd~}uoXZ?PJ zr@F+RSmSHLC49PcU!;5cgYoe9bL(C1s1)Y!{D4_ye7#(uL`6E~Yb!S6ktfzt<>9!`k-up|B)E=&_$fp`LEAiR7$-%jM)6I**|uE6^4nM z7lQyYM3l~H&6JeD$HI?O zWJN7i`Z;n6+zuo>7f1o`KrbPOdSEl$q~io$WVI{)I3XeKKi$N>;ecR)3y=2 zq8F}yj2!e{RWz39zw->M_uA# z1gYDSD|WJce~WYM@%UNYPmcL zaVjrD?zA-(pP3x)_Y@c1L;;|OjPU?q>+F(aO-^~=Hj?*SYsV`bmv;IJg4A34 z(zIW@Jf_X8D{IK`k>Sx(baUj|J4)#E^B%8ar!=wK2n%4tO&`j{;O9`tYGGfmjaFw& z`HeE-L!)RzO({1gZ(n9;qE!ifkFK#Qe;A4uo4!+q-lJNw{~lU})w|ioOrFnKZp(H_ zk9LIe)9r_h)I(&STn<5cNl=e64WpBWa{%%7t0G6-B8n@p}hMdeJw3;iQm&}(K3HTZ+D9Ph>n z0)@^RgaM~A=ooztsC8(0;i(a*!&gL%4oq0T)y$8Gt$p0_%i5>EL7UB!x)k!A&R0lJ zv68Sf%Q!*ddo5I;&%gRsf8<^6wR+UTtivS8{Q1@iB321_VafBDCM1`o&mZb{1w?61 zzo5USX|m=3!e8rG>vFla_oD5zQH$n`rq)i>4*PU^-sFa{d{@q*9;8iY9*@8>SoCHoCVnl~R0Rc|R?iTk?mq~{s8wywt`rEmjsoc_dr`7?Y8(YTztmOs`b zP(?U`m;Vr#x#3oet9C#({tg)Qq5a|th!|?!AL?{lX4Z%E z51L@r1fmc%szWFWycI4Oy~lySH>K}l=jtcoOVeqG3c&$6hK(3~o~r5GZY+qgMq za~6$d8YD(MP+R?)*#<4LK{?O)y1j2`=V4i^x+}OI0}r*(Tg(_*z+8a ztfALCMhUaVOhV&UU7GSNn;Wyf@?5tFP#r}svAYKg>0z0R8;;$H2NlRSaNAh%G5tw` z3}O0&Zzj7W>!@*FHKtejIhn`1pN1*EqW7w$mU>)pTMc*L+$pCHt_%IV^Pz143kq{v zx^Qm`Ri!^|h*-LteGV9Y5WTb*(sG!KI=zn-iu&2OhGc>Bd4SWG_g}qp@aw_mPGTJs(d(5=M z^18+63rPx{*3Lr;2X>?pmO!*XIuc`I&)PRXgclA$u)y5VueyB|mLQDAPQ{LGr!z%^ zQ?$0C@_tV&B-lsserHd$>AjFV#5ihkC5hI%MD*N+_<(X2K)b$ddl*sWI)GG2udmmJmM=6d~ z44MromH8I#R#!G=+4$6N&*9S(;2AJhkkMOpa*kT#@yC|}+VqDl1IpCfwwAlz*jN`T zz^AlXTMDnPLO%Z-{JK%%`H7EG>qDti+%1ok;IB>EmtaA-0!&4}3Y>om&VYlvyt2CS zs+V}qdyG|2P;K+x=7u14z8)?LqZ*fK*GGL>cqi>U`9A3q3)*~ePMDk#IzkCfJba^S zvza2;FkbInAj5Pwxi7@4d_h0hPc-BDqaBLGO)k*v8@xD5?eZAM9pB>u$FI;}?I*IS zdh{1fW1q7l;vVr4*1JT`r}usJR`&Ww9#7O@>aMjAMv7kk6vndG3Q2$4NqN=n{4jG! zFob=h2|=N)Ft;_oRLAk-fYl7kPiHe!JC% zhlAcc0}hnfpTGo|39zRtX$Q^c?p3YKXK<{q078i`kz6B5_+b}a!lMg7ElG@5E`8kE zng$l3ds1C~#WzwPtg}Q|6yBasuZx>?Z+iO4`Ld{}yadmckBlZ{UH3&YZpes_Whk%0$Zb(cge@|e9zY1!t z$eVZth@4c(31#yi>9JV!Yq?Dc|Nb$Y5lTp{hJo)D%>QJOwNJ?87iH01oPJzQG6XtF zYVj@e3d#ODVqViwG`IQwLhcEyM0Cb+4m3abyaY`Lh9lR`0RTd9u+WP2L8N>G!)@Xb z7SDW*Zy5d8R(86_nb&NrmVWBT{gNQnOVJnHrzQ*Jmmjg3!;#(9W}XEGFH?9nar1q- z3VX6Hdr|Qx_3@iR-_WB=fr=80GV8z#3NP&Vl6F*@t_|tSgHcZ zh6CS@rp(L%+_2vGWqntca`fYbtUkF9r&+O5Wj!CoZo}S1>um>;_NkJbMM3NK*POSi zngTaBHWKC+Rn`k#1RAsOw74tSFiU=N%yBM`vFr0U9s0G&47E4;h#vzOZu3mpPI?^s zbcXo*AZTM3c=uqf%;PN9IqA~Sb6&OM z2ywsjhUC47;99gk`xyQvBF>S~ZNjfX#_=lh&ZI9m(5bw+HH)Q7;gYLQHTtI5J2Jr| z<*j9ml{KCQ!{QhXW`Hx{B{6!@vhAS^n+b<9&UEC4#0_7eBsJ$fPM~_`6Oy7RJqr=c z6s~jau0CP*fk-S9?~Ymi-GE=Z7O%x1I<3XB?9S!X3nxD!!%kHZJ-T@7Q-v+KV%&cB z4E)kWyJdyFcc8?=%lekL%`J~dq(tAQ4rS>9{BA2c20=BCq68W|Qb56hj5WkA1bTsV zHgi2__9i(aB^j~)UUk~~xA<*=C%S8r#wsZ+2!_2NK2@T-%@NR>sV`j89srvYwLr#K zFZ8C!_#oe@)Us5!EBQv#n9ZH0eX-=Ti;n4!be8;Z%#TRQW!+N9Ygst?z6IZaj;y+u zS3@m(idhNcm>Z??_p|HyjoWyo+oD(e+?TqYKCS?0uXOjk>g4*)&vaIV5A&$T9pAys zJTKWsU?p;wZ_nynaR?*sIvX-ezZuKmqT$ zX1&GKn4=Pgb(_pd^TUY8Rv4EYVR5w#mVP~+X3e|UPtYe{UY6OkXQh4L%AY)(UDq|z zP;xt*o3g{)AFm7DL)~yWQNu#|O{nn~ai$f}T=aAL5pnL%@=ON6!iFE{daU45}f2;dhxiCZcA zj^TLvvzOYUcmd2IGNzt*)GD!^UH#PCN{MDeC`{G(!dd`JUtyNI1b;&xUj5M6OMkJ; zKIh=eiMBHOv->V{X^V(}aff~0;V$hLJ7 zAsu6!wR5F8SIy@7uiHvh8+-Jufg~+c$YO03_yk-7H?*P_l#M~@V2;XGip)+`ZKtJS zH)M{oUtiB#x@*?QYHUy5h^=_D8(Ad{9VYcgYiXh-;z9S^vEs=udnk76q_n!P*;tFe zm-rx>weAro@e<4!Z`P_28Yenq5up=VyGj_om+{`u<(m0oO??GFfJ)2zCqV?O${af| zU2+X6Q-9oK;b6S5Shb6I;lOxCT`RpTHnLAY%e$qn9rD`t^H{!RT|m0Z+Z5-6bm{Dg z6YefLm_Jse2f?faQVX2(u~@Tf%Cmlm!xD4c1cm}KPq^?%r95qBJrvZ-vYAKTxFU|U*#`(0p;%->J-E^tvV(Wq%c$Y z?fI^50>fFHGWnY%&w?$|3`@<^!N zivjAWGJw5EX}+0I@!{px4gGn@y#A}+c?r7r3pd)dY3pzcXdZPy+BFvkM2I||c=kAN zM+<#R-*q%3LvAFxJDRFG(u;Uvn)nQmjPNmkFRI>z0hc~dEYgCNDcTsA%72`@W%i@4 zs`J}~+Enagq!NoU)v#j9>|hrrbD@HZ*?R11bDGp@4O@ljt8b%QP2k#EMu~0@C~a6V zlZ`ph!&{3dd3?LoW7i}pXqgPBy0VmrrR#58_MU7vb@Co9U9OUo`pfY*Bt4*=Iz&!Uiq`Pqp!+5GI&Exuh{;|Eb8YvcF5-E zXv7+_pZM%>>EcYM5blK|#l_UPJb&nzC%vA$Z)z=v6PJB+&)0VO_Fylx{S_R%@3#J8 z)kbrc-V6&Yj7nE^dM$eb z>R71A0M1=hUG9*?b3n~(-*RI9#?THQ@g~prU0ZOnaxK0u9}%m}V`#h4`Z#04U_bIp ziLl@`rZFLKpJS=lsS%_=M`FDiTQsNTIO^RVsN=}p~tx^_k7 zd;Ei4!7Gwd3~|9>%DGF11RBDv$jfRSUt8vT-xMy5ta(?K`DzJg=?D2%Nk=TlBYc2t z@QLuv6p$E(eGks_9m(*rF{a;UHsPR&Fum_5Gl9OeBP~Y4qR1O_yzil=c{`fdW82|E zgcO7sw>Cr&oh3eq-=d?7jlVOUdm)#mrt_v?s>P*_Ifl_M#Y=kL*fs*qX!-ptT;6K= zpg^)lD{k{{9OU9wh{a6OypL)3TRnflIGxQ5;aE}@Mh#xs`Q1EpJf3xJ2)(D*c-E+W zX^7&Ncc^U__2OV1DdTF6Zp`DGhOzx_&j_sn`kGl%n+|3>-;lH$+c3te7&^Jc3Y(I906)^I=`rh!#WfawI6 z+1#k~43RjsQ1KG0^AwKLljL3kqkTVK4XBA`j!a+GOFaj;g5&uWnkIq-=7GjoI;id^ zd#EOHI%C@FzIXDrnddG+olG=8vhwJ=-RZtZIcR(n6uH?aFgLT=V^K^zs2tafvkrUa zHM_s%b8=SwW|w}K`{t()sEvNhaLMN+=I`tP6k*AVN414vHVs)2j~Ag9o%suQizdHU zY`u>0Ps$4IIQ`yv8vbpJ7*~1-a6xC$!3`z2lELlQ_IC3fU$Q@YjoX%xTGDb*@xdDo z?Fg(b!H|c@5AFtZQsdaM94ni#2X6c{XJrVFGhrjO`PiAb+8+>kHmpH+!^H}s)kl7VY%nb$+4rur%R z(vOek@&6Y^R~gpi*Tzv=5D)?Bp_H_Aw-O>u=?0~9bPgsU-7O#kMLH(kjP8)`8r>TR zjN1R*`)wa~?Rs{e6ZiSmU6weW7wNN9+k&&igXFsAGz?!htKtvn>GDu+8ChgWUJXdY9>r((9Fr^=SIDZ&;X!nJ?A+P!8XI zsBz|!B!4NsKrQC+Xi|TuVb4j=YksOE1CnG5alaS@leo#uu_ekivrN&2OSif4LZ2sO zF-hce=!1gX?Df4xEin9E4=E8Ix6s1o$HRkmG* z2%1L{(VU<@r{$9fUOZhU1#fFusleL5J&+qEF(|=00&~T=XRNpT< zo6VuLq*vrD+#HYJa2>mxc+{2OK-1=&!^DY#ckF(OHPijE=n z8Z1}==htfDd89TnM8`cHNZ`59xEe+0p?Ize(AAq~QDTiPz@8%@9(Q5Y_v~=2Mc2tI z*?OJJuve=!{e6`LL-S3%-wm90DqUPfqK=$eeIENF=>1M%gm_dgVV&Sxi zHEM*rgQ&;gJ!e#o8Ufvi7mdi(Y3>Mszt-BLaSw8Li*f-Zd~J{2K+bo$Ox~j{wyr59y`Jsc3bLFM?2@ENF+c3b zUIjn=f`$1*h-E-U4VM#FY1siR%<*@}3DAfR0kqkj5msX(L;QQ90LvpX$%tdNSGvS@fdig7Cbfg;o4xm-UnW&=%wcOWvUJ- zN!!V>o*<3r@T)6o`{OV<%-o3rou0|Gz@qt8Vv7U%;Rfh%+-EHwK{#k`Xo}DWS zgE)_3dLBGeeLi72&f&APmzkH>fC<<=H7)`>!6@O*^6{xvrDTOa!D1b9gp=D5I&9?3 z&@rao<^UGGBxj0B9kdh9T=O*o+uOj+m`dLHw7rO7s)HKcwBLMs(j=5I;aq<@=fyJm!$ru z$FXuOC6e~)R|_-Dy<%at%lV4NSg#fEqrOEb@b3YvBHvx z-y>f9#`6>IkFu<|c5nO_tcgZLP_0hXS?<^`LvPVLG-zmB> zfoWZFRbp(NAfuK^m)j+Tu@<^; z8QFt^$Y(6j>^Mk)KKZ3`RkS)v*?2}qb^}{6`otF)Tm1g1l?N`lFcDU!CJHvQZKA#e%`Pv}*o8G5xHajWW!~6E>;BvfqwwQ^H)+7);4~e=4tZqv8k=`{ zXpZ?9FsBQnaqE5yXY8*@SAI@wJoe6Wrij%(<5%vvi{ozcR46$*9~xcM_ZY#nV(-!I zt+My?4T-^(_KottWS*m*OLglPheX)vkcY>%rM)UTDR(3;c2M8XZPo!#P3?`C(_#OH z%R$ThH`n{mo_8Nj!2Fs#z!apBW9A92$R{ozsBfh7M*;cQA6)nbS;#;9!G8S{xC z4aV(3$iFzETv5+Ead?$LhoI}Hvq{vFvlWD$oJ(1G6V$}uqIKXa+fN z04#DN=VLaPo-%l{PBWZETuX6a6NNQKV#9FE1 z(}B{XM5t25hBqbqzLDeZ7PFCkYVyv2Ck+Lq>ez#v<{=6!gAZHGnAby&9QaJ)bT!tz zD-#s*-lo=m^W=v?H~cBYK93B{(~9oeTxY@#url0oogB^3-!gF3-k$dj>{(LSALcPm ze{8G}GR2ntc5NuHVN{;|U!``ei|kpT?3Lp~cyYkbzG_#aOp@634o0#T@?^vSgi0%~%f3I^Q%J_r6$Gf`&k(ubM zO?Q?g{{L`9w^y3&o{SE_@?)_>^i56@Ys9ObYtz^SL>a`|xw;^d>q_0}pTfDk&4DBL zZ&SyG#~?Nx(%7LL#SCN7sAHpKttsVV#!!L+;Y@$`L;e1<%l{Xd-W4suPDQ$K(V?g)sKuZxTZ3!@CQ z8vh>G$&)UR6vi8GZl}Yis^WsZKB>}YSn!tE+L10S#|xmjUmS1Uk%IA>tFdOa|8N*E zFTnOqv#i-?o7eFtToL7OBmmk>YX$e&VG8GV^NZAz37mvJ0^e zz>HyJ{({w#!fV?m+X!uK!-rg!m)2~RMl14bLZ+diE#ylii238hJEdh+gsl9P2UgXk z(^p10Dasd2_b;}|@*@2{sVgn*U0_m_-?oqQ{5D-NP5Y+$TEep0?=gOcs3vHs4BtaXTQdKwkR24SgTmqdM`3KI2P_2mmpIb1B z1F5TorN)T9h)kvmM2~h;D3_7?f>L>c0vn~je7N6={4<$A5JMkm3&Nm6Vhy{RUB(^o z=2wIr78qlv93N(azVO$fly4u17Fejx5-OReK2=49)gq{D@1FijL3jXm_+23L9eLB zx3*cYF?$Qw=kdzwby>D}mJyFd*}Tuz;E?(W^h=fM^76)S!D9E48k$msX^LeIEvu;m zv}f&`sj`2XIqUss%CTIl@WZb!%?YwE`YdW2U?47h!L7MQsEx!;hNN>QjkQG2?mI_j}G>H!DJ1U>U@4GE3#~DcccMbD>f* z%3YMb3m^S&9?1isJ$zOMaZ=tKsZGo|Zg|Q7D{1b{a8deyi%sunmbk^a-Idc zT0ZLk)U6Ad9<0**6%LW0xaAN^Xbp{PiNtTu58uX)qI#M%?ti@z&)p zD+cfU4QFzQ(SJC$syAUri8nyL>3fiq{pg`6iC~lTGcGF*S#|2UKGZL1?_q_Cfagsw zD_bq7&=C(%5HXr(!%764SmWoqnk6eg_dIWKHcQ6lPDNS%Dmc4^Ig?6Z+u@cuEyTmk z?|j6&D&RX2z3MamNKWzo9LdJllRHh6jJqaZZ*C0+AdLdON$WN1{dho9Bcq|p1^$#q zc^iUI z)=9v>o6ry#8x5%G$ddu#KZSE7EU$5Cx zsQ=&x9oxNDAG|3#O=QnB3*8{f_kO8G!~_}VdGWEyD6YcIDB3x={`NC+8bb^z0Xw0i zkr#>&x$=&n#hm|F9rw;j6QxHPOKDg0=9H>&f|{yY%uc^|zLg~pNE6d3j4Jb4I6GM& zmC4EMJ)PEVAKHSS9K8qzeAD6st8ZwOn>Zc+PJOYJ=e#K6!FXC{U+DD3z?YJ{0ID-4*suGgd-6RERb*t8j3WELC7Mj% zvj1>CJJcTeLRE-E=T?<9c^<0{$8`R%-awL(NlWu-5$M{pL3eLg@CBX08H4~X#$fMe zWMdzF@zNo*G~kt z1klFJ{0Xl`Pe^poHe0dj_4Lk@_sOdYlLERE`H7i6Hw~W@tYr))JWrI7ZBy5T*TwzSL$5nUI(Z!HgaqD+--A%*d4#%f6n7P6f-Mt5M|x^o>31WQQG$wWzhi;(c@6h#tYd;sGj} zE1!(>B?-bo2gRp<3i2g!cETZ_j_t){{$nWLQdc`Ya0Z{U43R6?Qo-l8>-nMf~ z3W5WpWgHygz95WKHaFGJ(fUl~?S0EtjXq&?Q|zWeUm~&Ev?-Vu%LtLQmc&^&GE=~7 zl2vsg5~w7$elTajY|!dkXG=hBl#-un&wn^{auN>W(U1JB68q>e&;k1$B?hcFV;pCn zOv>O&umt@=9gbi1v$aWO9CvU6?K#fV1NOY*028B=8O7E_&<2}llwBZ!yk{*Ty~z^$ z!^4ZDLjD9DJ`JGoO8fajueRiQAb%x!sOtFxc2zBbwpI%-u|tjhSbPkw=JG0FnH|6jAF56e95w|n zBPR>SUX^O$J(5Krg5dE0nQJnPlUk}s#Xy4Z2dz^ADOAkWgLvOGnp>+b+{!;3fFA0fvxX+e}0$$DyYcyyEgaw6! zrIizq{2h@FRL(~aP#HwBnYcK8RWZ-V2k!zsw{P*cgiOIIe|Fvy%9p^7q*YLt?T6Us zqO7D@5|K9Y1`?U%C&q2Uy{Ffza+MWA)j1Qp;P|2w*z^SmLho4@7Ut)T(G4VhvIL_T zHV%d$x0QJsDlnF(kk5HbI{HDf|4aZR`|c;B1E#Ha%KbN6_7QKMY|ZS#bud(5-Z^YW zkt`AzQj~CQ(1?WQ&_L%^47VI&UgI}x;|TwF^w(+%4%})(rfmcjZ20!jsnUsQTNnc% z&BBk+dPaP~G!lxXVDh#`-J!9(Sl5t=hJVfm?54wd)P?MztV!UL{L@tUAi6=G*x`j> zS+4CBfvlAsA@f=~(?pL8x2hs@t$on;TQ6vPJe;cD*-n1JKg~}9p$KJu4On} zq&A;*94Rtz$;ZqQ{M-PYI2~yMb*7!qyftWSBld8|zWsUfzQKd|<0DqaM;5?CcZgwU)otWf96vZgp-PktXf(}G!8uQFF0I5>g0Q) z_)_-_1sY7*?2bgpq3uIuQXPd`Crm^0VEn3mvaj1K4%*#Pmp3!P-h04hHwx|AY11<;uN=o~?-8I|4jFf!m&?kSQm^L-H2M-n z!@b{asYJ^7XJB;U-}OYh-+wsEf8U?%2NC|!JP!1HXLVJKRRl%HvAJLQr*KFf<9gE($3-OJwB&KtrKHW;BT+={VZb-{*X#>+DbijW z0sk&q~xJ${+$@y~m4n$|_f@7oN%vPkWQY9V~s+34p6?zE^wHx|l!NDJsB4xOXi| z`u{gVAF%P12$y&HSrmZ$A3W+hBhwffvT4YkA-zr^`tySSOG7jNSFPlTWCd-l@$&1) z!N{%oe)3}{1`|k39>vZydz?^CyuL%> zMEpIWA2tcruZ+oQKT~+E4#(o z=SL7D_2|#2Sc8V9NoN_)t#ZJ>SWPi$+Ika)z;Mi8{y1Zms6I|Y?$*XBJ#3#z`E*jId3c3Qu&z{&bAQwI@Se-#_dFD4F;*3M92o=O$i@&LIr{-i zoW}2_7&bwn1up>PZFCh*p2msPOGEZ4YE$cHLJUs6LSgi~`qm%rzY^Z(%>`4*mV{2L z&wVizaLI5sAFRcfA=UUQR%=&^=S}^<=@;4C@d}-V6gEUcqP^)vUE~MksGX$0yUuZu zu{HJ+e@^m@qwo;4hz#bP^glkdepbn}8+Z z-aJaM*#_35u@}wxr)JXJB*%|ZFNVXx!j%xv-j5(++bV$-{)gkdzLbhJblkmI^qby@ zsQu*!?}ZTDTRBu71w~Yo?cM=xQEaj7XZHaGiF!P; zxe7GTQw=qV%6R)QV}IlNeJ2;PA#Z$l-6eInWIyGn(-kb?0(gfa#V+>t$xda4!H+7Z zLK37Qx=H>xUxn zrB0ywd5#}afc};7=rH0a5D;^*7-S78oi zc%c83OKl_MWJ$AKafq!??r^&S$zoun!V1tk5WU^9Vy zy_AIc`)3oIrp&o_Vwgz`SJu*e_nZ{x5&>{o)IOhE)~8(X(0#fJ-^UnoY=-K7DSwsM z2Z;=(`9b#O;*}}XI85s zqTvoqMoS;{)q_XuNH-YMAL;&}Ad-J0u^l+or70NXBTG&{9KQPUJi~lTV3I%?Ok}*}Uk+_%jxfstPBv3P>PL*J>hWZ_8ZrV1ACa}vUmVOEAnG)?b z6ic~KSvLK-q?>1I1(kmvfvhaDz0=$I&8^CPdYBLG`H_7CQmaRwlsbx2bRoC;`={jB z+IyG0hA4D8t&-e+$9b{NwP*m*rqe1PuudDfR|~Yt@6VSGeDO%Ft@H7$b|eQrLqjV! ze?trOrWdXigFKQ)KhMa_y6TQbxle5Ba<QPv3(-2N__DXf@>@PO~k$5Hiwb?T+#-=x>udfc;>VPqpENZnoU8D;+*vC#b_i( zWB6Jx_|(KiPR3XIE%k$zDrt!`y#4UcTwHE_w+H0}z5v+05BBDVCdM6Rh0iNe%cst&l}V z8tO<5VEkRIrpGDKe>i7xjKKuInp#opr8kww{GWnR&!|@9zW#>;b>i0q8uEfyDOV(p zYPPp-bPTcLF#Q*`@e}_|o=a{cnRBD6_#kz5UyL#+zd`R$n0wkipP^en{Fz~sdMg%? zk>j34zjiA8J%RAa0?VTW&mVUNp?wG)`kMO0rEKeE#woQ)UTwicYB%D3g6V_oy`uR` zu55cSwvI@$_#yrmHwN9}=O7n3fA{tlU^s%ZP>&I0%%*PdVd*?yce~x#x)(GeL|l$v zL6>HXRkn!9W_c1+{D$xzfUfE1m1ASbEbTe3^Aklt$C8^Y5(0QXKj{LicWTw-pMAP> zGQ9he0jKxcmTlwFJzVOf_$%hK)R|Y1La>xY=QBQ${e|=ed0)6M;Je)Hz!8KA)G^2M zM%Yvd=cVwDq^y<{GdV#c;V}#q18Q7TgEH484C{d0j>^m1JX}_uJ3iKUmh{FQN=$7& zaRos=t#3cO%8PDeEp|ja9&%v+7w<8Wm=%h@BiS`{>m}Oe_GWEc=0hv9e;~|Bswmy6 zO6aY~n3Aem980U~2N3PuB0~t9HMx1+h@`8Xp5K(gg@Tt^g$9=d-}F~9X@e$g_9Q_} zcK`P^J`^6kSe^%K%0J^b;cdx1{Z->{CK?$gR(Z*$%||?uBO68Gm4}r-HMdOUkMAtK zO7u_cl(D(++`?wmqyy~DEMAg_!Y#k^^SCA?n}re4UlP2$v(iN5g?4#8$fPi|CA)uA z2*+efpL826k-Nzr9p5o=ZmcEZxjVv%v?X0;G--Z%mem5;qVt3WX?PM_`-%5xv8$=q z;yH#EZ8;S9OC1SQulO#U_Yumh25mSM)$ z8DL&P0uy59fUHygS8*-x=r=m90NnTam;Yd$E?TRL*1gaVpQ=5u>U>5_{X=;0i?RSGk+Ktl|WS_NdKE}wr7@&4`2INOb47D}d&>DvimWvrF~Y$t4C6{r-i z(7r`rli7Rrs-BIfIy&^+N48Hh#C?yRtMfi@M0bv0P5N2VlKcO^D=tk-+nghQ_}9mL*~?|Qj$f6kvwm32B{wV zKDj7rR6k~KuxxIP>w7qB6MS&GoJRm-E+05C#Olb4jW&Ak+4{@~KCkuwbZjHH>00H? z_+&^(=pG+5iv#|$Zpel$pDsl>-Rh9MFhJtTxTC?T^_C0yKI?{W)EAUR*F?A+TdJSb zT9^Y*ge3O|OGXUKgA;0`Kbx_G8D$siW&2Hux1Qm9=szRY=Msd8&K^?q4;~NM7#6>r zUilhWrv>3rqnnw19{IoGKhroh;WnW!MZT+~z4m3?+hq%Qf>yl>`MXz(u0`a?3Tr@b zTu;Bibwl)^&$;;xNl&{h7bUv7{#B7S$kf|CFDh^QG;1IHyrJ*qNSl4;su4Wt4ke;VKx6>T&b~d zM+tgaKyxhuzX@v0I)*R>K>{HH3!$^hm&A6OQq5*Jx+IuQUa#!9-LR#Q$qo(d%ryS# zdRiwu=KWAwCz5|-^FDo}N^)F*P;R$=Gi7{kif2sgUA(v2P*fjxU5MgMBa3rBTVk8s z_ah7P*gCdpGoxi%j>LM=3G{1&-oRuBt4)h=X39yJt<5XXvXwRe%6*D&y0}eyl9H^9 z$jtw68qZFM{%Sr=>tH~ptg#Yc#wK4SJxac?Rod_%m%#YL(odFwtxm6>e{zxAc%jbG z)R`c%=WwF})Y9@R_X)7h{A0!zl?=2L6B=t_OQ(G}*-M~JSnaB!|6Zbuu(=amSU{1V zkf5f`W}oY~p;uAFMJYfbzY_ud!NKCQ*M_0o+wMti?p=N0+^s}L?A6*Bo(on-fT+bLh-!&(9(M};*hn6bfx0I+7DeM1C9_2rqpjY4c_pZ{?rH?-2FP$k7_M zqq~NM8UYpxxlf_O3yJS<LW%@pTu6-ucM+vesV} z$xGRpecb>}dw)^!HekKn>w7AT*zBNzsQROL10YJXtaZTi*Skml%a)d-8?c|N2_}TB zG52?Cx6hWo~O!eo=x26Oq-RBafi~`@u z2FyJqw;S8Rkwy2$C}^TD_kfkR)Jhx>#NON(gC>Pk7_L}*@5!ppH5I>WAHQ|qHBdcZ zx{jgjm6;cJEHvfvcmJv-2rU5YQ72ZQkAMw#((+56o8YAI*6`4urq&JX-ygdt^mnKt z2l^7J91RKu>UL5lc2Y#uo>bVhkO~grxTk1<8UWo%l+XZAg(#4nHqG<>#;y4=thP zdB}ow1}khdOz;YZy^JfbV5KVO`)h1XpT);ZnTB{f+TLKi2Vrq-z6Jd*XWnM|4+WrX zC2F8-)YioVH%V;M?)l!-+Qj>}N;#h$B(L52ny>N50_WVb5kcdPPdPKF)m`oyVQc+? z0qzN^^=vH^;|=rJ2oAosTK7P=VcPqe*RucN+|Cx|y#TFy^4)W1b%#CP##-lypB`5W zrks!KyFOMEOPBBKQ)m$p4}_kcFHISaueQppBs34Q&KGK?un!gdH+A3F)*i!_Twugb zJVDoWFW4E(RSIZq&EQ`f`ho!`VRGZ zM2aru_Q8VF&ak?iZ$FIaNY_5cH+}xG$I7{j^AvsT#Ni?^{xxTat?5}<`)UL&>IWr6 zf#=EDM-9KX#WwH@?cfP1S3&FZ?bUVZdx{WAj=87sj}UDkJ@+>>k|sreZh?C$}#l_=_T8@zKq^ z_?4%zs^W0vrCjM>j5KjY@B+)D76yk9p2mDsdW@Wp8Z-_%{d8A ze}nts^&GSGyvU-Rj;o7HhM|j1BTG7^O*IGcBfZRO$=Aw@x7#{ zEFrlCZ~z8wiHz)lMbocB&&Uq48(Qs}ZJQJpVsoz%Z~dAUaTxOh>sw6^Zb!tC+B=ZeXvv3B~^2#_KPR3>wCP1(L9faT>T|* z_U@hHwbxy|I?VX#PPZ4R-s4JpsC{%JmqDQoK07yt3bw2%4va;REnYuhBeU$foW3w= zFsk-xn)(H9TJ$nBRh;pUM;Dl>Q^T`O0@LKZ0O_940_Mvb3zW&#ubF$$9UJ)BLpmGU zsSxe?9!(b*SW;D7e0cGGX}j^w`;@vQDTHL!uCJZGr7yN^a^6hh5`j}Y>xMvIr8$9# z5nmnGPbEgmxS@LYy!Md*Pm9pZk3qjQ$^`^xIrYCi>wkm?F+MWlXNK42+OKw-POhuk zG29$*)Sr54P)nG-JFR#S@VtHH^0=oLK)#LCTg_fRFn>8omd=Y8skW7ZlcT=h`B<(A zwpU{>8bp2ORhJ^&Zl#)SLYNh7one?&z)$YYU)T`=2X~PB)heJ=dn_WM-0hkAO|ce} zC#U#r&j)b$cAgFzrB8gCAveBfY`h?$@zy2Cl&{G{A2X zOp7+om{epW$zSGFc=1YbCcqn(-XUoGUXIVNdY6di;8pgkMTX2T<)nG;=rE(5qw6W) z?aWj~&`fYm@E{ytH5OuhM&uU@oV~ZHKzB2l|A(Wc7N3~ooTMy_XEs=v)%g-AtD^7< zE)gs=Pz+{5Um!qaj`ZHU(WN4ShZeTo#Y1u@DL-xX$amQaobD^JIXSoKSd3~EE1m;A zxo1aZhP9d5mB=)hzkH#uW4zYhcJ;-cb?9S7vw@8yXF{_qzQ=z!NPVGeKBQegy-I0` z#lf8T^!|v*oLV_c#>$5(>*dUzx19u>0Kx4ox{no`ab9;=%|QC=4lS#GIeK)$axavy zy5;lB?15_uC!Ro$l9l{kPCGhKaiJGNV$(?GKb$uTt>15~U0o%Ppn17q)ZH7SLt_lA zbl*q+s?xW#mpylp_R*gUR!d4hnIz#j1GwpMa{E}$AfGF*_4ySJc!1{sO1L#&=zp`S z)?FKWWc4eeTp6CdSW##9w|<}&IUglr$dcVZEG_QuUBLf7GyBaj*}#hU4-Y~-3faIe zIr=&4X_g?BaTht0C|^LG9Z80yzA1RDQ-bA^`ocE7e97S{Q{S(C*8+s(`zn7)HutU} znS`L5sv*p)!y_sZ_Y%!=R|2y&_lsAO`<`)EU36z-;0XSdk_W9@V{f?xAWpAqm8*d0 zgOy$#KjWed&0!PX=MOQhE8t>DNlP9Q!}_VplT%jAXw1S2s~Vl2PygK?D%?p`+JAH# zmoPSqXahG*k>_R;PiMFljY4?8B{nGzGDCk=p9Qm+n=(bHyZ*{y$dqnxmW`4hZr%!s zpMmbK>@Ut@JG&HjWUL|ip?_|QUjLG_9*f+nWSe|D=6We*T)p zb6hHp6foQX*%YWt{!4qNJ)7oA>EhmG>4vkT&gce&1#F#O@=3n!)?qAnyYm?dtB=Ck zwP)PTzj58rse8Q}qEVwRF2aryJSPHbyq)|;|I#D@aZkKnQWO&`lq?(x3eR=zj;*DS0S3euvLPe`PUB8S8 zU@d)OC>S5X&=kGy9%RE;-<$uM$Y{fwOhu}OQdQ?@GjC}wHR$`-#-}eCSZSr3B)k5N zsbPIhB!d-YUj^B$kb_ldb=lGE{h;TY7R#{S;OEo3Q|nhCv~SRF;K+bW$tth5)OJL- zG)16WZcFyf1)?~?3l?R7bi}fN=cC@%8{X9v{no@H< z?P7CFfu_|q{?-eoP$6GNtKwqgOr=_>Z%$ HnIgF2c&J%QvYmp3AatJftnJ$}(tv z)Z4q2zjmUG$SpbiD$Uo zySkWKE{m`dZPZn<18WZw%Y+2fXZR3ma_l6l@8c2;a$Z(Em|!umSZu7&2toiC-P8SN zMeJ>MMxJb)ht>3`VqWn+Pej9G%Eg=@m-Y!IGo>{LD{QOH`tUd^cpiKCx2bWS zefoEwJl3qss)`9I`Q^3X#)wVSINS=)r>_{wQ!h5fn z50mUpzi{`+s9L5?9r2RM-YxxB{-R98{QU2K(`e7$^`|bEA=FiwVyRY+i~jm*$g0Jy zCxjz2dr-fM*t5mcQwE@P53^|9MHF3qYyBhgni{D5GqWGrS#~(1JBiX|Jx6exNDlw6 zOkzLT;S=ov<>}J7ryy%^F@l^F-J{gvJ%7wuvpkXW;_Q|46{!RkPwzQk`{Do?jr7q7 zOK6Y&*B4}0?&Kr92qb7F605bQ5-vYwN-VkO>00hFma8pYGuiiTY?1AQkCvFR#kZi6 zm#0JhkCaPdV|`}MW8*mpz?xLap+pKjDZ&Z4sQdV!)H`IY z;%smQv7bJ5iD6+0)uYh^i6&h2&yJJ7zxibm*&%6guDzw0MRh7fN3?!24FmSKof%?g zCi%CkTeG_n_KV6?gW7@Ce*oX9%2jhc(w{_2pF*^U3c#$$yhzIyG~|~8sVpar zHKyaT#L?fUKV-MrAOxuG=V*)}@!lH5b%Wb=VL<3EPmc9h#v2!s&4$oz8+DnzgA8$|^;IWTfQ5)!$2vH|RJd+urf&zt(xB z|7BrdwDN+2K*imx$)BAjE7!2$Gzb@I_im<*7-`VeLhvi8qq_J&vqeoY8TXCd6Gm@| z&w~g!{l6Oy=-k}-cH@$5v`yx`I~^D!37bD7TUkUa_hbXZ>qs(N>yQtP3!A>*n|}z< z4N9;i4}2kKD&Mid4<3=@NpP{~U4K?*H~DYXn!mbW+2n)%ykTRCk<7uXWU|Y5pfvKd zQj6~tD(+q5Q|V*e|J3dRH?SR?$h!q1vb75B+1u(ST^h^8XoJrrSZ8qK=CkiD?K)7Z z5&ZvPWJlVEe6HiQJygy~)bhN}RUSKCpmaqR(pv*ZFKi6|#w3`|f%>E!7J2+LW|2SE zAHkQUy(k%czp-}%{tpM+jZ+v^;?az z&K@A-Jo)jUSy-la3*QVbeF!ghxV?@PwLbx!kuNQ&D7@b~W2M3M*k%kH_+*}Zrwazo zU^wqdfMjM}zwNJ?31$oCp0aoJ+Y~}=GRUO1~ukN*wB0^}8 zvb{5JE%%TwS6sfWv=9Ms6xZr*L1wpO9;JFLiO^UNTN9qC0vi=On)9a&>rVe8@xoiz zYWt-wF3k$c+3Tme-PlVg;*xn^8t7=iyYb$51SolN>ZE#|4kYiJz=+bB5GKx}y>CesmO`+~7a|eevS##pAh-3KeUM3rWLH(Qar4PHP z^|&^{;uWmHF-poj5;j8y<>#BO;nIc4J9R6k9%>1q6uVypmvNlr-y z$e-{qxaxhRDmnH$%F~jd{_u_w27gUaE+C2Xz8ETf`M64?f>Z9>Mb)k{v+zQ{9J_KG> zN(Mev{}H|$B}&mKR55Kea@@{`LDGU~s8{Hg$0+%WpaK*@SN5LnZf^-nnS`==15?rJI=6(R*cJ zbXCrc@RG-k6;Q7yMnZi~uKNQlW2UFK;SqRiuFlCdZ%4!~-30rIWp-QpYvb8cmTtw8 zKfWOk*Dn4uE=hN^G6O2){=n|{rNLX9QjGik56{p5$mIm}GW|&DkL~Z+UNF~lF9t

w#hyEaQs>3q6qU5-T$)*me<_v~_ zQTr`dR+~iA zfCzX)C}|`~k?HPrumo7C1DP1z#$Mud0NWQ_2CN*qR&r_MNZRtXIwpzlxydTyhLGjK zihFZ~fhj$zQ)ibvvC3@m_~*uTZRZNMONY90R@_9L{i?XRAmT&%po1FCXKY6E*A3U= z48LQ`GUB_GSZ`_vswBH!Nme#%n%RRhw=9Sqjb)D;1N48|$moD!RL)i5QA1B4#pf{Y zJI~(VD<yJhq}5}!dT+^WXmV0iX;_ALO-UwA=(I=X8Gan*yi))lih#@LXj$t ztv!$^6v;}vB7r4i6A0nJp1h3Pse`4!-_uo`Nx9=CrLB1%42-JwGo^frNha{<{ogHq z-+0!KmQ_4}3ZG>owviR1$5t^kACSHqR?AG~Y74)&X8xN&(`@N@FD3nczx`QVa&LW^ z_IB<=OXWYPWxJEOK8rvm9RR9DzJc#~-6(GUz9?^}?p%O$sEHHK379xoYnC-IX{oNe z5Cv2(50AR-cYJmxMYiDx9%Y{Zo7d`%nG$aqi&P9PW5-xpf1Rv$;j($g>1Jf!%B9-t zkN29qC!b1(Zh$YX@a!o z=uQSf&@~z|v@Fs1U(fr4vJ%(S!vOMo-bxzVbQ*-=iAu0rnJV1|jweR+={Z`p&!?LA z+E}aj>IZM2DY2}Z@P%!MGm4}6;eTaac{tSD|DTwMFl`hiYLr`|WS47-nB>I9Id!&ERX`tuk{AE3MW?F_ z73xrG0OcB?#G5jPy>gn0X* zNHO6laiaTp1ANJDwS(DcuL{euTO}#R(amQc)&`;+_^Bm)57w{BcyUgk_u>hGzjXC; z-m%rodY5KKr}R#ZJt9@c9dPIGX6ZeOAVuE1%=ynt@2hh(L#tw6C@>j-`{8nYs@kgk zX}zlU(Z+%Y)~w@K`rT}&32DSIxuCfA9P`2Py)KoyJX5uZW8{rQBcuY;WJjaw)Ga@w z!MS%B>ds{gbPm|kwL0?t!h zSxwQ*QA{vDf@zX+((uqdPLB)^UH3ZCU^Z_!V@&Cse4FO6ahURa6gtB~Kb9G7CX&|+ zBk}F8@1QBBK!0pOBrYY*FwaEE^QNYVTtjT>HBJBI?7bi#YW{w8gPAMZ9r79fEnzKa zMQJ791@<-Vz-0G24fD_c$O6P8x98& zi{B;hQ|~Zwd)h05$kY6*^Bh@u7Aoe8;Mg)t>+UP_a>B@WZx9^G*%zqwxgnfZ{P^Fa z>X+<&$VrJd`ZTAVe>Sb@g+?R4pnP$1q6>Ti=i^2@YPSVEM!MWT*ZDj~dzdw#RsSI^ zz|!TnPqbX!+9mH`^5+;ar<13^RbFaTDxbz_V7!lWw3GBGq{W^Kon2~;kF8R4CcfHy z3Qyfh`g%#0_9S);JP60fN?<&M}dtUG_q&y7_8P%G?7PEJ8&n0X_O@6{k`9$^rq5F=75m%$b*coy!r1=g^ zol~pC#C|}XI9y!X`f%65h#h;i5+e`47h$G;M>?4&69;mgJr<7|nA;SnM#PT=)3Qv$ zEDo$y`Co0A>(RE4uwYNcQJFx>K~v7`XM#e^C2Mg)v}L(ZsUafpFytk@B@A zT<#B@jr-`5QL1Rqbf@LXx(|IWt&=i?p$yAIx+&BE!NY(X`!?;`Y{Dh5d+GW5Gx?y$ zSR8F~Z#8!-g~uyxyHYske`CV!>+MYM;KwbctsQb}@W<=>DC$)sW1|5a;`ey2^ z1C(DFn5*nhIki8+Y}DYr7NKGBFg{~k{99K=_1!I_uXyGsy~Z@qk)EBw{-zuXqT zST9KB^APgt=h%AA8D1L~m8#Nm)@8?P(wA^0)+^qWX=uiC_joQ(U2d$o~ z>6tdcmZ=)0^IS{|pi&!z@Z^(i-}M^}ckl4WhknU^;2(n2DfX#JxYVgY%;cA1@IRm4 zWH~r`oO{nHzLS%~4#rRI=#pAwYQq$<@%Fw-Fj-TJp{LoW?oq9|Ry~~WV;5EARKtIy z$iJKB2wW+m%1WF+!MKfw4WZdgSQ)fq-S1Vx`xW0NvLl zz~)S3z|MK}R{m_;d;aN_(IGGI?->tG zJ%Qmz>lz|LTYjX$R==qu`pedKMJEf@milPIMj5S3k54roSYI$TDlp7KS|lFIiwmqY zF(`~8xLj@$Q^F@NRuXljq;H<#^4CSx_)r6~rrq$Tw=LO+rHGm4N}}-6ss#M~?jOJ9 zA+Ox&oXqIB%wu=?CptLX9WH6t_p;TW__ErNU6_;@1%~DAX}7BhJd!(;t7O$|22c2= zDt5Hgd=cS%bKe)^=@;bdaj{XX+K0pWdf{;jTqu?;VSTr8t`U1={Nf+j?Z19&NtE}C zZqJuavTUBXdoSQcWZSd_u zh`H0fa}U(4bAvh?r>RCGk=85)@L=KrFt5r$cBt2zBTv}VsW9Xsl7$--u!CKV`iPDnEGaMK`qVWW(D8L z!_jI}%lKc%Xeb0cUH-$|i@#;;TK5YI%iw|2S$xd2<4G1H`4{oXz>@Ye)5oJ6f7!3M zouyi}3s#cy15b8OK{$C4eKBaFJ3}v7FD*>{_O8lPQMqg!JZ;&(PthQxf%V`D*E8CPI zn`C;NEFb%6^w$vK?R->k)@t^Bh0`>Z!Hh>^@7{G^GX0&+BX>0K9;^#OSeFC-{7eUw z5d2>nOX z(ls*Q5-OB+HJzqY)ovd$39F}mDN0Ylvqm{)SBAVP$V zS{8=}&FJ6>E>+RRz3afH96d?iH}HN|M~}_K`TG70mAqyE$Rd4cO@`; zU`_3f=)`4y^Q{QN3IeJy1?_4?y2kgFz%&t91`keH82$3K*7}-R$(dn&ghAPerA6pf=T@n0PUeKM-jG+AAeM)XzdF zKs9|_9B4xo0_a(zgV24*vVH~7A4p(p0d*|`Wm_i75<+;Ez&5up5Y}fA;3LvY3Iu7Y znFg>~Xt9*Jz?O%DsBSKoz`XB4a>Z|wA)CX>wp6hBKgl48#{)7a)7VA?KFH}5M@eAU zbPUkY7ZSsDEFj*uURDVyWg`W}rVF~S;UOnH?W7Ry0j<$I0L-}(ND^4r4TNA-L!e(lmgbNM zKR=y8V!0&IBY~SZ1me_I_klW9ggXsDiV&P~tBRz9e~5L!M(C|ooI}ZEfVO!k_JWgm zpUz-${rY$wWIsUNqHgZCkcQ-q1YHGxPHSw+`xDkj=@Qs^VjKqS23C$n%7PzlMHOqs z9jKK(gD7?#3BgGYnQ;Kp!^90bP%DilW`2vHEo*4N)6i%oM$K z!0~y|;Uonu_?K|19YXNmL0%q2>TU__tp5T7gr<|l=Y#R+$$k|3A7D<=3(^e@y#c&= z6OCK^Cu4aMwLaiVqw Date: Mon, 24 Jun 2019 11:56:41 -0700 Subject: [PATCH 11/76] added "setter" for xero-tenant-id" on AccountiApi for use in header --- src/main/java/com/xero/api/client/AccountingApi.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index 749bc857..ac8b8a48 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -79,28 +79,26 @@ public class AccountingApi { private String xeroTenantId; public AccountingApi() { - //this(new ApiClient()); + this(new ApiClient()); } - public AccountingApi(ApiClient apiClient, String xeroTenantId) { + public AccountingApi(ApiClient apiClient) { this.apiClient = apiClient; - this.xeroTenantId = xeroTenantId; } public ApiClient getApiClient() { return apiClient; } - public void setApiClient(ApiClient apiClient, String xeroTenantId) { + public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; - this.xeroTenantId = xeroTenantId; } public String getXeroTenantId(String xeroTenantId) { return xeroTenantId; } - public void aetXeroTenantId(String xeroTenantId) { + public void setXeroTenantId(String xeroTenantId) { this.xeroTenantId = xeroTenantId; } From 54b613691bf69447b3e0e57774d1ceb43d535882 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Wed, 26 Jun 2019 13:55:30 -0700 Subject: [PATCH 12/76] Java SDK oAuth 2.0 MVP --- pom.xml | 43 +- .../java/com/xero/api/CustomDateModule.java | 19 - src/main/java/com/xero/api/XeroApi20.java | 34 -- .../java/com/xero/api/XeroCredential.java | 454 +++++++++++++++ .../java/com/xero/api/XeroOAuthConstants.java | 36 ++ .../com/xero/api/client/AccountingApi.java | 380 +++++++++++++ .../java/com/xero/api/client/IdentityApi.java | 106 ++++ .../xero/example/AuthenticatedResource.java | 535 ++++++++++-------- .../java/com/xero/example/Authorization.java | 73 ++- src/main/java/com/xero/example/Callback.java | 140 +++-- .../com/xero/example/RefreshCredential.java | 54 ++ .../com/xero/models/identity/AccessToken.java | 190 +++++++ .../com/xero/models/identity/Connection.java | 142 +++++ .../xero/models/identity/RefreshToken.java | 165 ++++++ .../api/client/AccountingApiAccountsTest.java | 24 +- .../AccountingApiBankTransactionTest.java | 20 +- .../client/AccountingApiBankTransferTest.java | 18 +- .../client/AccountingApiBatchPaymentTest.java | 12 +- .../AccountingApiBrandingThemeTest.java | 12 +- .../client/AccountingApiContactGroupTest.java | 18 +- .../api/client/AccountingApiContactsTest.java | 20 +- .../client/AccountingApiCreditNotesTest.java | 24 +- .../client/AccountingApiEmployeesTest.java | 12 +- .../AccountingApiExpenseClaimsTest.java | 14 +- .../api/client/AccountingApiInvoicesTest.java | 23 +- .../api/client/AccountingApiItemsTest.java | 16 +- .../api/client/AccountingApiJournalsTest.java | 8 +- .../AccountingApiLinkedTransactionsTest.java | 14 +- .../AccountingApiManualJournalsTest.java | 18 +- .../AccountingApiOrganisationsTest.java | 6 +- .../client/AccountingApiOverpaymentsTest.java | 12 +- .../AccountingApiPaymentServicesTest.java | 8 +- .../api/client/AccountingApiPaymentsTest.java | 14 +- .../client/AccountingApiPrepaymentsTest.java | 12 +- .../AccountingApiPurchaseOrdersTest.java | 17 +- .../api/client/AccountingApiReceiptsTest.java | 266 +++++++++ .../AccountingApiRepeatingInvoicesTest.java | 242 ++++++++ .../api/client/AccountingApiReportsTest.java | 401 +++++++++++++ .../api/client/AccountingApiTaxRatesTest.java | 163 ++++++ .../AccountingApiTrackingCategoriesTest.java | 172 ++++++ .../api/client/AccountingApiUsersTest.java | 117 ++++ 41 files changed, 3457 insertions(+), 597 deletions(-) delete mode 100644 src/main/java/com/xero/api/CustomDateModule.java delete mode 100644 src/main/java/com/xero/api/XeroApi20.java create mode 100644 src/main/java/com/xero/api/XeroCredential.java create mode 100644 src/main/java/com/xero/api/XeroOAuthConstants.java create mode 100644 src/main/java/com/xero/api/client/IdentityApi.java create mode 100644 src/main/java/com/xero/example/RefreshCredential.java create mode 100644 src/main/java/com/xero/models/identity/AccessToken.java create mode 100644 src/main/java/com/xero/models/identity/Connection.java create mode 100644 src/main/java/com/xero/models/identity/RefreshToken.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiReportsTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java create mode 100644 src/test/java/com/xero/api/client/AccountingApiUsersTest.java diff --git a/pom.xml b/pom.xml index e1c692d8..9c7dbaeb 100644 --- a/pom.xml +++ b/pom.xml @@ -69,13 +69,7 @@ 2.8.47 test - - junit - junit - ${junit-version} - test - - + org.hamcrest @@ -178,26 +172,6 @@ - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind-version} - - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-threetenbp-version} - org.apache.oltu.oauth2 org.apache.oltu.oauth2.client @@ -299,21 +273,6 @@ - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - org.apache.maven.plugins maven-javadoc-plugin diff --git a/src/main/java/com/xero/api/CustomDateModule.java b/src/main/java/com/xero/api/CustomDateModule.java deleted file mode 100644 index 6667b225..00000000 --- a/src/main/java/com/xero/api/CustomDateModule.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.xero.api; - -import java.time.LocalDate; - -import com.fasterxml.jackson.databind.module.SimpleModule; - -public class CustomDateModule extends SimpleModule { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public CustomDateModule() { - // addDeserializer(LocalDate.class, new CustomDateDeserializer()); - } - } - - diff --git a/src/main/java/com/xero/api/XeroApi20.java b/src/main/java/com/xero/api/XeroApi20.java deleted file mode 100644 index 99609d13..00000000 --- a/src/main/java/com/xero/api/XeroApi20.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.xero.api; - -import com.github.scribejava.core.builder.api.DefaultApi20; -import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; -import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; - -public class XeroApi20 extends DefaultApi20 { - - protected XeroApi20() { - } - - private static class InstanceHolder { - private static final XeroApi20 INSTANCE = new XeroApi20(); - } - - public static XeroApi20 instance() { - return InstanceHolder.INSTANCE; - } - - @Override - public String getAccessTokenEndpoint() { - return "https://identity.xero.com/connect/token"; - } - - @Override - protected String getAuthorizationBaseUrl() { - return "https://login.xero.com/identity/connect/authorize"; - } - - @Override - public ClientAuthentication getClientAuthentication() { - return RequestBodyAuthenticationScheme.instance(); - } -} \ No newline at end of file diff --git a/src/main/java/com/xero/api/XeroCredential.java b/src/main/java/com/xero/api/XeroCredential.java new file mode 100644 index 00000000..1847f9a8 --- /dev/null +++ b/src/main/java/com/xero/api/XeroCredential.java @@ -0,0 +1,454 @@ +package com.xero.api; + + + import com.google.api.client.auth.oauth2.BearerToken; + import com.google.api.client.auth.oauth2.ClientParametersAuthentication; + import com.google.api.client.auth.oauth2.Credential; + import com.google.api.client.auth.oauth2.CredentialRefreshListener; + import com.google.api.client.auth.oauth2.DataStoreCredentialRefreshListener; + import com.google.api.client.auth.oauth2.TokenRequest; + import com.google.api.client.auth.oauth2.TokenResponse; + import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; + import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.Details; + import com.google.api.client.googleapis.auth.oauth2.OAuth2Utils; + import com.google.api.client.googleapis.util.Utils; + import com.google.api.client.http.GenericUrl; + import com.google.api.client.http.HttpExecuteInterceptor; + import com.google.api.client.http.HttpRequestInitializer; + import com.google.api.client.http.HttpTransport; + import com.google.api.client.http.HttpUnsuccessfulResponseHandler; + import com.google.api.client.json.GenericJson; + import com.google.api.client.json.JsonFactory; + import com.google.api.client.json.JsonObjectParser; + import com.google.api.client.json.webtoken.JsonWebSignature; + import com.google.api.client.json.webtoken.JsonWebToken; + import com.google.api.client.util.Beta; + import com.google.api.client.util.Clock; + import com.google.api.client.util.Joiner; + import com.google.api.client.util.PemReader; + import com.google.api.client.util.PemReader.Section; + import com.google.api.client.util.Preconditions; + import com.google.api.client.util.SecurityUtils; + import com.google.api.client.util.store.DataStoreFactory; + + import java.io.File; + import java.io.FileInputStream; + import java.io.FileReader; + import java.io.IOException; + import java.io.InputStream; + import java.io.Reader; + import java.io.StringReader; + import java.security.GeneralSecurityException; + import java.security.KeyFactory; + import java.security.NoSuchAlgorithmException; + import java.security.PrivateKey; + import java.security.spec.InvalidKeySpecException; + import java.security.spec.PKCS8EncodedKeySpec; + import java.util.Collection; + import java.util.Collections; + + /** + * Thread-safe Google-specific implementation of the OAuth 2.0 helper for accessing protected + * resources using an access token, as well as optionally refreshing the access token when it + * expires using a refresh token. + * + *

+ * There are three modes supported: access token only, refresh token flow, and service account flow + * (with or without impersonating a user). + *

+ * + *

+ * If all you have is an access token, you simply pass the {@link TokenResponse} to the credential + * using {@link Builder#setFromTokenResponse(TokenResponse)}. Google credential uses + * {@link BearerToken#authorizationHeaderAccessMethod()} as the access method. Sample usage: + *

+ * + *
+   public static GoogleCredential createCredentialWithAccessTokenOnly(TokenResponse tokenResponse) {
+     return new GoogleCredential().setFromTokenResponse(tokenResponse);
+   }
+  * 
+ * + *

+ * If you have a refresh token, it is similar to the case of access token only, but you additionally + * need to pass the credential the client secrets using + * {@link Builder#setClientSecrets(String, String)}. Google credential uses + * {@link XeroOAuthConstants#TOKEN_SERVER_URL} as the token server URL, and + * {@link ClientParametersAuthentication} with the client ID and secret as the client + * authentication. Sample usage: + *

+ * + * + *

+ * The service account + * flow is used when you want to access data owned by your client application. You download the + * private key in a {@code .p12} file from the Google APIs Console. Use + *

+ * + + *

+ * If you need to persist the access token in a data store, use {@link DataStoreFactory} and + * {@link Builder#addRefreshListener(CredentialRefreshListener)} with + * {@link DataStoreCredentialRefreshListener}. + *

+ * + *

+ * If you have a custom request initializer, request execute interceptor, or unsuccessful response + * handler, take a look at the sample usage for {@link HttpExecuteInterceptor} and + *

+ * + * @since 1.7 + * @author Yaniv Inbar + */ + public class XeroCredential extends Credential { + + public XeroCredential(AccessMethod method) { + super(method); + // TODO Auto-generated constructor stub + } + + static final String USER_FILE_TYPE = "authorized_user"; + static final String SERVICE_ACCOUNT_FILE_TYPE = "service_account"; + + + + + + /** + * {@link Beta} + * Return a credential defined by a Json file. + * + * @param credentialStream the stream with the credential definition. + * @param transport the transport for Http calls. + * @param jsonFactory the factory for Json parsing and formatting. + * @return the credential defined by the credentialStream. + * @throws IOException if the credential cannot be created from the stream. + */ + + + /** + * Service account ID (typically an e-mail address) or {@code null} if not using the service + * account flow. + */ + private String serviceAccountId; + + /** + * Service account Project ID or {@code null} if not present, either because this is not using the + * service account flow, or is using an older version of the service account configuration. + */ + private String serviceAccountProjectId; + + /** + * Collection of OAuth scopes to use with the service account flow or {@code null} if not + * using the service account flow. + */ + private Collection serviceAccountScopes; + + /** + * Private key to use with the service account flow or {@code null} if not using the service + * account flow. + */ + private PrivateKey serviceAccountPrivateKey; + + /** + * ID of private key to use with the service account flow or {@code null} if not using the + * service account flow. + */ + private String serviceAccountPrivateKeyId; + + /** + * Email address of the user the application is trying to impersonate in the service account flow + * or {@code null} for none or if not using the service account flow. + */ + private String serviceAccountUser; + + /** + * Constructor with the ability to access protected resources, but not refresh tokens. + * + *

+ * To use with the ability to refresh tokens, use {@link Builder}. + *

+ */ + public XeroCredential() { + this(new Builder()); + } + + /** + * @param builder Google credential builder + * + * @since 1.14 + */ + protected XeroCredential(Builder builder) { + super(builder); + if (builder.serviceAccountPrivateKey == null) { + Preconditions.checkArgument(builder.serviceAccountId == null + && builder.serviceAccountScopes == null && builder.serviceAccountUser == null); + } else { + serviceAccountId = Preconditions.checkNotNull(builder.serviceAccountId); + serviceAccountProjectId = builder.serviceAccountProjectId; + serviceAccountScopes = + (builder.serviceAccountScopes == null) + ? Collections.emptyList() + : Collections.unmodifiableCollection(builder.serviceAccountScopes); + serviceAccountPrivateKey = builder.serviceAccountPrivateKey; + serviceAccountPrivateKeyId = builder.serviceAccountPrivateKeyId; + serviceAccountUser = builder.serviceAccountUser; + } + } + + @Override + public XeroCredential setAccessToken(String accessToken) { + return (XeroCredential) super.setAccessToken(accessToken); + } + + @Override + public XeroCredential setRefreshToken(String refreshToken) { + if (refreshToken != null) { + Preconditions.checkArgument( + getJsonFactory() != null && getTransport() != null && getClientAuthentication() != null, + "Please use the Builder and call setJsonFactory, setTransport and setClientSecrets"); + } + return (XeroCredential) super.setRefreshToken(refreshToken); + } + + @Override + public XeroCredential setExpirationTimeMilliseconds(Long expirationTimeMilliseconds) { + return (XeroCredential) super.setExpirationTimeMilliseconds(expirationTimeMilliseconds); + } + + @Override + public XeroCredential setExpiresInSeconds(Long expiresIn) { + return (XeroCredential) super.setExpiresInSeconds(expiresIn); + } + + @Override + public XeroCredential setFromTokenResponse(TokenResponse tokenResponse) { + return (XeroCredential) super.setFromTokenResponse(tokenResponse); + } + + @Override + @Beta + protected TokenResponse executeRefreshToken() throws IOException { + if (serviceAccountPrivateKey == null) { + return super.executeRefreshToken(); + } + // service accounts: no refresh token; instead use private key to request new access token + JsonWebSignature.Header header = new JsonWebSignature.Header(); + header.setAlgorithm("RS256"); + header.setType("JWT"); + header.setKeyId(serviceAccountPrivateKeyId); + JsonWebToken.Payload payload = new JsonWebToken.Payload(); + long currentTime = getClock().currentTimeMillis(); + payload.setIssuer(serviceAccountId); + payload.setAudience(getTokenServerEncodedUrl()); + payload.setIssuedAtTimeSeconds(currentTime / 1000); + payload.setExpirationTimeSeconds(currentTime / 1000 + 3600); + payload.setSubject(serviceAccountUser); + payload.put("scope", Joiner.on(' ').join(serviceAccountScopes)); + try { + String assertion = JsonWebSignature.signUsingRsaSha256( + serviceAccountPrivateKey, getJsonFactory(), header, payload); + TokenRequest request = new TokenRequest( + getTransport(), getJsonFactory(), new GenericUrl(getTokenServerEncodedUrl()), + "urn:ietf:params:oauth:grant-type:jwt-bearer"); + request.put("assertion", assertion); + return request.execute(); + } catch (GeneralSecurityException exception) { + IOException e = new IOException(); + e.initCause(exception); + throw e; + } + } + + /** + * @return Returns the service account ID (typically an e-mail address) or {@code null} if not using the + * service account flow. + */ + public final String getServiceAccountId() { + return serviceAccountId; + } + + /** + * @return Returns the service account Project ID or {@code null} if not present, either because this is + * not using the service account flow, or is using an older version of the service account + * configuration. + */ + public final String getServiceAccountProjectId() { + return serviceAccountProjectId; + } + + /** + * @return Returns a collection of OAuth scopes to use with the service account flow or {@code null} + * if not using the service account flow. + */ + public final Collection getServiceAccountScopes() { + return serviceAccountScopes; + } + + /** + * @return Returns the space-separated OAuth scopes to use with the service account flow or + * {@code null} if not using the service account flow. + * + * @since 1.15 + */ + public final String getServiceAccountScopesAsString() { + return serviceAccountScopes == null ? null : Joiner.on(' ').join(serviceAccountScopes); + } + + /** + * @return Returns the private key to use with the service account flow or {@code null} if not using + * the service account flow. + */ + public final PrivateKey getServiceAccountPrivateKey() { + return serviceAccountPrivateKey; + } + + /** + * {@link Beta} + * @return Returns the ID of the private key to use with the service account flow or {@code null} if + * not using the service account flow. + */ + @Beta + public final String getServiceAccountPrivateKeyId() { + return serviceAccountPrivateKeyId; + } + + /** + * @return Returns the email address of the user the application is trying to impersonate in the service + * account flow or {@code null} for none or if not using the service account flow. + */ + public final String getServiceAccountUser() { + return serviceAccountUser; + } + + /** + * {@link Beta} + * @return Indicates whether the credential requires scopes to be specified by calling createScoped + * before use. + */ + @Beta + public boolean createScopedRequired() { + if (serviceAccountPrivateKey == null) { + return false; + } + return (serviceAccountScopes == null || serviceAccountScopes.isEmpty()); + } + + + /** + * Google credential builder. + * + *

+ * Implementation is not thread-safe. + *

+ */ + public static class Builder extends Credential.Builder { + + /** Service account ID (typically an e-mail address) or {@code null} for none. */ + String serviceAccountId; + + /** + * Collection of OAuth scopes to use with the service account flow or {@code null} for none. + */ + Collection serviceAccountScopes; + + /** Private key to use with the service account flow or {@code null} for none. */ + PrivateKey serviceAccountPrivateKey; + + /** Id of the private key to use with the service account flow or {@code null} for none. */ + String serviceAccountPrivateKeyId; + + /** Project Id associated with the Service Account */ + String serviceAccountProjectId; + + /** + * Email address of the user the application is trying to impersonate in the service account + * flow or {@code null} for none. + */ + String serviceAccountUser; + + public Builder() { + super(BearerToken.authorizationHeaderAccessMethod()); + setTokenServerEncodedUrl(XeroOAuthConstants.TOKEN_SERVER_URL); + } + + @Override + public XeroCredential build() { + return new XeroCredential(this); + } + + @Override + public Builder setTransport(HttpTransport transport) { + return (Builder) super.setTransport(transport); + } + + @Override + public Builder setJsonFactory(JsonFactory jsonFactory) { + return (Builder) super.setJsonFactory(jsonFactory); + } + + /** + * @since 1.9 + */ + @Override + public Builder setClock(Clock clock) { + return (Builder) super.setClock(clock); + } + + /** + * Sets the client identifier and secret. + * + * Overriding is only supported for the purpose of calling the super implementation and changing + * the return type, but nothing else. + * @param clientId the string that represents the API key + * @param clientSecret the string that represents the API secret + * @return an instance of XeroCredential class + */ + public Builder setClientSecrets(String clientId, String clientSecret) { + setClientAuthentication(new ClientParametersAuthentication(clientId, clientSecret)); + return this; + } + + + /** + * @return Returns a collection of OAuth scopes to use with the service account flow or {@code null} + * for none. + */ + public final Collection getServiceAccountScopes() { + return serviceAccountScopes; + } + + + + @Override + public Builder setRequestInitializer(HttpRequestInitializer requestInitializer) { + return (Builder) super.setRequestInitializer(requestInitializer); + } + + @Override + public Builder addRefreshListener(CredentialRefreshListener refreshListener) { + return (Builder) super.addRefreshListener(refreshListener); + } + + @Override + public Builder setRefreshListeners(Collection refreshListeners) { + return (Builder) super.setRefreshListeners(refreshListeners); + } + + @Override + public Builder setTokenServerUrl(GenericUrl tokenServerUrl) { + return (Builder) super.setTokenServerUrl(tokenServerUrl); + } + + @Override + public Builder setTokenServerEncodedUrl(String tokenServerEncodedUrl) { + return (Builder) super.setTokenServerEncodedUrl(tokenServerEncodedUrl); + } + + @Override + public Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication) { + return (Builder) super.setClientAuthentication(clientAuthentication); + } + } + + } diff --git a/src/main/java/com/xero/api/XeroOAuthConstants.java b/src/main/java/com/xero/api/XeroOAuthConstants.java new file mode 100644 index 00000000..9a1c6e76 --- /dev/null +++ b/src/main/java/com/xero/api/XeroOAuthConstants.java @@ -0,0 +1,36 @@ +package com.xero.api; + +/* + * Copyright (c) 2011 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import com.google.api.client.util.Beta; + +/** + * Constants for Google's OAuth 2.0 implementation. + * + * @since 1.7 + * @author Yaniv Inbar + */ +public class XeroOAuthConstants { + + /** Encoded URL of Google's end-user authorization server. */ + public static final String AUTHORIZATION_SERVER_URL = "https://accounts.google.com/o/oauth2/auth"; + + /** Encoded URL of Google's token server. */ + public static final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; + + + private XeroOAuthConstants() { + } +} diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index ac8b8a48..d9d9cc93 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -141,6 +141,8 @@ public HttpResponse createAccountForHttpResponse( Account account) throws IOExce return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create Attachment on Account *

200 - Success - return response of type Attachments array of Attachment @@ -196,6 +198,8 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( UUID accou return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create a spend or receive money transaction *

200 - Success - return response of type BankTransactions array with new BankTransaction @@ -247,6 +251,8 @@ public HttpResponse createBankTransactionForHttpResponse( BankTransactions bankT return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to createa an Attachment on BankTransaction by Filename *

200 - Success - return response of Attachments array of Attachment @@ -302,6 +308,8 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( UU return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create history record for a bank transactions *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord @@ -350,6 +358,8 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse( UUID bank return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create a bank transfers *

200 - Success - return response of BankTransfers array of one BankTransfer @@ -389,6 +399,8 @@ public HttpResponse createBankTransferForHttpResponse( BankTransfers bankTransfe return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer *

400 - A failed request due to validation error @@ -443,6 +455,8 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( UUID return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** *

200 - Success - return response HistoryRecords array with the newly created HistoryRecord for a Bank Transfer *

400 - A failed request due to validation error @@ -490,6 +504,8 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse( UUID bankTra return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Create one or many BatchPayments for invoices *

200 - Success - return response of type BatchPayments array of BatchPayment objects @@ -529,6 +545,8 @@ public HttpResponse createBatchPaymentForHttpResponse( BatchPayments batchPaymen return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create a history record for a Batch Payment *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects @@ -577,6 +595,8 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( UUID batchPa return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allow for the creation of new custom payment service for specified Branding Theme *

200 - Success - return response of type PaymentServices array with newly created PaymentService @@ -625,6 +645,8 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse( UUID bran return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** *

200 - Success - return response of type Contacts array with newly created Contact *

400 - Validation Error - some data was incorrect returns response of type Error @@ -663,6 +685,8 @@ public HttpResponse createContactForHttpResponse( Contact contact) throws IOExce return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** *

200 - Success - return response of type Attachments array with an newly created Attachment *

400 - A failed request due to validation error @@ -717,6 +741,8 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( UUID conta return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create a contact group *

200 - Success - return response of type Contact Groups array of newly created Contact Group @@ -756,6 +782,8 @@ public HttpResponse createContactGroupForHttpResponse( ContactGroups contactGrou return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to add Contacts to a Contract Group *

200 - Success - return response of type Contacts array of added Contacts @@ -804,6 +832,8 @@ public HttpResponse createContactGroupContactsForHttpResponse( UUID contactGroup return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a history records of an Contact *

200 - Success - return response of type History Records array of newly created History Record for a specific Contact @@ -852,6 +882,8 @@ public HttpResponse createContactHistoryForHttpResponse( UUID contactID, Histor return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create a credit note *

200 - Success - return response of type Credit Notes array of newly created CreditNote @@ -903,6 +935,8 @@ public HttpResponse createCreditNoteForHttpResponse( CreditNotes creditNotes, B return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create Allocation on CreditNote *

200 - Success - return response of type Allocations array with newly created Allocation for specific Credit Note @@ -951,6 +985,8 @@ public HttpResponse createCreditNoteAllocationForHttpResponse( UUID creditNoteID return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create Attachments on CreditNote by file name *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note @@ -1006,6 +1042,8 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( UUID cr return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a history records of an CreditNote *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Credit Note @@ -1054,6 +1092,8 @@ public HttpResponse createCreditNoteHistoryForHttpResponse( UUID creditNoteID, return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency * @param currencies The currencies parameter @@ -1091,6 +1131,8 @@ public HttpResponse createCurrencyForHttpResponse( Currencies currencies) throws return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create new employees used in Xero payrun *

200 - Success - return response of type Employees array with new Employee @@ -1130,6 +1172,8 @@ public HttpResponse createEmployeeForHttpResponse( Employees employees) throws I return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve expense claims *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim @@ -1181,6 +1225,8 @@ public HttpResponse createExpenseClaimForHttpResponse( ExpenseClaims expenseClai return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create a history records of an ExpenseClaim *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims @@ -1228,6 +1274,8 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse( UUID expenseClaimI return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create any sales invoices or purchase bills *

200 - Success - return response of type Invoices array with newly created Invoice @@ -1279,6 +1327,8 @@ public HttpResponse createInvoiceForHttpResponse( Invoices invoices, Boolean su return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create an Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of type Attachments array with newly created Attachment @@ -1334,6 +1384,8 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( UUID invoi return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a history records of an invoice *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Invoice @@ -1382,6 +1434,8 @@ public HttpResponse createInvoiceHistoryForHttpResponse( UUID invoiceID, Histor return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create an item *

200 - Success - return response of type Items array with newly created Item @@ -1421,6 +1475,8 @@ public HttpResponse createItemForHttpResponse( Items items) throws IOException { return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create a history record for items *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items @@ -1468,6 +1524,8 @@ public HttpResponse createItemHistoryForHttpResponse( UUID itemID, HistoryRecor return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction @@ -1507,6 +1565,8 @@ public HttpResponse createLinkedTransactionForHttpResponse( LinkedTransactions l return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create a manual journal *

200 - Success - return response of type ManualJournals array with newly created ManualJournal @@ -1546,6 +1606,8 @@ public HttpResponse createManualJournalForHttpResponse( ManualJournals manualJou return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create a specified Attachment on ManualJournal by file name *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals @@ -1601,6 +1663,8 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( UUID return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Allocations for overpayments *

200 - Success - return response of type Allocations array with all Allocation for Overpayments @@ -1649,6 +1713,8 @@ public HttpResponse createOverpaymentAllocationForHttpResponse( UUID overpayment return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create history records of an Overpayment *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Overpayments @@ -1697,6 +1763,8 @@ public HttpResponse createOverpaymentHistoryForHttpResponse( UUID overpaymentID, return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create payments for invoices and credit notes *

200 - Success - return response of type Payments array for newly created Payment @@ -1736,6 +1804,8 @@ public HttpResponse createPaymentForHttpResponse( Payments payments) throws IOEx return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create a history record for a payment *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments @@ -1784,6 +1854,8 @@ public HttpResponse createPaymentHistoryForHttpResponse( UUID paymentID, Histor return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create payment services *

200 - Success - return response of type PaymentServices array for newly created PaymentService @@ -1823,6 +1895,8 @@ public HttpResponse createPaymentServiceForHttpResponse( PaymentServices payment return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create an Allocation for prepayments *

200 - Success - return response of type Allocations array of Allocation for all Prepayment @@ -1871,6 +1945,8 @@ public HttpResponse createPrepaymentAllocationForHttpResponse( UUID prepaymentID return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create a history record for an Prepayment *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PrePayment @@ -1919,6 +1995,8 @@ public HttpResponse createPrepaymentHistoryForHttpResponse( UUID prepaymentID, return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create purchase orders *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder @@ -1970,6 +2048,8 @@ public HttpResponse createPurchaseOrderForHttpResponse( PurchaseOrders purchaseO return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create HistoryRecord for purchase orders *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PurchaseOrder @@ -2018,6 +2098,8 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse( UUID purchaseOrde return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create draft expense claim receipts for any user *

200 - Success - return response of type Receipts array for newly created Receipt @@ -2057,6 +2139,8 @@ public HttpResponse createReceiptForHttpResponse( Receipts receipts) throws IOEx return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create Attachment on expense claim receipts by file name *

200 - Success - return response of type Attachments array with newly created Attachment for a specified Receipt @@ -2112,6 +2196,8 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( UUID recei return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a history records of an Receipt *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts @@ -2160,6 +2246,8 @@ public HttpResponse createReceiptHistoryForHttpResponse( UUID receiptID, Histor return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create attachment on repeating invoices by file name *

200 - Success - return response of type Attachments array with updated Attachment for a specified Repeating Invoice @@ -2215,6 +2303,8 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( U return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create history for a repeating invoice *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice @@ -2263,6 +2353,8 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( UUID repeating return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create Tax Rates *

200 - Success - return response of type TaxRates array newly created TaxRate @@ -2302,6 +2394,8 @@ public HttpResponse createTaxRateForHttpResponse( TaxRates taxRates) throws IOEx return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create tracking categories *

200 - Success - return response of type TrackingCategories array of newly created TrackingCategory @@ -2341,6 +2435,8 @@ public HttpResponse createTrackingCategoryForHttpResponse( TrackingCategory trac return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to create options for a specified tracking category *

200 - Success - return response of type TrackingOptions array of options for a specified category @@ -2389,6 +2485,8 @@ public HttpResponse createTrackingOptionsForHttpResponse( UUID trackingCategoryI return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to delete a chart of accounts *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account @@ -2431,6 +2529,8 @@ public HttpResponse deleteAccountForHttpResponse( UUID accountID) throws IOExcep return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to delete a specific Contact from a Contract Group *

204 - Success - return response 204 no content @@ -2475,6 +2575,8 @@ public HttpResponse deleteContactGroupContactForHttpResponse( UUID contactGroupI return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to delete all Contacts from a Contract Group *

200 - Success - return response 204 no content @@ -2513,6 +2615,8 @@ public HttpResponse deleteContactGroupContactsForHttpResponse( UUID contactGroup return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to delete a specified item *

204 - Success - return response 204 no content @@ -2552,6 +2656,8 @@ public HttpResponse deleteItemForHttpResponse( UUID itemID) throws IOException { return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to delete a specified linked transactions (billable expenses) *

204 - Success - return response 204 no content @@ -2591,6 +2697,8 @@ public HttpResponse deleteLinkedTransactionForHttpResponse( UUID linkedTransacti return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update a specified payment for invoices and credit notes *

200 - Success - return response of type Payments array for updated Payment @@ -2639,6 +2747,8 @@ public HttpResponse deletePaymentForHttpResponse( UUID paymentID, Payments paym return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to delete tracking categories *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory @@ -2681,6 +2791,8 @@ public HttpResponse deleteTrackingCategoryForHttpResponse( UUID trackingCategory return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to delete a specified option for a specified tracking category *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category @@ -2728,6 +2840,8 @@ public HttpResponse deleteTrackingOptionsForHttpResponse( UUID trackingCategoryI return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to email a copy of invoice to related Contact *

204 - Success - return response 204 no content @@ -2773,6 +2887,8 @@ public HttpResponse emailInvoiceForHttpResponse( UUID invoiceID, RequestEmpty r return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a single chart of accounts *

200 - Success - return response of type Accounts array with one Account @@ -2814,6 +2930,8 @@ public HttpResponse getAccountForHttpResponse( UUID accountID) throws IOExceptio return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachment on Account by Filename *

200 - Success - return response of attachment for Account as binary data @@ -2872,6 +2990,8 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse( UUID accountI return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve specific Attachment on Account *

200 - Success - return response of attachment for Account as binary data @@ -2930,6 +3050,8 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse( UUID accountID, UU return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments for accounts *

200 - Success - return response of type Attachments array of Attachment @@ -2971,6 +3093,8 @@ public HttpResponse getAccountAttachmentsForHttpResponse( UUID accountID) throws return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve the full chart of accounts *

200 - Success - return response of type Accounts array with 0 to n Account @@ -3027,6 +3151,8 @@ public HttpResponse getAccountsForHttpResponse( OffsetDateTime ifModifiedSince, return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a single spend or receive money transaction *

200 - Success - return response of type BankTransactions array with a specific BankTransaction @@ -3068,6 +3194,8 @@ public HttpResponse getBankTransactionForHttpResponse( UUID bankTransactionID) t return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on BankTransaction by Filename *

200 - Success - return response of attachment for BankTransaction as binary data @@ -3126,6 +3254,8 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( UUID return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on a specific BankTransaction *

200 - Success - return response of attachment for BankTransaction as binary data @@ -3184,6 +3314,8 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( UUID bankTr return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve any attachments to bank transactions *

200 - Success - return response of type Attachments array with 0 to n Attachment @@ -3225,6 +3357,8 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse( UUID bankTrans return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve any spend or receive money transactions *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction @@ -3303,6 +3437,8 @@ public HttpResponse getBankTransactionsForHttpResponse( OffsetDateTime ifModifie return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve history from a bank transactions *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord @@ -3344,6 +3480,8 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse( UUID bankTransact return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve any bank transfers *

200 - Success - return response of BankTransfers array with one BankTransfer @@ -3385,6 +3523,8 @@ public HttpResponse getBankTransferForHttpResponse( UUID bankTransferID) throws return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on BankTransfer by file name *

200 - Success - return response of binary data from the Attachment to a Bank Transfer @@ -3443,6 +3583,8 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( UUID ban return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on BankTransfer *

200 - Success - return response of binary data from the Attachment to a Bank Transfer @@ -3501,6 +3643,8 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse( UUID bankTrans return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments from bank transfers *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer @@ -3542,6 +3686,8 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse( UUID bankTransfer return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve history from a bank transfers *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer @@ -3583,6 +3729,8 @@ public HttpResponse getBankTransferHistoryForHttpResponse( UUID bankTransferID) return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve all bank transfers *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer @@ -3639,6 +3787,8 @@ public HttpResponse getBankTransfersForHttpResponse( OffsetDateTime ifModifiedSi return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve history from a Batch Payment *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects @@ -3680,6 +3830,8 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse( UUID batchPaymentID) return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Retrieve either one or many BatchPayments for invoices *

200 - Success - return response of type BatchPayments array of BatchPayment objects @@ -3736,6 +3888,8 @@ public HttpResponse getBatchPaymentsForHttpResponse( OffsetDateTime ifModifiedSi return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specific BrandingThemes *

200 - Success - return response of type BrandingThemes with one BrandingTheme @@ -3777,6 +3931,8 @@ public HttpResponse getBrandingThemeForHttpResponse( UUID brandingThemeID) throw return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve the Payment services for a Branding Theme *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService @@ -3818,6 +3974,8 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse( UUID brandin return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve all the BrandingThemes *

200 - Success - return response of type BrandingThemes @@ -3850,6 +4008,8 @@ public HttpResponse getBrandingThemesForHttpResponse() throws IOException { return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve, add and update contacts in a Xero organisation *

200 - Success - return response of type Contacts array with a unique Contact @@ -3891,6 +4051,8 @@ public HttpResponse getContactForHttpResponse( UUID contactID) throws IOExceptio return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on Contacts by file name *

200 - Success - return response of attachment for Contact as binary data @@ -3949,6 +4111,8 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse( UUID contactI return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on Contacts *

200 - Success - return response of attachment for Contact as binary data @@ -4007,6 +4171,8 @@ public HttpResponse getContactAttachmentByIdForHttpResponse( UUID contactID, UU return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve, add and update contacts in a Xero organisation *

200 - Success - return response of type Attachments array with 0 to N Attachment @@ -4048,6 +4214,8 @@ public HttpResponse getContactAttachmentsForHttpResponse( UUID contactID) throws return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve CISSettings for a contact in a Xero organisation *

200 - Success - return response of type CISSettings for a specific Contact @@ -4089,6 +4257,8 @@ public HttpResponse getContactCISSettingsForHttpResponse( UUID contactID) throws return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a unique Contract Group by ID *

200 - Success - return response of type Contact Groups array with a specific Contact Group @@ -4130,6 +4300,8 @@ public HttpResponse getContactGroupForHttpResponse( UUID contactGroupID) throws return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve the ContactID and Name of all the contacts in a contact group *

200 - Success - return response of type Contact Groups array of Contact Group @@ -4185,6 +4357,8 @@ public HttpResponse getContactGroupsForHttpResponse( String where, String order return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a history records of an Contact *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact @@ -4226,6 +4400,8 @@ public HttpResponse getContactHistoryForHttpResponse( UUID contactID) throws IOE return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve, add and update contacts in a Xero organisation *

200 - Success - return response of type Contacts array with 0 to N Contact @@ -4315,6 +4491,8 @@ public HttpResponse getContactsForHttpResponse( OffsetDateTime ifModifiedSince, return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specific credit note *

200 - Success - return response of type Credit Notes array with a unique CreditNote @@ -4356,6 +4534,8 @@ public HttpResponse getCreditNoteForHttpResponse( UUID creditNoteID) throws IOEx return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Credit Note as PDF files *

200 - Success - return response of binary data from the Attachment to a Credit Note @@ -4409,6 +4589,8 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse( UUID creditNoteID, Strin return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on CreditNote by file name *

200 - Success - return response of attachment for Credit Note as binary data @@ -4467,6 +4649,8 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( UUID credi return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on CreditNote *

200 - Success - return response of attachment for Credit Note as binary data @@ -4525,6 +4709,8 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( UUID creditNoteI return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments for credit notes *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note @@ -4566,6 +4752,8 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse( UUID creditNoteID) return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a history records of an CreditNote *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note @@ -4607,6 +4795,8 @@ public HttpResponse getCreditNoteHistoryForHttpResponse( UUID creditNoteID) thro return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve any credit notes *

200 - Success - return response of type Credit Notes array of CreditNote @@ -4674,6 +4864,8 @@ public HttpResponse getCreditNotesForHttpResponse( OffsetDateTime ifModifiedSinc return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve currencies for your organisation *

200 - Success - return response of type Currencies array with all Currencies @@ -4729,6 +4921,8 @@ public HttpResponse getCurrenciesForHttpResponse( String where, String order) t return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specific employee used in Xero payrun *

200 - Success - return response of type Employees array with specified Employee @@ -4770,6 +4964,8 @@ public HttpResponse getEmployeeForHttpResponse( UUID employeeID) throws IOExcept return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve employees used in Xero payrun *

200 - Success - return response of type Employees array with all Employee @@ -4826,6 +5022,8 @@ public HttpResponse getEmployeesForHttpResponse( OffsetDateTime ifModifiedSince, return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified expense claim *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim @@ -4867,6 +5065,8 @@ public HttpResponse getExpenseClaimForHttpResponse( UUID expenseClaimID) throws return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a history records of an ExpenseClaim *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim @@ -4908,6 +5108,8 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse( UUID expenseClaimID) return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve expense claims *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims @@ -4964,6 +5166,8 @@ public HttpResponse getExpenseClaimsForHttpResponse( OffsetDateTime ifModifiedSi return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified sales invoice or purchase bill *

200 - Success - return response of type Invoices array with specified Invoices @@ -5005,6 +5209,8 @@ public HttpResponse getInvoiceForHttpResponse( UUID invoiceID) throws IOExceptio return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve invoices or purchase bills as PDF files *

200 - Success - return response of byte array pdf version of specified Invoices @@ -5058,6 +5264,8 @@ public HttpResponse getInvoiceAsPdfForHttpResponse( UUID invoiceID, String cont return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of attachment for Invoice as binary data @@ -5116,6 +5324,8 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( UUID invoiceI return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID *

200 - Success - return response of attachment for Invoice as binary data @@ -5174,6 +5384,8 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse( UUID invoiceID, UU return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on invoices or purchase bills *

200 - Success - return response of type Attachments array of Attachments for specified Invoices @@ -5215,6 +5427,8 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse( UUID invoiceID) throws return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a history records of an invoice *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice @@ -5256,6 +5470,8 @@ public HttpResponse getInvoiceHistoryForHttpResponse( UUID invoiceID) throws IOE return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve invoice reminder settings *

200 - Success - return response of Invoice Reminders @@ -5288,6 +5504,8 @@ public HttpResponse getInvoiceRemindersForHttpResponse() throws IOException { return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve any sales invoices or purchase bills *

200 - Success - return response of type Invoices array with all Invoices @@ -5432,6 +5650,8 @@ public HttpResponse getInvoicesForHttpResponse( OffsetDateTime ifModifiedSince, return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified item *

200 - Success - return response of type Items array with specified Item @@ -5473,6 +5693,8 @@ public HttpResponse getItemForHttpResponse( UUID itemID) throws IOException { return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve history for items *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item @@ -5514,6 +5736,8 @@ public HttpResponse getItemHistoryForHttpResponse( UUID itemID) throws IOExcepti return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve any items *

200 - Success - return response of type Items array with all Item @@ -5581,6 +5805,8 @@ public HttpResponse getItemsForHttpResponse( OffsetDateTime ifModifiedSince, St return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified journals. *

200 - Success - return response of type Journals array with specified Journal @@ -5622,6 +5848,8 @@ public HttpResponse getJournalForHttpResponse( UUID journalID) throws IOExceptio return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve any journals. *

200 - Success - return response of type Journals array with all Journals @@ -5678,6 +5906,8 @@ public HttpResponse getJournalsForHttpResponse( OffsetDateTime ifModifiedSince, return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction @@ -5719,6 +5949,8 @@ public HttpResponse getLinkedTransactionForHttpResponse( UUID linkedTransactionI return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Retrieve linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction @@ -5818,6 +6050,8 @@ public HttpResponse getLinkedTransactionsForHttpResponse( Integer page, String return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified manual journals *

200 - Success - return response of type ManualJournals array with a specified ManualJournals @@ -5859,6 +6093,8 @@ public HttpResponse getManualJournalForHttpResponse( UUID manualJournalID) throw return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve specified Attachment on ManualJournal by file name *

200 - Success - return response of attachment for Manual Journal as binary data @@ -5917,6 +6153,8 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( UUID ma return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve specified Attachment on ManualJournals *

200 - Success - return response of attachment for Manual Journal as binary data @@ -5975,6 +6213,8 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse( UUID manualJo return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachment for manual journals *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals @@ -6016,6 +6256,8 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse( UUID manualJourn return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve any manual journals *

200 - Success - return response of type ManualJournals array with a all ManualJournals @@ -6083,6 +6325,8 @@ public HttpResponse getManualJournalsForHttpResponse( OffsetDateTime ifModifiedS return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a URL to an online invoice *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice @@ -6124,6 +6368,8 @@ public HttpResponse getOnlineInvoiceForHttpResponse( UUID invoiceID) throws IOEx return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. *

200 - Success - return response of type Organisation array with specified Organisation @@ -6165,6 +6411,8 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse( UUID organisation return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Organisation details *

200 - Success - return response of type Organisation array with all Organisation @@ -6197,6 +6445,8 @@ public HttpResponse getOrganisationsForHttpResponse() throws IOException { return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified overpayments *

200 - Success - return response of type Overpayments array with specified Overpayments @@ -6238,6 +6488,8 @@ public HttpResponse getOverpaymentForHttpResponse( UUID overpaymentID) throws IO return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a history records of an Overpayment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments @@ -6279,6 +6531,8 @@ public HttpResponse getOverpaymentHistoryForHttpResponse( UUID overpaymentID) th return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve overpayments *

200 - Success - return response of type Overpayments array with all Overpayments @@ -6357,6 +6611,8 @@ public HttpResponse getOverpaymentsForHttpResponse( OffsetDateTime ifModifiedSin return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified payment for invoices and credit notes *

200 - Success - return response of type Payments array for specified Payment @@ -6398,6 +6654,8 @@ public HttpResponse getPaymentForHttpResponse( UUID paymentID) throws IOExceptio return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve history records of a payment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments @@ -6439,6 +6697,8 @@ public HttpResponse getPaymentHistoryForHttpResponse( UUID paymentID) throws IOE return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve payment services *

200 - Success - return response of type PaymentServices array for all PaymentService @@ -6471,6 +6731,8 @@ public HttpResponse getPaymentServicesForHttpResponse() throws IOException { return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve payments for invoices and credit notes *

200 - Success - return response of type Payments array for all Payments @@ -6527,6 +6789,8 @@ public HttpResponse getPaymentsForHttpResponse( OffsetDateTime ifModifiedSince, return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified prepayments *

200 - Success - return response of type Prepayments array for a specified Prepayment @@ -6568,6 +6832,8 @@ public HttpResponse getPrepaymentForHttpResponse( UUID prepaymentID) throws IOEx return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a history records of an Prepayment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment @@ -6609,6 +6875,8 @@ public HttpResponse getPrepaymentHistoryForHttpResponse( UUID prepaymentID) thro return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve prepayments *

200 - Success - return response of type Prepayments array for all Prepayment @@ -6687,6 +6955,8 @@ public HttpResponse getPrepaymentsForHttpResponse( OffsetDateTime ifModifiedSinc return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified purchase orders *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder @@ -6728,6 +6998,8 @@ public HttpResponse getPurchaseOrderForHttpResponse( UUID purchaseOrderID) throw return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve history for PurchaseOrder *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder @@ -6769,6 +7041,8 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse( UUID purchaseOrderID return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve purchase orders *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder @@ -6858,6 +7132,8 @@ public HttpResponse getPurchaseOrdersForHttpResponse( OffsetDateTime ifModifiedS return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified draft expense claim receipts *

200 - Success - return response of type Receipts array for a specified Receipt @@ -6899,6 +7175,8 @@ public HttpResponse getReceiptForHttpResponse( UUID receiptID) throws IOExceptio return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on expense claim receipts by file name *

200 - Success - return response of attachment for Receipt as binary data @@ -6957,6 +7235,8 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( UUID receiptI return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on expense claim receipts by ID *

200 - Success - return response of attachment for Receipt as binary data @@ -7015,6 +7295,8 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse( UUID receiptID, UU return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments for expense claim receipts *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt @@ -7056,6 +7338,8 @@ public HttpResponse getReceiptAttachmentsForHttpResponse( UUID receiptID) throws return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a history records of an Receipt *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt @@ -7097,6 +7381,8 @@ public HttpResponse getReceiptHistoryForHttpResponse( UUID receiptID) throws IOE return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve draft expense claim receipts for any user *

200 - Success - return response of type Receipts array for all Receipt @@ -7164,6 +7450,8 @@ public HttpResponse getReceiptsForHttpResponse( OffsetDateTime ifModifiedSince, return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified repeating invoice *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice @@ -7205,6 +7493,8 @@ public HttpResponse getRepeatingInvoiceForHttpResponse( UUID repeatingInvoiceID) return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve specified attachment on repeating invoices by file name *

200 - Success - return response of attachment for Repeating Invoice as binary data @@ -7263,6 +7553,8 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( UUID return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified Attachments on repeating invoices *

200 - Success - return response of attachment for Repeating Invoice as binary data @@ -7321,6 +7613,8 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( UUID repea return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Attachments on repeating invoice *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice @@ -7362,6 +7656,8 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( UUID repeatin return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve history for a repeating invoice *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice @@ -7403,6 +7699,8 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( UUID repeatingInv return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve any repeating invoices *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice @@ -7458,6 +7756,8 @@ public HttpResponse getRepeatingInvoicesForHttpResponse( String where, String o return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve report for AgedPayablesByContact *

200 - Success - return response of type ReportWithRows @@ -7538,6 +7838,8 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse( UUID contactI return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve report for AgedReceivablesByContact *

200 - Success - return response of type ReportWithRows @@ -7618,6 +7920,8 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse( UUID conta return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve report for BAS only valid for AU orgs *

200 - Success - return response of type ReportWithRows @@ -7659,6 +7963,8 @@ public HttpResponse getReportBASorGSTForHttpResponse( String reportID) throws IO return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve report for BAS only valid for AU orgs *

200 - Success - return response of type ReportWithRows @@ -7691,6 +7997,8 @@ public HttpResponse getReportBASorGSTListForHttpResponse() throws IOException { return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve report for BalanceSheet *

200 - Success - return response of type ReportWithRows @@ -7801,6 +8109,8 @@ public HttpResponse getReportBalanceSheetForHttpResponse( String date, Integer return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve report for BankSummary *

200 - Success - return response of type ReportWithRows @@ -7867,6 +8177,8 @@ public HttpResponse getReportBankSummaryForHttpResponse( LocalDate date, Intege return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve report for Budget Summary *

200 - success- return a Report with Rows object @@ -7933,6 +8245,8 @@ public HttpResponse getReportBudgetSummaryForHttpResponse( LocalDate date, Inte return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve report for ExecutiveSummary *

200 - Success - return response of type ReportWithRows @@ -7977,6 +8291,8 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse( LocalDate date) th return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve report for ProfitAndLoss *

200 - Success - return response of type ReportWithRows @@ -8120,6 +8436,8 @@ public HttpResponse getReportProfitAndLossForHttpResponse( LocalDate fromDate, return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve report for TenNinetyNine *

200 - Success - return response of type Reports @@ -8164,6 +8482,8 @@ public HttpResponse getReportTenNinetyNineForHttpResponse( String reportYear) th return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve report for TrialBalance *

200 - Success - return response of type ReportWithRows @@ -8219,6 +8539,8 @@ public HttpResponse getReportTrialBalanceForHttpResponse( LocalDate date, Boole return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve Tax Rates *

200 - Success - return response of type TaxRates array with TaxRates @@ -8285,6 +8607,8 @@ public HttpResponse getTaxRatesForHttpResponse( String where, String order, St return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve tracking categories and options *

200 - Success - return response of type TrackingCategories array of TrackingCategory @@ -8351,6 +8675,8 @@ public HttpResponse getTrackingCategoriesForHttpResponse( String where, String return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve tracking categories and options for specified category *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory @@ -8392,6 +8718,8 @@ public HttpResponse getTrackingCategoryForHttpResponse( UUID trackingCategoryID) return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified user *

200 - Success - return response of type Users array of specified User @@ -8433,6 +8761,8 @@ public HttpResponse getUserForHttpResponse( UUID userID) throws IOException { return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve users *

200 - Success - return response of type Users array of all User @@ -8489,6 +8819,8 @@ public HttpResponse getUsersForHttpResponse( OffsetDateTime ifModifiedSince, St return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update a chart of accounts *

200 - Success - update existing Account and return response of type Accounts array with updated Account @@ -8537,6 +8869,8 @@ public HttpResponse updateAccountForHttpResponse( UUID accountID, Accounts acco return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update Attachment on Account by Filename *

200 - Success - return response of type Attachments array of Attachment @@ -8592,6 +8926,8 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( UUID accou return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update a single spend or receive money transaction *

200 - Success - return response of type BankTransactions array with updated BankTransaction @@ -8640,6 +8976,8 @@ public HttpResponse updateBankTransactionForHttpResponse( UUID bankTransactionID return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update an Attachment on BankTransaction by Filename *

200 - Success - return response of Attachments array of Attachment @@ -8695,6 +9033,8 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( UU return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer *

400 - A failed request due to validation error @@ -8749,6 +9089,8 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( UUID return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** *

200 - Success - return response of type Contacts array with an updated Contact *

400 - A failed request due to validation error @@ -8796,6 +9138,8 @@ public HttpResponse updateContactForHttpResponse( UUID contactID, Contacts cont return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** *

200 - Success - return response of type Attachments array with an updated Attachment *

400 - A failed request due to validation error @@ -8850,6 +9194,8 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( UUID conta return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update a Contract Group *

200 - Success - return response of type Contact Groups array of updated Contact Group @@ -8898,6 +9244,8 @@ public HttpResponse updateContactGroupForHttpResponse( UUID contactGroupID, Con return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update a specific credit note *

200 - Success - return response of type Credit Notes array with updated CreditNote @@ -8946,6 +9294,8 @@ public HttpResponse updateCreditNoteForHttpResponse( UUID creditNoteID, CreditN return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update Attachments on CreditNote by file name *

200 - Success - return response of type Attachments array with updated Attachment for specific Credit Note @@ -9001,6 +9351,8 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( UUID cr return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update a specific employee used in Xero payrun *

200 - Success - return response of type Employees array with updated Employee @@ -9049,6 +9401,8 @@ public HttpResponse updateEmployeeForHttpResponse( UUID employeeID, Employees e return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update specified expense claims *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim @@ -9097,6 +9451,8 @@ public HttpResponse updateExpenseClaimForHttpResponse( UUID expenseClaimID, Exp return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update a specified sales invoices or purchase bills *

200 - Success - return response of type Invoices array with updated Invoice @@ -9145,6 +9501,8 @@ public HttpResponse updateInvoiceForHttpResponse( UUID invoiceID, Invoices invo return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of type Attachments array with updated Attachment @@ -9200,6 +9558,8 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( UUID invoi return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to udpate a specified item *

200 - Success - return response of type Items array with updated Item @@ -9248,6 +9608,8 @@ public HttpResponse updateItemForHttpResponse( UUID itemID, Items items) throws return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update a specified linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with updated LinkedTransaction @@ -9296,6 +9658,8 @@ public HttpResponse updateLinkedTransactionForHttpResponse( UUID linkedTransacti return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update a specified manual journal *

200 - Success - return response of type ManualJournals array with an updated ManualJournal @@ -9344,6 +9708,8 @@ public HttpResponse updateManualJournalForHttpResponse( UUID manualJournalID, M return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update a specified Attachment on ManualJournal by file name *

200 - Success - return response of type Attachments array with an update Attachment for a ManualJournals @@ -9399,6 +9765,8 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( UUID return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update a specified purchase order *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder @@ -9447,6 +9815,8 @@ public HttpResponse updatePurchaseOrderForHttpResponse( UUID purchaseOrderID, P return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to retrieve a specified draft expense claim receipts *

200 - Success - return response of type Receipts array for updated Receipt @@ -9495,6 +9865,8 @@ public HttpResponse updateReceiptForHttpResponse( UUID receiptID, Receipts rece return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update Attachment on expense claim receipts by file name *

200 - Success - return response of type Attachments array with updated Attachment for a specified Receipt @@ -9550,6 +9922,8 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( UUID recei return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update specified attachment on repeating invoices by file name *

200 - Success - return response of type Attachments array with specified Attachment for a specified Repeating Invoice @@ -9605,6 +9979,8 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( U return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update Tax Rates *

200 - Success - return response of type TaxRates array updated TaxRate @@ -9644,6 +10020,8 @@ public HttpResponse updateTaxRateForHttpResponse( TaxRates taxRates) throws IOEx return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + /** * Allows you to update tracking categories *

200 - Success - return response of type TrackingCategories array of updated TrackingCategory @@ -9692,6 +10070,8 @@ public HttpResponse updateTrackingCategoryForHttpResponse( UUID trackingCategory return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + + public ByteArrayInputStream convertInputToByteArray(InputStream is) throws IOException { byte[] bytes = IOUtils.toByteArray(is); diff --git a/src/main/java/com/xero/api/client/IdentityApi.java b/src/main/java/com/xero/api/client/IdentityApi.java new file mode 100644 index 00000000..639bfecd --- /dev/null +++ b/src/main/java/com/xero/api/client/IdentityApi.java @@ -0,0 +1,106 @@ +package com.xero.api.client; + +import com.xero.api.ApiClient; + +import com.xero.models.identity.Connection; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.GenericUrl; +import com.google.api.client.http.HttpContent; +import com.google.api.client.http.HttpMethods; +import com.google.api.client.http.HttpHeaders; +import com.google.api.client.http.HttpResponse; +import com.google.api.client.http.FileContent; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.io.ByteArrayInputStream; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; + +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + + +public class IdentityApi { + private ApiClient apiClient; + private String xeroTenantId; + + public IdentityApi() { + this(new ApiClient()); + } + + public IdentityApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public String getXeroTenantId(String xeroTenantId) { + return xeroTenantId; + } + + public void setXeroTenantId(String xeroTenantId) { + this.xeroTenantId = xeroTenantId; + } + + /** + * Allows you to retrieve the connections for this users + * Override the base server url that include version + *

200 - Success - return response of type Connections array with 0 to n Connection + * @return List<Connection> + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public List getConnections() throws IOException { + HttpResponse response = getConnectionsForHttpResponse(); + TypeReference typeRef = new TypeReference>() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getConnectionsForHttpResponse() throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + String correctPath = "/connections"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + + 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(); + } + + } +} diff --git a/src/main/java/com/xero/example/AuthenticatedResource.java b/src/main/java/com/xero/example/AuthenticatedResource.java index 93d8314e..0d02a1a5 100755 --- a/src/main/java/com/xero/example/AuthenticatedResource.java +++ b/src/main/java/com/xero/example/AuthenticatedResource.java @@ -25,8 +25,17 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.google.api.client.auth.oauth2.AuthorizationCodeFlow; import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.ClientCredentialsTokenRequest; +import com.google.api.client.auth.oauth2.ClientParametersAuthentication; import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.auth.oauth2.CredentialRefreshListener; +import com.google.api.client.auth.oauth2.DataStoreCredentialRefreshListener; +import com.google.api.client.auth.oauth2.TokenErrorResponse; +import com.google.api.client.auth.oauth2.TokenResponse; +import com.google.api.client.auth.oauth2.TokenResponseException; +import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.googleapis.util.Utils; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpHeaders; @@ -36,6 +45,10 @@ import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.json.JsonFactory; +import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.util.store.DataStoreFactory; +import com.google.api.client.util.store.MemoryDataStoreFactory; import com.xero.api.*; import com.xero.models.accounting.*; import com.xero.models.accounting.Phone.PhoneTypeEnum; @@ -166,20 +179,49 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) // Set Access Token from Storage TokenStorage store = new TokenStorage(); - String accessToken = store.get(request, "access_token"); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + final String clientId = "CEC496D0B24D4448A8F1D8B6A3F5C00E"; + final String clientSecret = "RyndE0-u_Drvu-jIwBNO4Hcsug-kCcQQgUQOB4AHTHpHl2z9"; + + //HttpTransport httpTransport = new NetHttpTransport(); + //JsonFactory jsonFactory = new JacksonFactory(); + final HttpServletResponse resp = response; + Credential credential = com.xero.example.RefreshCredential.createRefreshCredential(resp, clientId, clientSecret).build(); + /* + Credential credential = new XeroCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory) + .setClientSecrets(clientId, clientSecret) + .addRefreshListener(new CredentialRefreshListener() { + + @Override + public void onTokenResponse(Credential credential, TokenResponse tokenResponse) throws IOException { + TokenStorage store = new TokenStorage(); + store.saveItem(resp, "access_token", tokenResponse.getAccessToken()); + store.saveItem(resp, "refresh_token", tokenResponse.getRefreshToken()); + store.saveItem(resp, "expires_in_seconds", tokenResponse.getExpiresInSeconds().toString()); + } + + @Override + public void onTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse) + throws IOException { + System.out.println("Error Response"); + } + }).build(); + */ + + credential.setAccessToken(store.get(request, "access_token")); + credential.setRefreshToken(store.get(request, "refresh_token")); + credential.setExpiresInSeconds( Long.parseLong(store.get(request, "expires_in_seconds"))); + // Create requestFactory with credentials HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - + + String xeroTenantId = store.get(request, "xero_tenant_id");; + // Init AccountingApi client ApiClient defaultClient = new ApiClient(null,null,null,null,requestFactory); AccountingApi accountingApi = new AccountingApi(defaultClient); - - // Static Xero Tenant ID - // TODO: getConnections - String xeroTenantId = "--You-need-to-get-from-connections-endpoint--"; + accountingApi.setXeroTenantId(xeroTenantId); if (object.equals("Files")) { // FILES @@ -188,11 +230,11 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) // ACCOUNTS try { // GET all accounts - Accounts accounts = accountingApi.getAccounts(xeroTenantId, null, null, null); + Accounts accounts = accountingApi.getAccounts(null, null, null); messages.add("Get a all Accounts - total : " + accounts.getAccounts().size()); // GET one account - Accounts oneAccount = accountingApi.getAccount(xeroTenantId, accounts.getAccounts().get(0).getAccountID()); + Accounts oneAccount = accountingApi.getAccount(accounts.getAccounts().get(0).getAccountID()); messages.add("Get a one Account - name : " + oneAccount.getAccounts().get(0).getName()); // CREATE account @@ -201,7 +243,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) acct.setCode("Hello" + loadRandomNum()); acct.setDescription("Foo boo"); acct.setType(com.xero.models.accounting.AccountType.EXPENSE); - Accounts newAccount = accountingApi.createAccount(xeroTenantId,acct); + Accounts newAccount = accountingApi.createAccount(acct); messages.add("Create a new Account - Name : " + newAccount.getAccounts().get(0).getName() + " Description : " + newAccount.getAccounts().get(0).getDescription() + ""); UUID accountID = newAccount.getAccounts().get(0).getAccountID(); @@ -211,18 +253,18 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) bankAcct.setCode("12" + loadRandomNum()); bankAcct.setType(com.xero.models.accounting.AccountType.BANK); bankAcct.setBankAccountNumber("1234" + loadRandomNum()); - Accounts newBankAccount = accountingApi.createAccount(xeroTenantId, bankAcct); + Accounts newBankAccount = accountingApi.createAccount(bankAcct); messages.add("Create Bank Account - Name : " + newBankAccount.getAccounts().get(0).getName()); // GET BANK account where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId,ifModifiedSince, where, order); + Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); messages.add("Get a all Accounts - total : " + accountsWhere.getAccounts().size()); // UDPATE Account newAccount.getAccounts().get(0).setDescription("Monsters Inc."); newAccount.getAccounts().get(0).setStatus(null); - Accounts updateAccount = accountingApi.updateAccount(xeroTenantId,accountID, newAccount); + Accounts updateAccount = accountingApi.updateAccount(accountID, newAccount); messages.add("Update Account - Name : " + updateAccount.getAccounts().get(0).getName() + " Description : " + updateAccount.getAccounts().get(0).getDescription() + ""); // ARCHIVE Account @@ -231,12 +273,12 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) archiveAccount.setStatus(com.xero.models.accounting.Account.StatusEnum.ARCHIVED); archiveAccount.setAccountID(accountID); archiveAccounts.addAccountsItem(archiveAccount); - Accounts achivedAccount = accountingApi.updateAccount(xeroTenantId, accountID, archiveAccounts); + Accounts achivedAccount = accountingApi.updateAccount(accountID, archiveAccounts); messages.add("Archived Account - Name : " + achivedAccount.getAccounts().get(0).getName() + " Status: " + achivedAccount.getAccounts().get(0).getStatus()); // DELETE Account UUID deleteAccountID = newAccount.getAccounts().get(0).getAccountID(); - Accounts deleteAccount = accountingApi.deleteAccount(xeroTenantId, deleteAccountID); + Accounts deleteAccount = accountingApi.deleteAccount(deleteAccountID); messages.add("Delete account - Status? : " + deleteAccount.getAccounts().get(0).getStatus()); } catch (Exception e) { @@ -249,14 +291,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // GET Account Attachment where = "Status==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); if (accounts.getAccounts().size() > 0) { UUID accountID = accounts.getAccounts().get(0).getAccountID(); - Attachments accountsAttachments = accountingApi.getAccountAttachments(xeroTenantId, accountID); + Attachments accountsAttachments = accountingApi.getAccountAttachments(accountID); if (accountsAttachments.getAttachments().size() > 0) { UUID attachementId = accountsAttachments.getAttachments().get(0).getAttachmentID(); String contentType = accountsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream input = accountingApi.getAccountAttachmentById(xeroTenantId, accountID,attachementId, contentType); + ByteArrayInputStream input = accountingApi.getAccountAttachmentById(accountID,attachementId, contentType); String fileName = "Account_" + accountsAttachments.getAttachments().get(0).getFileName(); String saveFilePath = saveFile(input,fileName); messages.add("Get Account attachment - save it here: " + saveFilePath); @@ -265,14 +307,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) // GET BankTransactions Attachment where = null; - BankTransactions bankTransactions = accountingApi.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, null, null); + BankTransactions bankTransactions = accountingApi.getBankTransactions(ifModifiedSince, where, order, null, null); if (bankTransactions.getBankTransactions().size() > 0) { UUID BankTransactionID = bankTransactions.getBankTransactions().get(0).getBankTransactionID(); - Attachments bankTransactionsAttachments = accountingApi.getBankTransactionAttachments(xeroTenantId, BankTransactionID); + Attachments bankTransactionsAttachments = accountingApi.getBankTransactionAttachments(BankTransactionID); if (bankTransactionsAttachments.getAttachments().size() > 0) { UUID BankTransactionAttachementID = bankTransactionsAttachments.getAttachments().get(0).getAttachmentID(); String BankTransactionContentType = bankTransactionsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream BankTransactionInput = accountingApi.getAccountAttachmentById(xeroTenantId, BankTransactionID,BankTransactionAttachementID, BankTransactionContentType); + ByteArrayInputStream BankTransactionInput = accountingApi.getAccountAttachmentById(BankTransactionID,BankTransactionAttachementID, BankTransactionContentType); String BankTransactionFileName = "BankTransaction_" + bankTransactionsAttachments.getAttachments().get(0).getFileName(); String BankTransactionSaveFilePath = saveFile(BankTransactionInput,BankTransactionFileName); messages.add("Get BankTransactions attachment - save it here: " + BankTransactionSaveFilePath); @@ -280,14 +322,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } // GET BankTransfers Attachment - BankTransfers bankTransfers = accountingApi.getBankTransfers(xeroTenantId, ifModifiedSince, where, order); + BankTransfers bankTransfers = accountingApi.getBankTransfers(ifModifiedSince, where, order); if (bankTransfers.getBankTransfers().size() > 0) { UUID BankTransferID = bankTransfers.getBankTransfers().get(0).getBankTransferID(); - Attachments bankTransfersAttachments = accountingApi.getBankTransferAttachments(xeroTenantId, BankTransferID); + Attachments bankTransfersAttachments = accountingApi.getBankTransferAttachments(BankTransferID); if (bankTransfersAttachments.getAttachments().size() > 0) { UUID BankTransferAttachementID = bankTransfersAttachments.getAttachments().get(0).getAttachmentID(); String BankTransferContentType = bankTransfersAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream BankTransferInput = accountingApi.getAccountAttachmentById(xeroTenantId, BankTransferID,BankTransferAttachementID, BankTransferContentType); + ByteArrayInputStream BankTransferInput = accountingApi.getAccountAttachmentById(BankTransferID,BankTransferAttachementID, BankTransferContentType); String BankTransferFileName = "BankTransfer_" + bankTransfersAttachments.getAttachments().get(0).getFileName(); String BankTransferSaveFilePath = saveFile(BankTransferInput,BankTransferFileName); messages.add("Get BankTransfers attachment - save it here: " + BankTransferSaveFilePath); @@ -295,14 +337,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } // GET Contacts Attachment where = "ContactStatus==\"ACTIVE\""; - Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); if (contacts.getContacts().size() > 0) { UUID ContactID = contacts.getContacts().get(0).getContactID(); - Attachments contactsAttachments = accountingApi.getContactAttachments(xeroTenantId, ContactID); + Attachments contactsAttachments = accountingApi.getContactAttachments(ContactID); if (contactsAttachments.getAttachments().size() > 0) { UUID ContactAttachementID = contactsAttachments.getAttachments().get(0).getAttachmentID(); String ContactContentType = contactsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream ContactInput = accountingApi.getAccountAttachmentById(xeroTenantId, ContactID,ContactAttachementID, ContactContentType); + ByteArrayInputStream ContactInput = accountingApi.getAccountAttachmentById(ContactID,ContactAttachementID, ContactContentType); String ContactFileName = "Contact_" + contactsAttachments.getAttachments().get(0).getFileName(); String ContactSaveFilePath = saveFile(ContactInput,ContactFileName); messages.add("Get Contacts attachment - save it here: " + ContactSaveFilePath); @@ -310,14 +352,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } // GET CreditNotes Attachment where = "Status==\"AUTHORISED\""; - CreditNotes creditNotes = accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, null); + CreditNotes creditNotes = accountingApi.getCreditNotes(ifModifiedSince, where, order, null); if (creditNotes.getCreditNotes().size() > 0) { UUID CreditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - Attachments creditNotesAttachments = accountingApi.getCreditNoteAttachments(xeroTenantId, CreditNoteID); + Attachments creditNotesAttachments = accountingApi.getCreditNoteAttachments(CreditNoteID); if (creditNotesAttachments.getAttachments().size() > 0) { UUID CreditNoteAttachementID = creditNotesAttachments.getAttachments().get(0).getAttachmentID(); String CreditNoteContentType = creditNotesAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream CreditNoteInput = accountingApi.getAccountAttachmentById(xeroTenantId, CreditNoteID,CreditNoteAttachementID, CreditNoteContentType); + ByteArrayInputStream CreditNoteInput = accountingApi.getAccountAttachmentById(CreditNoteID,CreditNoteAttachementID, CreditNoteContentType); String CreditNoteFileName = "CreditNote_" + creditNotesAttachments.getAttachments().get(0).getFileName(); String CreditNoteSaveFilePath = saveFile(CreditNoteInput,CreditNoteFileName); messages.add("Get CreditNotes attachment - save it here: " + CreditNoteSaveFilePath); @@ -325,14 +367,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } // GET Invoices Attachment - Invoices invoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoices invoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); if (invoices.getInvoices().size() > 0) { UUID InvoiceID = invoices.getInvoices().get(0).getInvoiceID(); - Attachments invoicesAttachments = accountingApi.getInvoiceAttachments(xeroTenantId, InvoiceID); + Attachments invoicesAttachments = accountingApi.getInvoiceAttachments(InvoiceID); if (invoicesAttachments.getAttachments().size() > 0) { UUID InvoiceAttachementID = invoicesAttachments.getAttachments().get(0).getAttachmentID(); String InvoiceContentType = invoicesAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream InvoiceInput = accountingApi.getAccountAttachmentById(xeroTenantId, InvoiceID,InvoiceAttachementID, InvoiceContentType); + ByteArrayInputStream InvoiceInput = accountingApi.getAccountAttachmentById(InvoiceID,InvoiceAttachementID, InvoiceContentType); String InvoiceFileName = "Invoice_" + invoicesAttachments.getAttachments().get(0).getFileName(); String InvoiceSaveFilePath = saveFile(InvoiceInput,InvoiceFileName); messages.add("Get Invoices attachment - save it here: " + InvoiceSaveFilePath); @@ -341,14 +383,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) // GET ManualJournals Attachment where= null; - ManualJournals manualJournals = accountingApi.getManualJournals(xeroTenantId, ifModifiedSince, where, order, null); + ManualJournals manualJournals = accountingApi.getManualJournals(ifModifiedSince, where, order, null); if (manualJournals.getManualJournals().size() > 0) { UUID ManualJournalID = manualJournals.getManualJournals().get(0).getManualJournalID(); - Attachments manualJournalsAttachments = accountingApi.getManualJournalAttachments(xeroTenantId, ManualJournalID); + Attachments manualJournalsAttachments = accountingApi.getManualJournalAttachments(ManualJournalID); if (manualJournalsAttachments.getAttachments().size() > 0) { UUID ManualJournalAttachementID = manualJournalsAttachments.getAttachments().get(0).getAttachmentID(); String ManualJournalContentType = manualJournalsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream ManualJournalInput = accountingApi.getAccountAttachmentById(xeroTenantId, ManualJournalID,ManualJournalAttachementID, ManualJournalContentType); + ByteArrayInputStream ManualJournalInput = accountingApi.getAccountAttachmentById(ManualJournalID,ManualJournalAttachementID, ManualJournalContentType); String ManualJournalFileName = "ManualJournal_" + manualJournalsAttachments.getAttachments().get(0).getFileName(); String ManualJournalSaveFilePath = saveFile(ManualJournalInput,ManualJournalFileName); messages.add("Get ManualJournals attachment - save it here: " + ManualJournalSaveFilePath); @@ -356,14 +398,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } // GET Receipts Attachment - Receipts receipts = accountingApi.getReceipts(xeroTenantId, ifModifiedSince, where, order, null); + Receipts receipts = accountingApi.getReceipts(ifModifiedSince, where, order, null); if (receipts.getReceipts().size() > 0) { UUID ReceiptID = receipts.getReceipts().get(0).getReceiptID(); - Attachments receiptsAttachments = accountingApi.getReceiptAttachments(xeroTenantId, ReceiptID); + Attachments receiptsAttachments = accountingApi.getReceiptAttachments(ReceiptID); if (receiptsAttachments.getAttachments().size() > 0) { UUID ReceiptAttachementID = receiptsAttachments.getAttachments().get(0).getAttachmentID(); String ReceiptContentType = receiptsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream ReceiptInput = accountingApi.getAccountAttachmentById(xeroTenantId, ReceiptID,ReceiptAttachementID, ReceiptContentType); + ByteArrayInputStream ReceiptInput = accountingApi.getAccountAttachmentById(ReceiptID,ReceiptAttachementID, ReceiptContentType); String ReceiptFileName = "Receipt_" + receiptsAttachments.getAttachments().get(0).getFileName(); String ReceiptSaveFilePath = saveFile(ReceiptInput,ReceiptFileName); messages.add("Get Receipts attachment - save it here: " + ReceiptSaveFilePath); @@ -371,14 +413,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } // GET RepeatingInvoices Attachment - RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(xeroTenantId, where, order); + RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(where, order); if (repeatingInvoices.getRepeatingInvoices().size() > 0) { UUID RepeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - Attachments repeatingInvoicesAttachments = accountingApi.getRepeatingInvoiceAttachments(xeroTenantId, RepeatingInvoiceID); + Attachments repeatingInvoicesAttachments = accountingApi.getRepeatingInvoiceAttachments(RepeatingInvoiceID); if (repeatingInvoicesAttachments.getAttachments().size() > 0) { UUID RepeatingInvoiceAttachementID = repeatingInvoicesAttachments.getAttachments().get(0).getAttachmentID(); String RepeatingInvoiceContentType = repeatingInvoicesAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream RepeatingInvoiceInput = accountingApi.getAccountAttachmentById(xeroTenantId, RepeatingInvoiceID,RepeatingInvoiceAttachementID, RepeatingInvoiceContentType); + ByteArrayInputStream RepeatingInvoiceInput = accountingApi.getAccountAttachmentById(RepeatingInvoiceID,RepeatingInvoiceAttachementID, RepeatingInvoiceContentType); String RepeatingInvoiceFileName = "RepeatingInvoice_" + repeatingInvoicesAttachments.getAttachments().get(0).getFileName(); String RepeatingInvoiceSaveFilePath = saveFile(RepeatingInvoiceInput,RepeatingInvoiceFileName); messages.add("Get RepeatingInvoices attachment - save it here: " + RepeatingInvoiceSaveFilePath); @@ -396,11 +438,11 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // CREATE Accounts attachment where = "Status==\"ACTIVE\""; - Accounts myAccounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts myAccounts = accountingApi.getAccounts(ifModifiedSince, where, order); if ( myAccounts.getAccounts().size() > 0) { UUID accountID = myAccounts.getAccounts().get(0).getAccountID(); String accountName = myAccounts.getAccounts().get(0).getName(); - Attachments createdAttachments = accountingApi.createAccountAttachmentByFileName(xeroTenantId, accountID, newFileName, bytes); + Attachments createdAttachments = accountingApi.createAccountAttachmentByFileName(accountID, newFileName, bytes); messages.add("Attachment to Name: " + accountName + " Account ID: " + accountID + " attachment - ID: " + createdAttachments.getAttachments().get(0).getAttachmentID()); } } catch (Exception e) { @@ -410,10 +452,10 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { where = null; // CREATE BankTransactions attachment - BankTransactions myBanktransactions = accountingApi.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, null, null); + BankTransactions myBanktransactions = accountingApi.getBankTransactions(ifModifiedSince, where, order, null, null); if ( myBanktransactions.getBankTransactions().size() > 0) { UUID banktransactionID = myBanktransactions.getBankTransactions().get(0).getBankTransactionID(); - Attachments createdBanktransationAttachments = accountingApi.createBankTransactionAttachmentByFileName(xeroTenantId, banktransactionID, newFileName, bytes); + Attachments createdBanktransationAttachments = accountingApi.createBankTransactionAttachmentByFileName(banktransactionID, newFileName, bytes); messages.add("Attachment to BankTransaction ID: " + banktransactionID + " attachment - ID: " + createdBanktransationAttachments.getAttachments().get(0).getAttachmentID()); } } catch (Exception e) { @@ -422,10 +464,10 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // CREATE BankTransfer attachment - BankTransfers myBankTransfer = accountingApi.getBankTransfers(xeroTenantId, ifModifiedSince, where, order); + BankTransfers myBankTransfer = accountingApi.getBankTransfers(ifModifiedSince, where, order); if ( myBankTransfer.getBankTransfers().size() > 0) { UUID bankTransferID = myBankTransfer.getBankTransfers().get(0).getBankTransferID(); - Attachments createdBankTransferAttachments = accountingApi.createBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, newFileName, bytes); + Attachments createdBankTransferAttachments = accountingApi.createBankTransferAttachmentByFileName(bankTransferID, newFileName, bytes); messages.add("Attachment to BankTransfer ID: " + bankTransferID + " attachment - ID: " + createdBankTransferAttachments.getAttachments().get(0).getAttachmentID()); } } catch (Exception e) { @@ -435,10 +477,10 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // CREATE Contacts attachment where = "ContactStatus==\"ACTIVE\""; - Contacts contactsWhere = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contactsWhere = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); if ( contactsWhere.getContacts().size() > 0) { UUID contactID = contactsWhere.getContacts().get(0).getContactID(); - Attachments createdContactAttachments = accountingApi.createContactAttachmentByFileName(xeroTenantId, contactID, newFileName, bytes); + Attachments createdContactAttachments = accountingApi.createContactAttachmentByFileName(contactID, newFileName, bytes); messages.add("Attachment to Contact ID: " + contactID + " attachment - ID: " + createdContactAttachments.getAttachments().get(0).getAttachmentID()); } } catch (Exception e) { @@ -448,10 +490,10 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { where = "Status==\"AUTHORISED\""; // CREATE CreditNotes attachment - CreditNotes myCreditNotes = accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, null); + CreditNotes myCreditNotes = accountingApi.getCreditNotes(ifModifiedSince, where, order, null); if ( myCreditNotes.getCreditNotes().size() > 0) { UUID creditNoteID = myCreditNotes.getCreditNotes().get(0).getCreditNoteID(); - Attachments createdCreditNoteAttachments = accountingApi.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, newFileName, bytes); + Attachments createdCreditNoteAttachments = accountingApi.createCreditNoteAttachmentByFileName(creditNoteID, newFileName, bytes); messages.add("Attachment to Credit Notes ID: " + creditNoteID + " attachment - ID: " + createdCreditNoteAttachments.getAttachments().get(0).getAttachmentID()); } } catch (Exception e) { @@ -460,10 +502,10 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // CREATE invoice attachment - Invoices myInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoices myInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); if ( myInvoices.getInvoices().size() > 0) { UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); - Attachments createdInvoiceAttachments = accountingApi.createInvoiceAttachmentByFileName(xeroTenantId, invoiceID, newFileName, bytes); + Attachments createdInvoiceAttachments = accountingApi.createInvoiceAttachmentByFileName(invoiceID, newFileName, bytes); messages.add("Attachment to Invoice ID: " + invoiceID + " attachment - ID: " + createdInvoiceAttachments.getAttachments().get(0).getAttachmentID()); } } catch (Exception e) { @@ -473,12 +515,12 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // CREATE ManualJournals attachment where= null; - ManualJournals myManualJournals = accountingApi.getManualJournals(xeroTenantId, ifModifiedSince, where, order, null); + ManualJournals myManualJournals = accountingApi.getManualJournals(ifModifiedSince, where, order, null); System.out.println(myManualJournals.getManualJournals().size()); if ( myManualJournals.getManualJournals().size() > 0) { UUID manualJournalID = myManualJournals.getManualJournals().get(0).getManualJournalID(); - Attachments createdManualJournalAttachments = accountingApi.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, newFileName, bytes); + Attachments createdManualJournalAttachments = accountingApi.createManualJournalAttachmentByFileName(manualJournalID, newFileName, bytes); messages.add("Attachment to Manual Journal ID: " + manualJournalID + " attachment - ID: " + createdManualJournalAttachments.getAttachments().get(0).getAttachmentID()); } } catch (Exception e) { @@ -487,10 +529,10 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // CREATE Receipts attachment - Receipts myReceipts = accountingApi.getReceipts(xeroTenantId, ifModifiedSince, where, order, null); + Receipts myReceipts = accountingApi.getReceipts(ifModifiedSince, where, order, null); if ( myReceipts.getReceipts().size() > 0) { UUID receiptID = myReceipts.getReceipts().get(0).getReceiptID(); - Attachments createdReceiptsAttachments = accountingApi.createReceiptAttachmentByFileName(xeroTenantId, receiptID, newFileName, bytes); + Attachments createdReceiptsAttachments = accountingApi.createReceiptAttachmentByFileName(receiptID, newFileName, bytes); messages.add("Attachment to Receipt ID: " + receiptID + " attachment - ID: " + createdReceiptsAttachments.getAttachments().get(0).getAttachmentID()); } } catch (Exception e) { @@ -499,10 +541,10 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // CREATE Repeating Invoices attachment - RepeatingInvoices myRepeatingInvoices = accountingApi.getRepeatingInvoices(xeroTenantId, where, order); + RepeatingInvoices myRepeatingInvoices = accountingApi.getRepeatingInvoices(where, order); if ( myRepeatingInvoices.getRepeatingInvoices().size() > 0) { UUID repeatingInvoiceID = myRepeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - Attachments createdRepeatingInvoiceAttachments = accountingApi.createRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, newFileName, bytes); + Attachments createdRepeatingInvoiceAttachments = accountingApi.createRepeatingInvoiceAttachmentByFileName(repeatingInvoiceID, newFileName, bytes); messages.add("Attachment to Repeating Invoices ID: " + repeatingInvoiceID + " attachment - ID: " + createdRepeatingInvoiceAttachments.getAttachments().get(0).getAttachmentID()); } @@ -514,7 +556,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) /* BANK TRANSFER */ try { where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); where = null; // Maker sure we have at least 2 banks if(accountsWhere.getAccounts().size() > 1) { @@ -525,20 +567,20 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) bankTransfer.setAmount("50.00"); BankTransfers newBTs = new BankTransfers(); newBTs.addBankTransfersItem(bankTransfer); - BankTransfers newBankTranfer = accountingApi.createBankTransfer(xeroTenantId, newBTs); + BankTransfers newBankTranfer = accountingApi.createBankTransfer(newBTs); messages.add("Get a one Bank Transfer - amount : " + newBankTranfer.getBankTransfers().get(0).getAmount()); // GET all Bank Transfers - BankTransfers bankTranfers = accountingApi.getBankTransfers(xeroTenantId, ifModifiedSince, where, order); + BankTransfers bankTranfers = accountingApi.getBankTransfers(ifModifiedSince, where, order); messages.add("Get a all Bank Transfers - total : " + bankTranfers.getBankTransfers().size()); UUID bankTransferId = bankTranfers.getBankTransfers().get(0).getBankTransferID(); // GET one Bank Transfer - BankTransfers oneBankTranfer = accountingApi.getBankTransfer(xeroTenantId, bankTransferId); + BankTransfers oneBankTranfer = accountingApi.getBankTransfer(bankTransferId); messages.add("Get a one Bank Transfer - amount : " + oneBankTranfer.getBankTransfers().get(0).getAmount()); // GET Bank Transfer History - HistoryRecords hr = accountingApi.getBankTransferHistory(xeroTenantId, bankTransferId); + HistoryRecords hr = accountingApi.getBankTransferHistory(bankTransferId); messages.add("Get a one Bank Transfer History Record - details :" + hr.getHistoryRecords().get(0).getDetails()); // CREATE Bank Transfer History @@ -561,13 +603,13 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) /* BANK TRANSACTION */ try { where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId,ifModifiedSince, where, order); + Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); Account bankAcct = new Account(); bankAcct.setCode(accountsWhere.getAccounts().get(0).getCode()); where = null; - Contacts contacts = accountingApi.getContacts(xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); Contact useContact = new Contact(); useContact.setContactID(contacts.getContacts().get(0).getContactID()); @@ -588,31 +630,31 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.SPEND); BankTransactions bts = new BankTransactions(); bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(xeroTenantId, bts, summarizeErrors); + BankTransactions newBankTransaction = accountingApi.createBankTransaction(bts, summarizeErrors); messages.add("Create new BankTransaction : amount:" + newBankTransaction.getBankTransactions().get(0).getTotal()); // GET all Bank Transaction - BankTransactions bankTransactions = accountingApi.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, null, null); + BankTransactions bankTransactions = accountingApi.getBankTransactions(ifModifiedSince, where, order, null, null); messages.add("Get a all Bank Transactions - total : " + bankTransactions.getBankTransactions().size()); // GET one Bank Transaction - BankTransactions oneBankTransaction = accountingApi.getBankTransaction(xeroTenantId, bankTransactions.getBankTransactions().get(0).getBankTransactionID()); + BankTransactions oneBankTransaction = accountingApi.getBankTransaction(bankTransactions.getBankTransactions().get(0).getBankTransactionID()); messages.add("Get a one Bank Transaction : amount:" + oneBankTransaction.getBankTransactions().get(0).getTotal()); // UDPATE Bank Transaction newBankTransaction.getBankTransactions().get(0).setSubTotal(null); newBankTransaction.getBankTransactions().get(0).setTotal(null); newBankTransaction.getBankTransactions().get(0).setReference("You just updated"); - BankTransactions updateBankTransaction = accountingApi.updateBankTransaction(xeroTenantId, newBankTransaction.getBankTransactions().get(0).getBankTransactionID(),newBankTransaction); + BankTransactions updateBankTransaction = accountingApi.updateBankTransaction(newBankTransaction.getBankTransactions().get(0).getBankTransactionID(),newBankTransaction); messages.add("Update new BankTransaction : reference:" + updateBankTransaction.getBankTransactions().get(0).getReference()); // DELETE Bank Transaction newBankTransaction.getBankTransactions().get(0).setStatus(com.xero.models.accounting.BankTransaction.StatusEnum.DELETED); - BankTransactions deletedBankTransaction = accountingApi.updateBankTransaction(xeroTenantId, newBankTransaction.getBankTransactions().get(0).getBankTransactionID(),newBankTransaction); + BankTransactions deletedBankTransaction = accountingApi.updateBankTransaction(newBankTransaction.getBankTransactions().get(0).getBankTransactionID(),newBankTransaction); messages.add("Deleted new Bank Transaction : Status:" + deletedBankTransaction.getBankTransactions().get(0).getStatus()); // GET Bank Transaction History - HistoryRecords hr = accountingApi.getBankTransactionsHistory(xeroTenantId, oneBankTransaction.getBankTransactions().get(0).getBankTransactionID()); + HistoryRecords hr = accountingApi.getBankTransactionsHistory(oneBankTransaction.getBankTransactions().get(0).getBankTransactionID()); messages.add("Get a one Bank Transaction History Record - details :" + hr.getHistoryRecords().get(0).getDetails()); // CREATE Bank Transaction History @@ -636,7 +678,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // CREATE payment where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoices allInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); Invoice inv = new Invoice(); inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); Invoice inv2 = new Invoice(); @@ -646,7 +688,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) where = null; where = "EnablePaymentsToAccount==true"; - Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); Account paymentAccount = new Account(); paymentAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); where = null; @@ -683,11 +725,11 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) createBatchPayments.addBatchPaymentsItem(createBatchPayment); - BatchPayments newBatchPayments = accountingApi.createBatchPayment(xeroTenantId, createBatchPayments); + BatchPayments newBatchPayments = accountingApi.createBatchPayment(createBatchPayments); messages.add("Create BatchPayments - ID : " + newBatchPayments.getBatchPayments().get(0).getTotalAmount()); // GET all Payments - BatchPayments allBatchPayments = accountingApi.getBatchPayments(xeroTenantId, ifModifiedSince, where, order); + BatchPayments allBatchPayments = accountingApi.getBatchPayments(ifModifiedSince, where, order); messages.add("Get BatchPayments - Total : " + allBatchPayments.getBatchPayments().size()); } catch (Exception e) { System.out.println(e.getMessage()); @@ -697,25 +739,25 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) /* BRANDING THEME */ try { // GET all BrandingTheme - BrandingThemes bt = accountingApi.getBrandingThemes(xeroTenantId); + BrandingThemes bt = accountingApi.getBrandingThemes(); messages.add("Get a All Branding Themes - total : " + bt.getBrandingThemes().size()); // GET one BrandingTheme UUID btID = bt.getBrandingThemes().get(0).getBrandingThemeID(); - BrandingThemes oneBt = accountingApi.getBrandingTheme(xeroTenantId, btID); + BrandingThemes oneBt = accountingApi.getBrandingTheme(btID); messages.add("Get a one Branding Themes - name : " + oneBt.getBrandingThemes().get(0).getName()); /* // Create PaymentService for a Branding Theme - PaymentServices paymentServices = accountingApi.getPaymentServices(xeroTenantId); + PaymentServices paymentServices = accountingApi.getPaymentServices(); UUID paymentServiceID = paymentServices.getPaymentServices().get(0).getPaymentServiceID(); PaymentService btPaymentService = new PaymentService(); btPaymentService.setPaymentServiceType("Custom"); btPaymentService.setPaymentServiceID(paymentServiceID); - PaymentServices createdPaymentService = accountingApi.createBrandingThemePaymentServices(xeroTenantId,btID, btPaymentService); + PaymentServices createdPaymentService = accountingApi.createBrandingThemePaymentServices(btID, btPaymentService); messages.add("Created payment services for Branding Themes - name : " + createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); */ // GET Payment Services for a single Branding Theme - PaymentServices paymentServicesForBrandingTheme = accountingApi.getBrandingThemePaymentServices(xeroTenantId, btID); + PaymentServices paymentServicesForBrandingTheme = accountingApi.getBrandingThemePaymentServices(btID); messages.add("Get payment services for Branding Themes - name : " + paymentServicesForBrandingTheme.getPaymentServices().get(0).getPaymentServiceName()); } catch (Exception e) { @@ -736,41 +778,41 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) phone.setPhoneAreaCode("415"); phones.add(phone); contact.setPhones(phones); - Contacts newContact = accountingApi.createContact(xeroTenantId, contact); + Contacts newContact = accountingApi.createContact(contact); messages.add("Create new Contact - Name : " + newContact.getContacts().get(0).getName()); // UPDATE contact newContact.getContacts().get(0).setName("Bar" + loadRandomNum()); UUID contactID = newContact.getContacts().get(0).getContactID(); - Contacts updatedContact = accountingApi.updateContact(xeroTenantId, contactID, newContact); + Contacts updatedContact = accountingApi.updateContact(contactID, newContact); messages.add("Update new Contact - Name : " + updatedContact.getContacts().get(0).getName()); // GET all contact - Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); messages.add("Get a All Contacts - Total : " + contacts.getContacts().size()); // GET one contact UUID oneContactID = contacts.getContacts().get(0).getContactID(); - Contacts oneContact = accountingApi.getContact(xeroTenantId, oneContactID); + Contacts oneContact = accountingApi.getContact(oneContactID); messages.add("Get a One Contact - Name : " + oneContact.getContacts().get(0).getName()); // GET contact cisSettings where = "Name==\"sidney\""; - Contacts cisContact = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts cisContact = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); if (cisContact.getContacts().size() > 0) { - CISSettings cisSettings = accountingApi.getContactCISSettings(xeroTenantId, cisContact.getContacts().get(0).getContactID()); + CISSettings cisSettings = accountingApi.getContactCISSettings(cisContact.getContacts().get(0).getContactID()); messages.add("Get a Contact cisSettings - Enabled? : " + cisSettings.getCiSSettings().get(0).getCiSEnabled()); } where = null; // GET active contacts where = "ContactStatus==\"ACTIVE\""; - Contacts contactsWhere = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contactsWhere = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); messages.add("Get a all ACTIVE Contacts - Total : " + contactsWhere.getContacts().size()); where = null; // Get Contact History - HistoryRecords contactHistory = accountingApi.getContactHistory(xeroTenantId, contactID); + HistoryRecords contactHistory = accountingApi.getContactHistory(contactID); messages.add("Contact History - count : " + contactHistory.getHistoryRecords().size() ); // Create Contact History @@ -779,7 +821,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) newHistoryRecord.setDetails("Hello World"); newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newInvoiceHistory = accountingApi.createContactHistory(xeroTenantId, contactID,newHistoryRecords); + HistoryRecords newInvoiceHistory = accountingApi.createContactHistory(contactID,newHistoryRecords); messages.add("Contact History - note added to : " + newInvoiceHistory.getHistoryRecords().get(0).getDetails()); } catch (Exception e) { @@ -795,28 +837,28 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) ContactGroup cg = new ContactGroup(); cg.setName("NewGroup" + loadRandomNum()); newCGs.addContactGroupsItem(cg); - ContactGroups newContactGroup = accountingApi.createContactGroup(xeroTenantId, newCGs); + ContactGroups newContactGroup = accountingApi.createContactGroup(newCGs); messages.add("Create a ContactGroup - Name : " + newContactGroup.getContactGroups().get(0).getName()); // UPDATE Contact group newCGs.getContactGroups().get(0).setName("Old Group" + loadRandomNum()); UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - ContactGroups updateContactGroup = accountingApi.updateContactGroup(xeroTenantId, newContactGroupID, newCGs); + ContactGroups updateContactGroup = accountingApi.updateContactGroup(newContactGroupID, newCGs); messages.add("Update a ContactGroup - Name : " + updateContactGroup.getContactGroups().get(0).getName()); // GET all contact groups - ContactGroups contactGroups = accountingApi.getContactGroups(xeroTenantId, where, order); + ContactGroups contactGroups = accountingApi.getContactGroups(where, order); messages.add("Get all ContactGroups - Total : " + contactGroups.getContactGroups().size()); // GET one contact groups UUID contactGroupId = contactGroups.getContactGroups().get(0).getContactGroupID(); - ContactGroups oneCg = accountingApi.getContactGroup(xeroTenantId, contactGroupId); + ContactGroups oneCg = accountingApi.getContactGroup(contactGroupId); messages.add("Get one ContactGroups - Name : " + oneCg.getContactGroups().get(0).getName()); // DELETE contact Group newCGs.getContactGroups().get(0).setStatus(com.xero.models.accounting.ContactGroup.StatusEnum.DELETED); UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - ContactGroups deletedContactGroup = accountingApi.updateContactGroup(xeroTenantId, contactGroupID, contactGroups); + ContactGroups deletedContactGroup = accountingApi.updateContactGroup(contactGroupID, contactGroups); messages.add("Delete a ContactGroup - Name : " + deletedContactGroup.getContactGroups().get(0).getName()); } catch (Exception e) { @@ -831,23 +873,23 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) ContactGroup cg = new ContactGroup(); cg.setName("NewGroup" + loadRandomNum()); newCGs.addContactGroupsItem(cg); - ContactGroups newContactGroup = accountingApi.createContactGroup(xeroTenantId, newCGs); + ContactGroups newContactGroup = accountingApi.createContactGroup(newCGs); - Contacts allContacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts allContacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); // Create Contacts in Group Contacts contactList = new Contacts(); contactList.addContactsItem(allContacts.getContacts().get(0)); contactList.addContactsItem(allContacts.getContacts().get(1)); UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - Contacts addContacts = accountingApi.createContactGroupContacts(xeroTenantId, contactGroupID, contactList); + Contacts addContacts = accountingApi.createContactGroupContacts(contactGroupID, contactList); messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts.getContacts().size()); // DELETE all Contacts in Group - accountingApi.deleteContactGroupContacts(xeroTenantId, newContactGroup.getContactGroups().get(0).getContactGroupID()); + accountingApi.deleteContactGroupContacts(newContactGroup.getContactGroups().get(0).getContactGroupID()); messages.add("Delete All Contacts to Contact Group - no content in response "); - ContactGroups oneCg = accountingApi.getContactGroup(xeroTenantId, newContactGroup.getContactGroups().get(0).getContactGroupID()); + ContactGroups oneCg = accountingApi.getContactGroup(newContactGroup.getContactGroups().get(0).getContactGroupID()); messages.add("Get ContactGroups - Total Contacts : " + oneCg.getContactGroups().get(0).getContacts().size()); // DELETE Single Contact @@ -856,14 +898,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) contactList2.addContactsItem(allContacts.getContacts().get(4)); UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - Contacts addContacts2 = accountingApi.createContactGroupContacts(xeroTenantId, newContactGroupID, contactList2); + Contacts addContacts2 = accountingApi.createContactGroupContacts(newContactGroupID, contactList2); messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts2.getContacts().size()); // DELETE Single CONACTS - accountingApi.deleteContactGroupContact(xeroTenantId, newContactGroup.getContactGroups().get(0).getContactGroupID(),allContacts.getContacts().get(3).getContactID()); + accountingApi.deleteContactGroupContact(newContactGroup.getContactGroups().get(0).getContactGroupID(),allContacts.getContacts().get(3).getContactID()); messages.add("Delete 1 contact from Contact Group - no content in response"); - ContactGroups oneCg2 = accountingApi.getContactGroup(xeroTenantId, newContactGroup.getContactGroups().get(0).getContactGroupID()); + ContactGroups oneCg2 = accountingApi.getContactGroup(newContactGroup.getContactGroups().get(0).getContactGroupID()); messages.add("Get ContactGroups - Total Contacts : " + oneCg2.getContactGroups().get(0).getContacts().size()); } catch (Exception e) { @@ -872,9 +914,9 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } else if (object.equals("CreditNotesPDF")) { // GET CreditNote As a PDF - CreditNotes creditNotes = accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, null); + CreditNotes creditNotes = accountingApi.getCreditNotes(ifModifiedSince, where, order, null); UUID creditNoteId = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - ByteArrayInputStream CreditNoteInput = accountingApi.getCreditNoteAsPdf(xeroTenantId, creditNoteId, "application/pdf"); + ByteArrayInputStream CreditNoteInput = accountingApi.getCreditNoteAsPdf(creditNoteId, "application/pdf"); String CreditNoteFileName = "CreditNoteAsPDF.pdf"; String CreditNoteSaveFilePath = saveFile(CreditNoteInput,CreditNoteFileName); @@ -883,7 +925,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } else if (object.equals("CreditNotes")) { // CREDIT NOTE try { - Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); // Create Credit Note List lineItems = new ArrayList<>(); @@ -900,22 +942,22 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) cn.setLineItems(lineItems); cn.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT); newCNs.addCreditNotesItem(cn); - CreditNotes newCreditNote = accountingApi.createCreditNote(xeroTenantId, newCNs, summarizeErrors); + CreditNotes newCreditNote = accountingApi.createCreditNote(newCNs, summarizeErrors); messages.add("Create a CreditNote - Amount : " + newCreditNote.getCreditNotes().get(0).getTotal()); UUID newCreditNoteId = newCreditNote.getCreditNotes().get(0).getCreditNoteID(); // GET all Credit Note - CreditNotes creditNotes = accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, null); + CreditNotes creditNotes = accountingApi.getCreditNotes(ifModifiedSince, where, order, null); messages.add("Get all CreditNotes - Total : " + creditNotes.getCreditNotes().size()); // GET One Credit Note UUID creditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - CreditNotes oneCreditNote = accountingApi.getCreditNote(xeroTenantId, creditNoteID); + CreditNotes oneCreditNote = accountingApi.getCreditNote(creditNoteID); messages.add("Get a CreditNote - Amount : " + oneCreditNote.getCreditNotes().get(0).getTotal()); // UPDATE Credit Note newCNs.getCreditNotes().get(0).setStatus(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED); - CreditNotes updatedCreditNote = accountingApi.updateCreditNote(xeroTenantId, newCreditNoteId, newCNs); + CreditNotes updatedCreditNote = accountingApi.updateCreditNote(newCreditNoteId, newCNs); messages.add("Update a CreditNote - Ref : " + updatedCreditNote.getCreditNotes().get(0).getReference()); // Allocate Credit Note @@ -923,7 +965,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) Allocation allocation = new Allocation(); where = "Status==\"AUTHORISED\"&&Type==\"ACCPAY\""; - Invoices allInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoices allInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); Invoice inv = new Invoice(); inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); allocation.setInvoice(inv); @@ -933,11 +975,11 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) allocations.addAllocationsItem(allocation); where = null; - Allocations allocatedCreditNote = accountingApi.createCreditNoteAllocation(xeroTenantId, newCreditNoteId,allocations); + Allocations allocatedCreditNote = accountingApi.createCreditNoteAllocation(newCreditNoteId,allocations); messages.add("Update CreditNote Allocation - Amount : " + allocatedCreditNote.getAllocations().get(0).getAmount()); // Get Invoice History - HistoryRecords history = accountingApi.getCreditNoteHistory(xeroTenantId, creditNoteID); + HistoryRecords history = accountingApi.getCreditNoteHistory(creditNoteID); messages.add("History - count : " + history.getHistoryRecords().size() ); // Create Invoice History @@ -946,7 +988,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) newHistoryRecord.setDetails("Hello World"); newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createCreditNoteHistory(xeroTenantId, creditNoteID, newHistoryRecords); + HistoryRecords newHistory = accountingApi.createCreditNoteHistory(creditNoteID, newHistoryRecords); messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); } catch (Exception e) { @@ -959,7 +1001,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) // JSON - incomplete try { //Get All - Currencies currencies = accountingApi.getCurrencies(xeroTenantId, where, order); + Currencies currencies = accountingApi.getCurrencies(where, order); messages.add("Get all Currencies - Total : " + currencies.getCurrencies().size()); // Create New @@ -969,7 +1011,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) curr.setCode(CurrencyCode.SGD); Currencies currs = new Currencies(); currs.addCurrenciesItem(curr); - Currencies newCurrency = accountingApi.createCurrency(xeroTenantId, currs); + Currencies newCurrency = accountingApi.createCurrency(currs); messages.add("New Currencies - Code : " + newCurrency.getCurrencies().get(0).getCode()); */ } catch (Exception e) { @@ -990,17 +1032,17 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) Employees emps = new Employees(); emps.addEmployeesItem(employee); - Employees newEmployee = accountingApi.createEmployee(xeroTenantId, emps); + Employees newEmployee = accountingApi.createEmployee(emps); messages.add("Create an Employee - Last Name : " + newEmployee.getEmployees().get(0).getLastName()); //Get All - Employees employees = accountingApi.getEmployees(xeroTenantId, ifModifiedSince, where, order); + Employees employees = accountingApi.getEmployees(ifModifiedSince, where, order); messages.add("Get all Employees - Total : " + employees.getEmployees().size()); UUID newEmpId = employees.getEmployees().get(0).getEmployeeID(); // Get One - Employees oneEmployee = accountingApi.getEmployee(xeroTenantId, newEmpId); + Employees oneEmployee = accountingApi.getEmployee(newEmpId); messages.add("Get one Employees - Name : " + oneEmployee.getEmployees().get(0).getFirstName()); // 404 ERROR @@ -1009,7 +1051,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) extLink2.setUrl("http://twitter.com/#!/search/Bart+Simpson"); newEmployee.getEmployees().get(0).setExternalLink(extLink2); - Employees updateEmployee = accountingApi.updateEmployee(xeroTenantId, newEmpId, newEmployee); + Employees updateEmployee = accountingApi.updateEmployee(newEmpId, newEmployee); messages.add("Update an Employee - Last Name : " + updateEmployee.getEmployees().get(0).getLastName()); } catch (Exception e) { @@ -1021,18 +1063,18 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { //Create //where = "IsSubscriber==true"; - Users users = accountingApi.getUsers(xeroTenantId, ifModifiedSince, where, order); + Users users = accountingApi.getUsers(ifModifiedSince, where, order); where = null; where = "ShowInExpenseClaims==true&&Status==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); where = null; if (users.getUsers().size() > 0) { User user = new User(); user.setUserID(users.getUsers().get(0).getUserID()); - Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); Contact useContact = new Contact(); useContact.setContactID(contacts.getContacts().get(0).getContactID()); @@ -1054,7 +1096,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) receipt.contact(useContact); receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); receipts.addReceiptsItem(receipt); - Receipts newReceipts = accountingApi.createReceipt(xeroTenantId, receipts); + Receipts newReceipts = accountingApi.createReceipt(receipts); // CREATE EXPENSE CLAIM ExpenseClaims createExpenseClaims = new ExpenseClaims(); @@ -1068,30 +1110,30 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) expenseClaim.setReceipts(myReceipts.getReceipts()); expenseClaim.setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED); createExpenseClaims.addExpenseClaimsItem(expenseClaim); - ExpenseClaims newExpenseClaims = accountingApi.createExpenseClaim(xeroTenantId, createExpenseClaims, summarizeErrors); + ExpenseClaims newExpenseClaims = accountingApi.createExpenseClaim(createExpenseClaims, summarizeErrors); messages.add("Create new Expense Claim - Status : " + newExpenseClaims.getExpenseClaims().get(0).getStatus()); // UPDATE EXPENSE CLAIM createExpenseClaims.getExpenseClaims().get(0).setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED); UUID expenseClaimID = newExpenseClaims.getExpenseClaims().get(0).getExpenseClaimID(); - ExpenseClaims updateExpenseClaims = accountingApi.updateExpenseClaim(xeroTenantId, expenseClaimID, createExpenseClaims); + ExpenseClaims updateExpenseClaims = accountingApi.updateExpenseClaim(expenseClaimID, createExpenseClaims); messages.add("Update new Expense Claim - Status : " + updateExpenseClaims.getExpenseClaims().get(0).getStatus()); //Get All Expense Claims - ExpenseClaims expenseClaims = accountingApi.getExpenseClaims(xeroTenantId, ifModifiedSince, where, order); + ExpenseClaims expenseClaims = accountingApi.getExpenseClaims(ifModifiedSince, where, order); messages.add("Get all Expense Claim - Total : " + expenseClaims.getExpenseClaims().size()); // Get One Expense Claim - ExpenseClaims oneExpenseClaim = accountingApi.getExpenseClaim(xeroTenantId, expenseClaims.getExpenseClaims().get(0).getExpenseClaimID()); + ExpenseClaims oneExpenseClaim = accountingApi.getExpenseClaim(expenseClaims.getExpenseClaims().get(0).getExpenseClaimID()); messages.add("Get one Expense Claim - Total : " + oneExpenseClaim.getExpenseClaims().get(0).getStatus()); // VOID EXPENSE CLAIM createExpenseClaims.getExpenseClaims().get(0).setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.VOIDED); - ExpenseClaims voidExpenseClaims = accountingApi.updateExpenseClaim(xeroTenantId, expenseClaimID, createExpenseClaims); + ExpenseClaims voidExpenseClaims = accountingApi.updateExpenseClaim(expenseClaimID, createExpenseClaims); messages.add("Void new Expense Claim - Status : " + voidExpenseClaims.getExpenseClaims().get(0).getStatus()); // Get Invoice History - HistoryRecords history = accountingApi.getExpenseClaimHistory(xeroTenantId, expenseClaimID); + HistoryRecords history = accountingApi.getExpenseClaimHistory(expenseClaimID); messages.add("History - count : " + history.getHistoryRecords().size() ); // Create Invoice History @@ -1115,20 +1157,20 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) // INVOICE // GET Invoice As a PDF - Invoices myInvoicesForPDF = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoices myInvoicesForPDF = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); UUID invoiceIDForPDF = myInvoicesForPDF.getInvoices().get(0).getInvoiceID(); - ByteArrayInputStream InvoiceNoteInput = accountingApi.getInvoiceAsPdf(xeroTenantId, invoiceIDForPDF, "application/pdf"); + ByteArrayInputStream InvoiceNoteInput = accountingApi.getInvoiceAsPdf(invoiceIDForPDF, "application/pdf"); String InvoiceFileName = "InvoiceAsPDF.pdf"; String InvoiceSaveFilePath = saveFile(InvoiceNoteInput,InvoiceFileName); messages.add("Get Invoice attachment - save it here: " + InvoiceSaveFilePath); // Create Invoice where = "Type==\"REVENUE\""; - Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); String accountCodeForInvoice = accounts.getAccounts().get(0).getCode(); where = null; - Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); UUID contactIDForInvoice = contacts.getContacts().get(0).getContactID(); @@ -1167,7 +1209,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); newInvoices.addInvoicesItem(myInvoice); - Invoices newInvoice = accountingApi.createInvoice(xeroTenantId, newInvoices, summarizeErrors); + Invoices newInvoice = accountingApi.createInvoice(newInvoices, summarizeErrors); messages.add("Create invoice - Reference : " + newInvoice.getInvoices().get(0).getReference()); UUID newInvoiceID = newInvoice.getInvoices().get(0).getInvoiceID(); Invoices updateInvoices = new Invoices(); @@ -1176,35 +1218,35 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) updateInvoice.setReference("Red Fish, Blue Fish"); updateInvoices.addInvoicesItem(updateInvoice); - Invoices updatedInvoice = accountingApi.updateInvoice(xeroTenantId, newInvoiceID,updateInvoices); + Invoices updatedInvoice = accountingApi.updateInvoice(newInvoiceID,updateInvoices); messages.add("Update invoice - Reference : " + updatedInvoice.getInvoices().get(0).getReference()); //Get All - Invoices invoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoices invoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); messages.add("Get all invoices - Total : " + invoices.getInvoices().size()); //Get Invoice If-Modified-Since OffsetDateTime invModified = OffsetDateTime.of(LocalDateTime.of(2018, 12, 06, 15, 00), ZoneOffset.UTC); - Invoices invoicesSince = accountingApi.getInvoices(xeroTenantId, invModified, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoices invoicesSince = accountingApi.getInvoices(invModified, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); messages.add("Get all invoices - Since Modfied Date - Total : " + invoicesSince.getInvoices().size()); // Get One - Invoices oneInvoice = accountingApi.getInvoice(xeroTenantId, invoices.getInvoices().get(0).getInvoiceID()); + Invoices oneInvoice = accountingApi.getInvoice(invoices.getInvoices().get(0).getInvoiceID()); messages.add("Get one invoice - total : " + oneInvoice.getInvoices().get(0).getTotal()); LocalDate myDate = oneInvoice.getInvoices().get(0).getDate(); OffsetDateTime myUTC = oneInvoice.getInvoices().get(0).getUpdatedDateUTC(); // Get Online Invoice - OnlineInvoices onlineInvoice = accountingApi.getOnlineInvoice(xeroTenantId, newInvoiceID); + OnlineInvoices onlineInvoice = accountingApi.getOnlineInvoice(newInvoiceID); messages.add("Get Online invoice - URL : " + onlineInvoice.getOnlineInvoices().get(0).getOnlineInvoiceUrl()); // Email Invoice RequestEmpty empty = new RequestEmpty(); - accountingApi.emailInvoice(xeroTenantId, newInvoiceID,empty); + accountingApi.emailInvoice(newInvoiceID,empty); messages.add("Email invoice - no content in response"); // Get Invoice History - HistoryRecords history = accountingApi.getInvoiceHistory(xeroTenantId, newInvoiceID); + HistoryRecords history = accountingApi.getInvoiceHistory(newInvoiceID); messages.add("History - count : " + history.getHistoryRecords().size() ); // Create Invoice History @@ -1212,27 +1254,27 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) HistoryRecord newHistoryRecord = new HistoryRecord(); newHistoryRecord.setDetails("Hello World"); newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createInvoiceHistory(xeroTenantId, newInvoiceID,newHistoryRecords); + HistoryRecords newHistory = accountingApi.createInvoiceHistory(newInvoiceID,newHistoryRecords); messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); // CREATE invoice attachment statuses = "AUTHORISED"; - Invoices myInvoices = accountingApi.getInvoices(xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoices myInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); File requestBodyFile = new File("/Users/sid.maestre/eclipse-workspace/xero-sdk-oauth2-dev-01/resources/youngsid.jpg"); String newFileName = requestBodyFile.getName(); - Attachments createdAttachments = accountingApi.createInvoiceAttachmentByFileName(xeroTenantId,invoiceID, newFileName, requestBodyFile); + Attachments createdAttachments = accountingApi.createInvoiceAttachmentByFileName(invoiceID, newFileName, requestBodyFile); messages.add("Attachment to Invoice complete - ID: " + createdAttachments.getAttachments().get(0).getAttachmentID()); // GET Invoice Attachment System.out.println(invoiceID); - Attachments attachments = accountingApi.getInvoiceAttachments(xeroTenantId,invoiceID); + Attachments attachments = accountingApi.getInvoiceAttachments(invoiceID); System.out.println(attachments.getAttachments().get(0).getFileName()); UUID attachementId = attachments.getAttachments().get(0).getAttachmentID(); String contentType = attachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream InvoiceAttachmentInput = accountingApi.getInvoiceAttachmentById(xeroTenantId,invoiceID,attachementId, contentType); + ByteArrayInputStream InvoiceAttachmentInput = accountingApi.getInvoiceAttachmentById(invoiceID,attachementId, contentType); String InvoiceAttachmentFileName = attachments.getAttachments().get(0).getFileName(); String InvoiceAttachmentSaveFilePath = saveFile(InvoiceAttachmentInput,InvoiceAttachmentFileName); @@ -1241,7 +1283,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } else if (object.equals("InvoiceReminders")) { // INVOICE REMINDER try { - InvoiceReminders invReminders = accountingApi.getInvoiceReminders(xeroTenantId); + InvoiceReminders invReminders = accountingApi.getInvoiceReminders(); messages.add("Get a Invoice Reminder - Is Enabled: " + invReminders.getInvoiceReminders().get(0).getEnabled() ); } catch (Exception e) { System.out.println(e.getMessage()); @@ -1256,26 +1298,26 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) myItem.setDescription("foobar"); myItem.setName("Hello"+loadRandomNum()); myItems.addItemsItem(myItem); - Items newItems = accountingApi.createItem(xeroTenantId, myItems); + Items newItems = accountingApi.createItem(myItems); messages.add("Create new item - Description : " + newItems.getItems().get(0).getDescription()); UUID newItemId = newItems.getItems().get(0).getItemID(); // Update Item newItems.getItems().get(0).setDescription("Barfoo"); - Items updateItem = accountingApi.updateItem(xeroTenantId, newItemId, newItems); + Items updateItem = accountingApi.updateItem(newItemId, newItems); messages.add("Update item - Description : " + updateItem.getItems().get(0).getDescription()); //Get All Items - Items items = accountingApi.getItems(xeroTenantId, ifModifiedSince, where, order, null); + Items items = accountingApi.getItems(ifModifiedSince, where, order, null); messages.add("Get all items - Total : " + items.getItems().size()); // Get One Item UUID itemId = items.getItems().get(0).getItemID(); - Items oneItem = accountingApi.getItem(xeroTenantId, itemId); + Items oneItem = accountingApi.getItem(itemId); messages.add("Get one item - Description : " + oneItem.getItems().get(0).getDescription()); // Get Invoice History - HistoryRecords history = accountingApi.getItemHistory(xeroTenantId, itemId); + HistoryRecords history = accountingApi.getItemHistory(itemId); messages.add("History - count : " + history.getHistoryRecords().size() ); // Create Invoice History @@ -1290,7 +1332,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) */ //Delete - accountingApi.deleteItem(xeroTenantId, newItemId); + accountingApi.deleteItem(newItemId); messages.add("Delete one item - no content in response"); } catch (Exception e) { System.out.println(e.getMessage()); @@ -1302,17 +1344,17 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) boolean paymentsOnly = false; // GET all Journals - Journals journals = accountingApi.getJournals(xeroTenantId, ifModifiedSince, null, paymentsOnly); + Journals journals = accountingApi.getJournals(ifModifiedSince, null, paymentsOnly); messages.add("Get Journals - total : " + journals.getJournals().size()); // GET Journal with offset - Journals journalsOffset = accountingApi.getJournals(xeroTenantId, ifModifiedSince, null, paymentsOnly); + Journals journalsOffset = accountingApi.getJournals(ifModifiedSince, null, paymentsOnly); messages.add("Get Journals offset - total : " + journalsOffset.getJournals().size()); // 404 ERROR /* // GET one Journal UUID journalId = journals.getJournals().get(0).getJournalID(); - Journals oneJournal = accountingApi.getJournal(xeroTenantId, journalId); + Journals oneJournal = accountingApi.getJournal(journalId); messages.add("Get one Journal - number : " + oneJournal.getJournals().get(0).getJournalNumber()); */ } catch (Exception e) { @@ -1324,10 +1366,10 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // Create Linked Transaction where = "Type==\"EXPENSE\""; - Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); where = null; - Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); Contact useContact = new Contact(); useContact.setContactID(contacts.getContacts().get(0).getContactID()); @@ -1353,7 +1395,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); newInvoices.addInvoicesItem(myInvoice); - Invoices newInvoice = accountingApi.createInvoice(xeroTenantId, newInvoices, summarizeErrors); + Invoices newInvoice = accountingApi.createInvoice(newInvoices, summarizeErrors); UUID sourceTransactionID1 = newInvoice.getInvoices().get(0).getInvoiceID(); UUID sourceLineItemID1 = newInvoice.getInvoices().get(0).getLineItems().get(0).getLineItemID(); @@ -1363,17 +1405,17 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) newLinkedTransaction.setSourceLineItemID(sourceLineItemID1); newLinkedTransactions.addLinkedTransactionsItem(newLinkedTransaction); - LinkedTransactions createdLinkedTransaction = accountingApi.createLinkedTransaction(xeroTenantId, newLinkedTransactions); + LinkedTransactions createdLinkedTransaction = accountingApi.createLinkedTransaction(newLinkedTransactions); messages.add("Create LinkedTransaction - Status : " + createdLinkedTransaction.getLinkedTransactions().get(0).getStatus()); // Created Linked Transaction 2 Contact contact = new Contact(); contact.setName("Foo" + loadRandomNum()); contact.setEmailAddress("sid" + loadRandomNum() + "@blah.com"); - Contacts newContact = accountingApi.createContact(xeroTenantId, contact); + Contacts newContact = accountingApi.createContact(contact); UUID newContactID = newContact.getContacts().get(0).getContactID(); - Invoices newInvoice2 = accountingApi.createInvoice(xeroTenantId, newInvoices, summarizeErrors); + Invoices newInvoice2 = accountingApi.createInvoice(newInvoices, summarizeErrors); UUID sourceTransactionID2 = newInvoice2.getInvoices().get(0).getInvoiceID(); UUID sourceLineItemID2 = newInvoice2.getInvoices().get(0).getLineItems().get(0).getLineItemID(); @@ -1384,7 +1426,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) newLinkedTransaction2.setContactID(newContactID); newLinkedTransactions2.addLinkedTransactionsItem(newLinkedTransaction2); - LinkedTransactions createdLinkedTransaction2 = accountingApi.createLinkedTransaction(xeroTenantId, newLinkedTransactions2); + LinkedTransactions createdLinkedTransaction2 = accountingApi.createLinkedTransaction(newLinkedTransactions2); messages.add("Create LinkedTransaction 2 - Status : " + createdLinkedTransaction2.getLinkedTransactions().get(0).getStatus()); // Created Linked Transaction 3 @@ -1401,11 +1443,11 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) myInvoiceAccRec.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); newInvoicesAccRec.addInvoicesItem(myInvoiceAccRec); - Invoices newInvoiceAccRec = accountingApi.createInvoice(xeroTenantId, newInvoicesAccRec, summarizeErrors); + Invoices newInvoiceAccRec = accountingApi.createInvoice(newInvoicesAccRec, summarizeErrors); UUID sourceTransactionID4 = newInvoiceAccRec.getInvoices().get(0).getInvoiceID(); UUID sourceLineItemID4 = newInvoiceAccRec.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - Invoices newInvoice3 = accountingApi.createInvoice(xeroTenantId, newInvoices, summarizeErrors); + Invoices newInvoice3 = accountingApi.createInvoice(newInvoices, summarizeErrors); UUID sourceTransactionID3 = newInvoice3.getInvoices().get(0).getInvoiceID(); UUID sourceLineItemID3 = newInvoice3.getInvoices().get(0).getLineItems().get(0).getLineItemID(); @@ -1418,7 +1460,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) newLinkedTransaction3.setTargetLineItemID(sourceLineItemID4); newLinkedTransactions3.addLinkedTransactionsItem(newLinkedTransaction3); - LinkedTransactions createdLinkedTransaction3 = accountingApi.createLinkedTransaction(xeroTenantId, newLinkedTransactions3); + LinkedTransactions createdLinkedTransaction3 = accountingApi.createLinkedTransaction(newLinkedTransactions3); messages.add("Create LinkedTransaction 3 - Status : " + createdLinkedTransaction3.getLinkedTransactions().get(0).getStatus()); // GET all Link Transactions @@ -1429,18 +1471,18 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) String targetTransactionID = null; String status = null; String contactID = null; - LinkedTransactions linkTransactions = accountingApi.getLinkedTransactions(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); + LinkedTransactions linkTransactions = accountingApi.getLinkedTransactions(page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); messages.add("Get Link Transactions - total : " + linkTransactions.getLinkedTransactions().size()); // GET all Link Transactions UUID linkedTransactionID2 = linkTransactions.getLinkedTransactions().get(0).getLinkedTransactionID(); - LinkedTransactions oneLinkTransaction = accountingApi.getLinkedTransaction(xeroTenantId, linkedTransactionID2); + LinkedTransactions oneLinkTransaction = accountingApi.getLinkedTransaction(linkedTransactionID2); messages.add("Get one Link Transaction - Status : " + oneLinkTransaction.getLinkedTransactions().get(0).getStatus()); // 500 Error /* // DELETE LINKEDTRANSACTION UUID newLinkedTransactionID = createdLinkedTransaction.getLinkedTransactions().get(0).getLinkedTransactionID(); - accountingApi.deleteLinkedTransaction(xeroTenantId, newLinkedTransactionID); + accountingApi.deleteLinkedTransaction(newLinkedTransactionID); messages.add("Delete LinkedTransaction - no content in response"); */ } catch (Exception e) { @@ -1452,7 +1494,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // Create Manual Journal where = "Type==\"EXPENSE\" && Status ==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); String accountCode = accounts.getAccounts().get(0).getCode(); where = null; ManualJournals manualJournals = new ManualJournals(); @@ -1473,17 +1515,17 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) debit.setLineAmount(-100.00); manualJournal.addJournalLinesItem(debit); manualJournals.addManualJournalsItem(manualJournal); - ManualJournals createdManualJournals = accountingApi.createManualJournal(xeroTenantId, manualJournals); + ManualJournals createdManualJournals = accountingApi.createManualJournal(manualJournals); UUID newManualJournalId = createdManualJournals.getManualJournals().get(0).getManualJournalID(); messages.add("Create Manual Journal - Narration : " + createdManualJournals.getManualJournals().get(0).getNarration()); // GET all Manual Journal - ManualJournals getManualJournals = accountingApi.getManualJournals(xeroTenantId, ifModifiedSince, where, order, null); + ManualJournals getManualJournals = accountingApi.getManualJournals(ifModifiedSince, where, order, null); messages.add("Get Manual Journal - total : " + getManualJournals.getManualJournals().size()); // GET one Manual Journal UUID manualJournalId = getManualJournals.getManualJournals().get(0).getManualJournalID(); - ManualJournals oneManualJournal = accountingApi.getManualJournal(xeroTenantId, manualJournalId); + ManualJournals oneManualJournal = accountingApi.getManualJournal(manualJournalId); messages.add("Get one Manual Journal - Narration : " + oneManualJournal.getManualJournals().get(0).getNarration()); // Update Manual Journal @@ -1492,7 +1534,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) updateManualJournal.setManualJournalID(newManualJournalId); updateManualJournal.setNarration("Hello Xero"); updateManualJournals.addManualJournalsItem(updateManualJournal); - ManualJournals updatedManualJournal = accountingApi.updateManualJournal(xeroTenantId, newManualJournalId,updateManualJournals); + ManualJournals updatedManualJournal = accountingApi.updateManualJournal(newManualJournalId,updateManualJournals); messages.add("Update Manual Journal - Narration : " + updatedManualJournal.getManualJournals().get(0).getNarration()); } catch (Exception e) { @@ -1502,27 +1544,30 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } else if (object.equals("Organisations")) { // Organisation try { - Organisations organisations = accountingApi.getOrganisations(xeroTenantId); + Organisations organisations = accountingApi.getOrganisations(); messages.add("Get a Organisation - Name : " + organisations.getOrganisations().get(0).getName()); } catch (Exception e) { + System.out.println("ERROR"); System.out.println(e.getMessage()); - } + } + + } else if (object.equals("Overpayments")) { // OVERPAYMENT where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); Account bankAccount = new Account(); bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); where = null; where = "SystemAccount==\"DEBTORS\""; - Accounts arAccounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts arAccounts = accountingApi.getAccounts(ifModifiedSince, where, order); Account arAccount = arAccounts.getAccounts().get(0); where = null; - Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); Contact useContact = new Contact(); useContact.setContactID(contacts.getContacts().get(0).getContactID()); @@ -1543,18 +1588,18 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_OVERPAYMENT); BankTransactions bts = new BankTransactions(); bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(xeroTenantId, bts, summarizeErrors); + BankTransactions newBankTransaction = accountingApi.createBankTransaction(bts, summarizeErrors); - Overpayments overpayments = accountingApi.getOverpayments(xeroTenantId, ifModifiedSince, where, order, null, null); + Overpayments overpayments = accountingApi.getOverpayments(ifModifiedSince, where, order, null, null); messages.add("Get a Overpayments - Count : " + overpayments.getOverpayments().size()); if(overpayments.getOverpayments().size() > 0) { UUID overpaymentId = overpayments.getOverpayments().get(2).getOverpaymentID(); - Overpayments oneOverpayment = accountingApi.getOverpayment(xeroTenantId, overpaymentId); + Overpayments oneOverpayment = accountingApi.getOverpayment(overpaymentId); messages.add("Get one Overpayment - Total : " + oneOverpayment.getOverpayments().get(0).getTotal()); where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoices allInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); Invoice inv = new Invoice(); inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); where = null; @@ -1567,11 +1612,11 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) allocation.setInvoice(inv); allocations.addAllocationsItem(allocation); - Allocations newAllocation = accountingApi.createOverpaymentAllocation(xeroTenantId, overpaymentId, allocations); + Allocations newAllocation = accountingApi.createOverpaymentAllocation(overpaymentId, allocations); messages.add("Create OverPayment allocation - Amt : " + newAllocation.getAllocations().get(0).getAmount()); // Get History - HistoryRecords history = accountingApi.getOverpaymentHistory(xeroTenantId, overpaymentId); + HistoryRecords history = accountingApi.getOverpaymentHistory(overpaymentId); messages.add("History - count : " + history.getHistoryRecords().size() ); // Create History @@ -1591,13 +1636,13 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) /* Payment */ // CREATE payment where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoices allInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); Invoice inv = new Invoice(); inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); where = null; where = "EnablePaymentsToAccount==true"; - Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); Account paymentAccount = new Account(); paymentAccount.setCode(accountsWhere.getAccounts().get(0).getCode()); where = null; @@ -1612,20 +1657,20 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) createPayment.setDate(currDate); createPayments.addPaymentsItem(createPayment); - Payments newPayments = accountingApi.createPayment(xeroTenantId, createPayments); + Payments newPayments = accountingApi.createPayment(createPayments); messages.add("Create Payments - Amt : " + newPayments.getPayments().get(0).getAmount()); // GET all Payments - Payments payments = accountingApi.getPayments(xeroTenantId, ifModifiedSince, where, order); + Payments payments = accountingApi.getPayments(ifModifiedSince, where, order); messages.add("Get Payments - Total : " + payments.getPayments().size()); // GET one Payment UUID paymentID = payments.getPayments().get(0).getPaymentID(); - Payments onePayment = accountingApi.getPayment(xeroTenantId, paymentID); + Payments onePayment = accountingApi.getPayment(paymentID); messages.add("Get Payments - Amount : " + onePayment.getPayments().get(0).getAmount()); // Get History - HistoryRecords allHistory = accountingApi.getPaymentHistory(xeroTenantId, paymentID); + HistoryRecords allHistory = accountingApi.getPaymentHistory(paymentID); messages.add("History - count : " + allHistory.getHistoryRecords().size() ); // Create History @@ -1647,11 +1692,11 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) newPaymentService.setPaymentServiceUrl("https://www.payupnow.com/"); newPaymentService.setPayNowText("Time To PayUp"); newPaymentServices.addPaymentServicesItem(newPaymentService); - PaymentServices createdPaymentService = accountingApi.createPaymentService(xeroTenantId, newPaymentServices); + PaymentServices createdPaymentService = accountingApi.createPaymentService(newPaymentServices); messages.add("Create PaymentServices - name : " + createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); // GET all Payments - PaymentServices paymentServices = accountingApi.getPaymentServices(xeroTenantId); + PaymentServices paymentServices = accountingApi.getPaymentServices(); messages.add("Get PaymentServices - Total : " + paymentServices.getPaymentServices().size()); } catch (Exception e) { System.out.println(e.getMessage()); @@ -1659,17 +1704,17 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } else if (object.equals("Prepayments")) { /* PREPAYMENT */ where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accountsWhere = accountingApi.getAccounts(ifModifiedSince, where, order); Account bankAccount = new Account(); bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); where = null; where = "Type==\"EXPENSE\""; - Accounts arAccounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts arAccounts = accountingApi.getAccounts(ifModifiedSince, where, order); Account arAccount = arAccounts.getAccounts().get(0); where = null; - Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); Contact useContact = new Contact(); useContact.setContactID(contacts.getContacts().get(0).getContactID()); @@ -1691,17 +1736,17 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_PREPAYMENT); BankTransactions bts = new BankTransactions(); bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(xeroTenantId, bts, summarizeErrors); + BankTransactions newBankTransaction = accountingApi.createBankTransaction(bts, summarizeErrors); where = "Status==\"AUTHORISED\" && TYPE==\"RECEIVE-PREPAYMENT\""; - Prepayments prepayments = accountingApi.getPrepayments(xeroTenantId, ifModifiedSince, where, order, null, null); + Prepayments prepayments = accountingApi.getPrepayments(ifModifiedSince, where, order, null, null); messages.add("Get a Prepayments - Count : " + prepayments.getPrepayments().size()); where = null; if(prepayments.getPrepayments().size() > 0) { UUID prepaymentId = prepayments.getPrepayments().get(0).getPrepaymentID(); - Prepayments onePrepayment = accountingApi.getPrepayment(xeroTenantId, prepaymentId); + Prepayments onePrepayment = accountingApi.getPrepayment(prepaymentId); messages.add("Get one Prepayment - Total : " + onePrepayment.getPrepayments().get(0).getTotal()); where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoices allInvoices = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); Invoice inv = new Invoice(); inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); where = null; @@ -1718,7 +1763,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) //messages.add("Create PrePayment allocation - Amt : " + newAllocation.getAllocations().get(0).getAmount()); // Get History - HistoryRecords history = accountingApi.getPrepaymentHistory(xeroTenantId, prepaymentId); + HistoryRecords history = accountingApi.getPrepaymentHistory(prepaymentId); messages.add("History - count : " + history.getHistoryRecords().size() ); // Create History @@ -1738,7 +1783,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { // CREATE Purchase Order where = "Type==\"EXPENSE\""; - Accounts arAccounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts arAccounts = accountingApi.getAccounts(ifModifiedSince, where, order); Account arAccount = arAccounts.getAccounts().get(0); where = null; @@ -1746,7 +1791,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) PurchaseOrder purchaseOrder = new PurchaseOrder(); LocalDate currDate = LocalDate.now(); purchaseOrder.setDate(currDate); - Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); Contact useContact = new Contact(); useContact.setContactID(contacts.getContacts().get(0).getContactID()); purchaseOrder.setContact(useContact); @@ -1760,34 +1805,34 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) lineItems.add(li); purchaseOrder.setLineItems(lineItems); purchaseOrders.addPurchaseOrdersItem(purchaseOrder); - PurchaseOrders createdPurchaseOrders = accountingApi.createPurchaseOrder(xeroTenantId, purchaseOrders, summarizeErrors); + PurchaseOrders createdPurchaseOrders = accountingApi.createPurchaseOrder(purchaseOrders, summarizeErrors); messages.add("Create Purchase order - total : " + createdPurchaseOrders.getPurchaseOrders().get(0).getTotal()); // UPDATE Purchase Orders UUID newPurchaseOrderID = createdPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); createdPurchaseOrders.getPurchaseOrders().get(0).setAttentionTo("Jimmy"); - PurchaseOrders updatePurchaseOrders = accountingApi.updatePurchaseOrder(xeroTenantId, newPurchaseOrderID, createdPurchaseOrders); + PurchaseOrders updatePurchaseOrders = accountingApi.updatePurchaseOrder(newPurchaseOrderID, createdPurchaseOrders); messages.add("Update Purchase order - attn : " + updatePurchaseOrders.getPurchaseOrders().get(0).getAttentionTo()); // GET Purchase Orders String status = null; String dateFrom = null; String dateTo = null; - PurchaseOrders allPurchaseOrders = accountingApi.getPurchaseOrders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, null); + PurchaseOrders allPurchaseOrders = accountingApi.getPurchaseOrders(ifModifiedSince, status, dateFrom, dateTo, order, null); messages.add("Get Purchase orders - Count : " + allPurchaseOrders.getPurchaseOrders().size()); // GET one Purchase Order UUID purchaseOrderID = allPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); - PurchaseOrders onePurchaseOrder = accountingApi.getPurchaseOrder(xeroTenantId, purchaseOrderID); + PurchaseOrders onePurchaseOrder = accountingApi.getPurchaseOrder(purchaseOrderID); messages.add("Get one Purchase order - Total : " + onePurchaseOrder.getPurchaseOrders().get(0).getTotal()); // DELETE Purchase Orders createdPurchaseOrders.getPurchaseOrders().get(0).setStatus(com.xero.models.accounting.PurchaseOrder.StatusEnum.DELETED); - PurchaseOrders deletePurchaseOrders = accountingApi.updatePurchaseOrder(xeroTenantId, newPurchaseOrderID, createdPurchaseOrders); + PurchaseOrders deletePurchaseOrders = accountingApi.updatePurchaseOrder(newPurchaseOrderID, createdPurchaseOrders); messages.add("Delete Purchase order - Status : " + deletePurchaseOrders.getPurchaseOrders().get(0).getStatus()); // Get History - HistoryRecords history = accountingApi.getInvoiceHistory(xeroTenantId, purchaseOrderID); + HistoryRecords history = accountingApi.getInvoiceHistory(purchaseOrderID); messages.add("History - count : " + history.getHistoryRecords().size() ); // Create History @@ -1795,7 +1840,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) HistoryRecord newHistoryRecord = new HistoryRecord(); newHistoryRecord.setDetails("Hello World"); newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID,newHistoryRecords); + HistoryRecords newHistory = accountingApi.createPurchaseOrderHistory(purchaseOrderID,newHistoryRecords); messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); } catch (Exception e) { @@ -1806,17 +1851,17 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { //Create // where = "IsSubscriber==true"; - Users users = accountingApi.getUsers(xeroTenantId, ifModifiedSince, where, order); + Users users = accountingApi.getUsers(ifModifiedSince, where, order); where = null; where = "ShowInExpenseClaims==true && Status==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); where = null; User useUser = new User(); useUser.setUserID(users.getUsers().get(0).getUserID()); - Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); Contact useContact = new Contact(); useContact.setContactID(contacts.getContacts().get(0).getContactID()); @@ -1838,26 +1883,26 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) receipt.contact(useContact); receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); receipts.addReceiptsItem(receipt); - Receipts newReceipts = accountingApi.createReceipt(xeroTenantId, receipts); + Receipts newReceipts = accountingApi.createReceipt(receipts); messages.add("Create Receipts - Total : " + newReceipts.getReceipts().get(0).getTotal()); // UPDATE Receipts UUID newReceiptId = newReceipts.getReceipts().get(0).getReceiptID(); newReceipts.getReceipts().get(0).setReference("Foobar"); - Receipts updateReceipts = accountingApi.updateReceipt(xeroTenantId, newReceiptId, newReceipts); + Receipts updateReceipts = accountingApi.updateReceipt(newReceiptId, newReceipts); messages.add("Create Receipts - Ref : " + updateReceipts.getReceipts().get(0).getReference()); // GET all Receipts - Receipts allReceipts = accountingApi.getReceipts(xeroTenantId, ifModifiedSince, where, order, null); + Receipts allReceipts = accountingApi.getReceipts(ifModifiedSince, where, order, null); messages.add("Create Receipts - Count : " + allReceipts.getReceipts().size()); // GET one Receipts UUID receiptID = allReceipts.getReceipts().get(0).getReceiptID(); - Receipts oneReceipts = accountingApi.getReceipt(xeroTenantId, receiptID); + Receipts oneReceipts = accountingApi.getReceipt(receiptID); messages.add("Create Receipts - Total : " + oneReceipts.getReceipts().get(0).getTotal()); // Get History - HistoryRecords history = accountingApi.getReceiptHistory(xeroTenantId, receiptID); + HistoryRecords history = accountingApi.getReceiptHistory(receiptID); messages.add("History - count : " + history.getHistoryRecords().size() ); // Create History @@ -1877,17 +1922,17 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) /* REPEATING INVOICE */ try { // GET all Repeating Invoices - RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(xeroTenantId, where, order); + RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(where, order); if ( repeatingInvoices.getRepeatingInvoices().size() > 0) { messages.add("Repeating Invoice - count : " + repeatingInvoices.getRepeatingInvoices().size() ); // GET one Repeating Invoices UUID repeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - RepeatingInvoices repeatingInvoice = accountingApi.getRepeatingInvoice(xeroTenantId, repeatingInvoiceID); + RepeatingInvoices repeatingInvoice = accountingApi.getRepeatingInvoice(repeatingInvoiceID); messages.add("Repeating Invoice - total : " + repeatingInvoice.getRepeatingInvoices().get(0).getTotal()); // Get History - HistoryRecords history = accountingApi.getRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID); + HistoryRecords history = accountingApi.getRepeatingInvoiceHistory(repeatingInvoiceID); messages.add("History - count : " + history.getHistoryRecords().size() ); // Create History @@ -1929,39 +1974,39 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) String trackingCategoryID2 = null; String trackingOptionID = null; - Contacts contacts = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts contacts = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); UUID contactId = contacts.getContacts().get(0).getContactID(); LocalDate xDate = LocalDate.now(); LocalDate xFromDate = LocalDate.now(); LocalDate xToDate = LocalDate.now(); - ReportWithRows reportAgedPayablesByContact = accountingApi.getReportAgedPayablesByContact(xeroTenantId, contactId, xDate, xFromDate, xToDate); + ReportWithRows reportAgedPayablesByContact = accountingApi.getReportAgedPayablesByContact(contactId, xDate, xFromDate, xToDate); messages.add("Get a Reports - Name:" + reportAgedPayablesByContact.getReports().get(0).getReportName()); // AgedReceivablesByContact - ReportWithRows reportAgedReceivablesByContact = accountingApi.getReportAgedReceivablesByContact(xeroTenantId, contactId, xDate, xFromDate, xToDate); + ReportWithRows reportAgedReceivablesByContact = accountingApi.getReportAgedReceivablesByContact(contactId, xDate, xFromDate, xToDate); messages.add("Get a Reports - Name:" + reportAgedReceivablesByContact.getReports().get(0).getReportName()); // reportBalanceSheet - ReportWithRows reportBalanceSheet = accountingApi.getReportBalanceSheet(xeroTenantId, toDate, 3, "MONTH", trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); + ReportWithRows reportBalanceSheet = accountingApi.getReportBalanceSheet(toDate, 3, "MONTH", trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); messages.add("Get a Reports - Name:" + reportBalanceSheet.getReports().get(0).getReportName()); // reportBankSummary - ReportWithRows reportBankSummary = accountingApi.getReportBankSummary(xeroTenantId, xToDate, null, null); + ReportWithRows reportBankSummary = accountingApi.getReportBankSummary(xToDate, null, null); messages.add("Get a Reports - Name:" + reportBankSummary.getReports().get(0).getReportName()); // reportBASorGSTlist - AU and NZ only - ReportWithRows reportTax = accountingApi.getReportBASorGSTList(xeroTenantId); + ReportWithRows reportTax = accountingApi.getReportBASorGSTList(); System.out.println(reportTax.toString()); // reportBudgetSummary int budgetPeriod = 1; int budgetTimeframe = 3; - ReportWithRows reportBudgetSummary = accountingApi.getReportBudgetSummary(xeroTenantId, xToDate, budgetPeriod, budgetTimeframe); + ReportWithRows reportBudgetSummary = accountingApi.getReportBudgetSummary(xToDate, budgetPeriod, budgetTimeframe); messages.add("Get a Reports - Name:" + reportBudgetSummary.getReports().get(0).getReportName()); // reportExecutiveSummary - ReportWithRows reportExecutiveSummary = accountingApi.getReportExecutiveSummary(xeroTenantId, xToDate); + ReportWithRows reportExecutiveSummary = accountingApi.getReportExecutiveSummary(xToDate); messages.add("Get a Reports - Name:" + reportExecutiveSummary.getReports().get(0).getReportName()); // reportProfitandLoss @@ -1970,52 +2015,52 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) profitLossTimeframe = "MONTH"; standardLayout = true; paymentsOnly = false; - ReportWithRows reportProfitLoss = accountingApi.getReportProfitAndLoss(xeroTenantId, xFromDate, xToDate, null, profitLossTimeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); + ReportWithRows reportProfitLoss = accountingApi.getReportProfitAndLoss(xFromDate, xToDate, null, profitLossTimeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); messages.add("Get a Reports - Name:" + reportProfitLoss.getReports().get(0).getReportName()); fromDate = null; toDate = null; // reportTrialBalance - ReportWithRows reportTrialBalance = accountingApi.getReportTrialBalance(xeroTenantId, xToDate, paymentsOnly); + ReportWithRows reportTrialBalance = accountingApi.getReportTrialBalance(xToDate, paymentsOnly); messages.add("Get a Reports - Name:" + reportTrialBalance.getReports().get(0).getReportName()); } else if (object.equals("TrackingCategories")) { // TRACKING CATEGORIES try { // GET Tracking Categories - TrackingCategories trackingCategories = accountingApi.getTrackingCategories(xeroTenantId, where, order, includeArchived); + TrackingCategories trackingCategories = accountingApi.getTrackingCategories(where, order, includeArchived); int count = trackingCategories.getTrackingCategories().size(); if (count == 2) { //DELETE Tracking Categories UUID trackingCategoryID = trackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); - TrackingCategories deletedTrackingCategories = accountingApi.deleteTrackingCategory(xeroTenantId, trackingCategoryID); + TrackingCategories deletedTrackingCategories = accountingApi.deleteTrackingCategory(trackingCategoryID); messages.add("DELETED tracking categories - status : " + deletedTrackingCategories.getTrackingCategories().get(0).getStatus()); } // CREATE Tracking Categories TrackingCategory newTrackingCategory = new TrackingCategory(); newTrackingCategory.setName("Foo"+ loadRandomNum()); - TrackingCategories createdTrackingCategories = accountingApi.createTrackingCategory(xeroTenantId, newTrackingCategory); + TrackingCategories createdTrackingCategories = accountingApi.createTrackingCategory(newTrackingCategory); messages.add("CREATED tracking categories - name : " + createdTrackingCategories.getTrackingCategories().get(0).getName()); // UPDATE Tracking Categories UUID newTrackingCategoryID = createdTrackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); newTrackingCategory.setName("Foo"+ loadRandomNum()); - TrackingCategories updatedTrackingCategories = accountingApi.updateTrackingCategory(xeroTenantId, newTrackingCategoryID,newTrackingCategory); + TrackingCategories updatedTrackingCategories = accountingApi.updateTrackingCategory(newTrackingCategoryID,newTrackingCategory); messages.add("UPDATED tracking categories - name : " + updatedTrackingCategories.getTrackingCategories().get(0).getName()); // GET one Tracking Categories if (count > 0) { UUID oneTrackingCategoryID = trackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); - TrackingCategories oneTrackingCategories = accountingApi.getTrackingCategory(xeroTenantId, oneTrackingCategoryID); + TrackingCategories oneTrackingCategories = accountingApi.getTrackingCategory(oneTrackingCategoryID); messages.add("GET ONE tracking categories - name : " + oneTrackingCategories.getTrackingCategories().get(0).getName()); // Create one Option TrackingOption option = new TrackingOption(); option.setName("Bar"+ loadRandomNum()); - TrackingOptions newTrackingOptions = accountingApi.createTrackingOptions(xeroTenantId, oneTrackingCategoryID,option); + TrackingOptions newTrackingOptions = accountingApi.createTrackingOptions(oneTrackingCategoryID,option); messages.add("CREATE option - name : " + newTrackingOptions.getOptions().get(0).getName()); // DELETE All options @@ -2041,22 +2086,22 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) newTaxRate.addTaxComponentsItem(rate01); newTaxRates.addTaxRatesItem(newTaxRate); - TaxRates createdTaxRate = accountingApi.createTaxRate(xeroTenantId, newTaxRates); + TaxRates createdTaxRate = accountingApi.createTaxRate(newTaxRates); messages.add("CREATE TaxRate - name : " + createdTaxRate.getTaxRates().get(0).getName()); // UDPATE Tax Rate newTaxRates.getTaxRates().get(0).setStatus(com.xero.models.accounting.TaxRate.StatusEnum.DELETED); - TaxRates updatedTaxRate = accountingApi.updateTaxRate(xeroTenantId, newTaxRates); + TaxRates updatedTaxRate = accountingApi.updateTaxRate(newTaxRates); messages.add("UPDATED TaxRate - status : " + updatedTaxRate.getTaxRates().get(0).getStatus()); // GET Tax Rate String taxType = null; - TaxRates taxRates = accountingApi.getTaxRates(xeroTenantId, where, order, taxType); + TaxRates taxRates = accountingApi.getTaxRates(where, order, taxType); messages.add("GET TaxRate - cnt : " + taxRates.getTaxRates().size()); // GET Tax Rate taxType = "CAPEXINPUT2"; - TaxRates taxRatesByType = accountingApi.getTaxRates(xeroTenantId, where, order, taxType); + TaxRates taxRatesByType = accountingApi.getTaxRates(where, order, taxType); messages.add("GET TaxRate by Cap Purchase Type : " + taxRatesByType.getTaxRates().size()); } catch (Exception e) { @@ -2066,12 +2111,12 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) // USER try { // GET Users - Users users = accountingApi.getUsers(xeroTenantId, ifModifiedSince, where, order); + Users users = accountingApi.getUsers(ifModifiedSince, where, order); messages.add("GET Users - cnt : " + users.getUsers().size()); //GET One User UUID userID = users.getUsers().get(0).getUserID(); - Users user = accountingApi.getUser(xeroTenantId, userID); + Users user = accountingApi.getUser(userID); messages.add("GET Users - First Name : " + user.getUsers().get(0).getFirstName()); } catch (Exception e) { System.out.println(e.getMessage()); diff --git a/src/main/java/com/xero/example/Authorization.java b/src/main/java/com/xero/example/Authorization.java index f7dea931..91cef123 100644 --- a/src/main/java/com/xero/example/Authorization.java +++ b/src/main/java/com/xero/example/Authorization.java @@ -1,7 +1,7 @@ package com.xero.example; import java.io.IOException; -import java.net.URLEncoder; +import java.util.ArrayList; import java.util.Random; import javax.servlet.ServletException; @@ -10,10 +10,15 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.github.scribejava.core.builder.ServiceBuilder; -import com.github.scribejava.core.oauth.OAuth20Service; -import com.xero.api.ApiClient; -import com.xero.api.XeroApi20; +import com.google.api.client.auth.oauth2.AuthorizationCodeFlow; +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.ClientParametersAuthentication; +import com.google.api.client.http.GenericUrl; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.json.JsonFactory; +import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.util.store.DataStoreFactory; +import com.google.api.client.util.store.MemoryDataStoreFactory; /** * Servlet implementation class Authorization @@ -33,26 +38,47 @@ public Authorization() { * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - TokenStorage store = new TokenStorage(); - final String clientId = "-your-clientid-"; - final String clientSecret = "-your-clientsecret-"; - final String redirectURI = "-your-redirecturi-"; + + final String clientId = "CEC496D0B24D4448A8F1D8B6A3F5C00E"; + final String clientSecret = "RyndE0-u_Drvu-jIwBNO4Hcsug-kCcQQgUQOB4AHTHpHl2z9"; + final String redirectURI = "http://localhost:8080/xero-sdk-oauth2-dev-01/Callback"; final String secretState = "secret" + new Random().nextInt(999_999); - // Configure OAuth2 access token for authorization: oAuth2AuthCode - final OAuth20Service service = new ServiceBuilder(clientId) - .apiSecret(clientSecret) - .defaultScope("openid email profile offline_access accounting.settings accounting.transactions accounting.contacts accounting.journals.read accounting.reports.read accounting.attachments paymentservices") // replace with desired scope - .callback(redirectURI) - .build(XeroApi20.instance()); - // Obtain the Authorization URL - final String authorizationUrl = service.createAuthorizationUrlBuilder() - .state(secretState) - .build(); - System.out.println(authorizationUrl); - response.sendRedirect(authorizationUrl); - + ArrayList scopeList = new ArrayList(); + scopeList.add("openid"); + scopeList.add("email"); + scopeList.add("profile"); + scopeList.add("offline_access"); + scopeList.add("accounting.settings"); + scopeList.add("accounting.transactions"); + scopeList.add("accounting.contacts"); + scopeList.add("accounting.journals.read"); + scopeList.add("accounting.reports.read"); + scopeList.add("accounting.attachments"); + scopeList.add("paymentservices"); + + final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport(); + final JsonFactory JSON_FACTORY = new JacksonFactory(); + final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; + final String AUTHORIZATION_SERVER_URL = "https://login.xero.com/identity/connect/authorize"; + + DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory(); + AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(), + HTTP_TRANSPORT, + JSON_FACTORY, + new GenericUrl(TOKEN_SERVER_URL), + new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL) + .setScopes(scopeList) + .setDataStoreFactory(DATA_STORE_FACTORY) + .build(); + + String url = flow.newAuthorizationUrl() + .setClientId(clientId) + .setScopes(scopeList) + .setState(secretState) + .setRedirectUri(redirectURI).build(); + + response.sendRedirect(url); } /** @@ -62,5 +88,4 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) // TODO Auto-generated method stub doGet(request, response); } - } diff --git a/src/main/java/com/xero/example/Callback.java b/src/main/java/com/xero/example/Callback.java index aec66e5f..2e6acf3e 100644 --- a/src/main/java/com/xero/example/Callback.java +++ b/src/main/java/com/xero/example/Callback.java @@ -1,9 +1,8 @@ package com.xero.example; import java.io.IOException; -import java.io.PrintWriter; -import java.util.Random; -import java.util.concurrent.ExecutionException; +import java.util.ArrayList; +import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; @@ -11,19 +10,22 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; - -import com.github.scribejava.core.builder.ServiceBuilder; -import com.github.scribejava.core.model.OAuth2AccessToken; -import com.github.scribejava.core.model.OAuthRequest; -import com.github.scribejava.core.model.Response; -import com.github.scribejava.core.model.Verb; -import com.github.scribejava.core.oauth.OAuth20Service; -import com.xero.api.XeroApi20; - +import com.google.api.client.auth.oauth2.AuthorizationCodeFlow; +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.ClientParametersAuthentication; +import com.google.api.client.auth.oauth2.TokenResponse; +import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; +import com.google.api.client.http.GenericUrl; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.json.JsonFactory; +import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.util.store.DataStoreFactory; +import com.google.api.client.util.store.MemoryDataStoreFactory; +import com.xero.api.ApiClient; +import com.xero.api.client.IdentityApi; +import com.xero.models.identity.Connection; /** * Servlet implementation class Callback @@ -37,73 +39,69 @@ public class Callback extends HttpServlet { */ public Callback() { super(); - // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - final String clientId = "-your-clientid-"; - final String clientSecret = "-your-clientsecret-"; - final String redirectURI = "-your-redirecturi-"; - final OAuth20Service service = new ServiceBuilder(clientId) - .apiSecret(clientSecret) - .defaultScope("openid email profile offline_access accounting.settings accounting.transactions") // replace with desired scope - .callback(redirectURI) - .build(XeroApi20.instance()); - - - PrintWriter respWriter = response.getWriter(); - response.setStatus(200); - response.setContentType("text/html"); - respWriter.println("

Let's make API calls
"); - String code = "123"; if (request.getParameter("code") != null) { code = request.getParameter("code"); } - - - OAuth2AccessToken accessToken; - try { - accessToken = service.getAccessToken(code); - TokenStorage store = new TokenStorage(); - store.saveItem(response, "access_token", accessToken.getAccessToken()); - store.saveItem(response, "refresh_token", accessToken.getRefreshToken()); + final String clientId = "CEC496D0B24D4448A8F1D8B6A3F5C00E"; + final String clientSecret = "RyndE0-u_Drvu-jIwBNO4Hcsug-kCcQQgUQOB4AHTHpHl2z9"; + final String redirectURI = "http://localhost:8080/xero-sdk-oauth2-dev-01/Callback"; + + ArrayList scopeList = new ArrayList(); + scopeList.add("openid"); + scopeList.add("email"); + scopeList.add("profile"); + scopeList.add("offline_access"); + scopeList.add("accounting.settings"); + scopeList.add("accounting.transactions"); + scopeList.add("accounting.contacts"); + scopeList.add("accounting.journals.read"); + scopeList.add("accounting.reports.read"); + scopeList.add("accounting.attachments"); + scopeList.add("paymentservices"); + + final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport(); + final JsonFactory JSON_FACTORY = new JacksonFactory(); + final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; + final String AUTHORIZATION_SERVER_URL = "https://login.xero.com/identity/connect/authorize"; + DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory(); + + AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(), + HTTP_TRANSPORT, + JSON_FACTORY, + new GenericUrl(TOKEN_SERVER_URL), + new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL).setScopes(scopeList).setDataStoreFactory(DATA_STORE_FACTORY).build(); + TokenResponse accessToken = flow.newTokenRequest(code).setRedirectUri(redirectURI).execute(); + + HttpTransport httpTransport = new NetHttpTransport(); + JsonFactory jsonFactory = new JacksonFactory(); + GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory).setClientSecrets(clientId, clientSecret).build(); + credential.setAccessToken(accessToken.getAccessToken()); + credential.setRefreshToken(accessToken.getRefreshToken()); + credential.setExpiresInSeconds(accessToken.getExpiresInSeconds()); + + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - // REFRESH BITS - //accessToken = service.refreshAccessToken(accessToken.getRefreshToken()); - //store.saveItem(response, "access_token", accessToken.getAccessToken()); - - // GET CONNECTIONS - String requestUrl = "https://api.xero.com/connections"; - final OAuthRequest requestConn = new OAuthRequest(Verb.GET, requestUrl); - requestConn.addHeader("Accept", "application/json"); - service.signRequest(accessToken.getAccessToken(), requestConn); - final Response responseConn = service.execute(requestConn); - - JSONParser parser = new JSONParser(); - JSONArray jsonArray = (JSONArray) parser.parse(responseConn.getBody()); - JSONObject jsonObject = (JSONObject) jsonArray.get(0); - System.out.println(jsonObject.get("tenantId")); - store.saveItem(response, "tenant_id", jsonObject.get("tenantId").toString()); - - response.sendRedirect("./AuthenticatedResource"); + // Init IdentityApi client + ApiClient defaultClient = new ApiClient(null,null,null,null,requestFactory); + IdentityApi idApi = new IdentityApi(defaultClient); + List connection = idApi.getConnections(); - } catch (InterruptedException | ExecutionException | ParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } + TokenStorage store = new TokenStorage(); + store.saveItem(response, "access_token", accessToken.getAccessToken()); + store.saveItem(response, "refresh_token", accessToken.getRefreshToken()); + store.saveItem(response, "expires_in_seconds", accessToken.getExpiresInSeconds().toString()); + store.saveItem(response, "xero_tenant_id", connection.get(0).getTenantId().toString()); - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - doGet(request, response); + response.sendRedirect("./AuthenticatedResource"); } - } diff --git a/src/main/java/com/xero/example/RefreshCredential.java b/src/main/java/com/xero/example/RefreshCredential.java new file mode 100644 index 00000000..479b5c24 --- /dev/null +++ b/src/main/java/com/xero/example/RefreshCredential.java @@ -0,0 +1,54 @@ +package com.xero.example; + +import java.io.IOException; + +import javax.servlet.http.HttpServletResponse; + +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.auth.oauth2.CredentialRefreshListener; +import com.google.api.client.auth.oauth2.TokenErrorResponse; +import com.google.api.client.auth.oauth2.TokenResponse; +import com.google.api.client.http.HttpResponse; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.json.JsonFactory; +import com.google.api.client.json.jackson2.JacksonFactory; +import com.xero.api.XeroCredential; +import com.xero.api.XeroCredential.Builder; + +public class RefreshCredential { + + final static HttpTransport httpTransport = new NetHttpTransport(); + final static JsonFactory jsonFactory = new JacksonFactory(); + + public RefreshCredential() + { + super(); + } + + public static Builder createRefreshCredential(HttpServletResponse resp, String clientId, String clientSecret) { + Builder credentials; + final HttpServletResponse response = resp; + credentials = new XeroCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory) + .setClientSecrets(clientId, clientSecret) + .addRefreshListener(new CredentialRefreshListener() { + + @Override + public void onTokenResponse(Credential credential, TokenResponse tokenResponse) throws IOException { + System.out.println("Token Refresh success"); + TokenStorage store = new TokenStorage(); + store.saveItem(response, "access_token", tokenResponse.getAccessToken()); + store.saveItem(response, "refresh_token", tokenResponse.getRefreshToken()); + store.saveItem(response, "expires_in_seconds", tokenResponse.getExpiresInSeconds().toString()); + } + + @Override + public void onTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse) + throws IOException { + System.out.println("Error Response"); + } + }); + return credentials; + } + +} diff --git a/src/main/java/com/xero/models/identity/AccessToken.java b/src/main/java/com/xero/models/identity/AccessToken.java new file mode 100644 index 00000000..30900e6d --- /dev/null +++ b/src/main/java/com/xero/models/identity/AccessToken.java @@ -0,0 +1,190 @@ +/* + * Xero oAuth 2 identity service + * This specifing endpoints related to managing authentication tokens and identity for Xero API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.identity; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * AccessToken + */ + +public class AccessToken { + + @JsonProperty("id_token") + private String idToken; + + + @JsonProperty("access_token") + private String accessToken; + + + @JsonProperty("expires_in") + private BigDecimal expiresIn; + + + @JsonProperty("token_type") + private String tokenType; + + + @JsonProperty("refresh_token") + private String refreshToken; + + public AccessToken idToken(String idToken) { + this.idToken = idToken; + return this; + } + + /** + * Xero unique identifier + * @return idToken + **/ + @ApiModelProperty(value = "Xero unique identifier") + public String getIdToken() { + return idToken; + } + + public void setIdToken(String idToken) { + this.idToken = idToken; + } + + public AccessToken accessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * access token provided during authentication flow + * @return accessToken + **/ + @ApiModelProperty(value = "access token provided during authentication flow") + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public AccessToken expiresIn(BigDecimal expiresIn) { + this.expiresIn = expiresIn; + return this; + } + + /** + * time in milliseconds until access token expires. + * @return expiresIn + **/ + @ApiModelProperty(value = "time in milliseconds until access token expires.") + public BigDecimal getExpiresIn() { + return expiresIn; + } + + public void setExpiresIn(BigDecimal expiresIn) { + this.expiresIn = expiresIn; + } + + public AccessToken tokenType(String tokenType) { + this.tokenType = tokenType; + return this; + } + + /** + * type of token i.e. Bearer + * @return tokenType + **/ + @ApiModelProperty(value = "type of token i.e. Bearer") + public String getTokenType() { + return tokenType; + } + + public void setTokenType(String tokenType) { + this.tokenType = tokenType; + } + + public AccessToken refreshToken(String refreshToken) { + this.refreshToken = refreshToken; + return this; + } + + /** + * token used to refresh an expired access token + * @return refreshToken + **/ + @ApiModelProperty(value = "token used to refresh an expired access token") + public String getRefreshToken() { + return refreshToken; + } + + public void setRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccessToken accessToken = (AccessToken) o; + return Objects.equals(this.idToken, accessToken.idToken) && + Objects.equals(this.accessToken, accessToken.accessToken) && + Objects.equals(this.expiresIn, accessToken.expiresIn) && + Objects.equals(this.tokenType, accessToken.tokenType) && + Objects.equals(this.refreshToken, accessToken.refreshToken); + } + + @Override + public int hashCode() { + return Objects.hash(idToken, accessToken, expiresIn, tokenType, refreshToken); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccessToken {\n"); + sb.append(" idToken: ").append(toIndentedString(idToken)).append("\n"); + sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); + sb.append(" expiresIn: ").append(toIndentedString(expiresIn)).append("\n"); + sb.append(" tokenType: ").append(toIndentedString(tokenType)).append("\n"); + sb.append(" refreshToken: ").append(toIndentedString(refreshToken)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/identity/Connection.java b/src/main/java/com/xero/models/identity/Connection.java new file mode 100644 index 00000000..be3aa46d --- /dev/null +++ b/src/main/java/com/xero/models/identity/Connection.java @@ -0,0 +1,142 @@ +/* + * Xero oAuth 2 identity service + * This specifing endpoints related to managing authentication tokens and identity for Xero API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.identity; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Connection + */ + +public class Connection { + + @JsonProperty("id") + private UUID id; + + + @JsonProperty("tenantId") + private UUID tenantId; + + + @JsonProperty("tenantType") + private String tenantType; + + public Connection id(UUID id) { + this.id = id; + return this; + } + + /** + * Xero identifier + * @return id + **/ + @ApiModelProperty(value = "Xero identifier") + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public Connection tenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Xero identifier of organisation + * @return tenantId + **/ + @ApiModelProperty(value = "Xero identifier of organisation") + public UUID getTenantId() { + return tenantId; + } + + public void setTenantId(UUID tenantId) { + this.tenantId = tenantId; + } + + public Connection tenantType(String tenantType) { + this.tenantType = tenantType; + return this; + } + + /** + * Xero tenant type (i.e. ORGANISATION, PRACTICE) + * @return tenantType + **/ + @ApiModelProperty(value = "Xero tenant type (i.e. ORGANISATION, PRACTICE)") + public String getTenantType() { + return tenantType; + } + + public void setTenantType(String tenantType) { + this.tenantType = tenantType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Connection connection = (Connection) o; + return Objects.equals(this.id, connection.id) && + Objects.equals(this.tenantId, connection.tenantId) && + Objects.equals(this.tenantType, connection.tenantType); + } + + @Override + public int hashCode() { + return Objects.hash(id, tenantId, tenantType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Connection {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" tenantId: ").append(toIndentedString(tenantId)).append("\n"); + sb.append(" tenantType: ").append(toIndentedString(tenantType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/identity/RefreshToken.java b/src/main/java/com/xero/models/identity/RefreshToken.java new file mode 100644 index 00000000..98b8b51d --- /dev/null +++ b/src/main/java/com/xero/models/identity/RefreshToken.java @@ -0,0 +1,165 @@ +/* + * Xero oAuth 2 identity service + * This specifing endpoints related to managing authentication tokens and identity for Xero API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.identity; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * RefreshToken + */ + +public class RefreshToken { + + @JsonProperty("grant_type") + private String grantType; + + + @JsonProperty("refresh_token") + private String refreshToken; + + + @JsonProperty("client_id") + private String clientId; + + + @JsonProperty("client_secret") + private String clientSecret; + + public RefreshToken grantType(String grantType) { + this.grantType = grantType; + return this; + } + + /** + * Xero grant type + * @return grantType + **/ + @ApiModelProperty(value = "Xero grant type") + public String getGrantType() { + return grantType; + } + + public void setGrantType(String grantType) { + this.grantType = grantType; + } + + public RefreshToken refreshToken(String refreshToken) { + this.refreshToken = refreshToken; + return this; + } + + /** + * refresh token provided during authentication flow + * @return refreshToken + **/ + @ApiModelProperty(value = "refresh token provided during authentication flow") + public String getRefreshToken() { + return refreshToken; + } + + public void setRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + } + + public RefreshToken clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * client id for Xero app + * @return clientId + **/ + @ApiModelProperty(value = "client id for Xero app") + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public RefreshToken clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * client secret for Xero app 2 + * @return clientSecret + **/ + @ApiModelProperty(value = "client secret for Xero app 2") + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefreshToken refreshToken = (RefreshToken) o; + return Objects.equals(this.grantType, refreshToken.grantType) && + Objects.equals(this.refreshToken, refreshToken.refreshToken) && + Objects.equals(this.clientId, refreshToken.clientId) && + Objects.equals(this.clientSecret, refreshToken.clientSecret); + } + + @Override + public int hashCode() { + return Objects.hash(grantType, refreshToken, clientId, clientSecret); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefreshToken {\n"); + sb.append(" grantType: ").append(toIndentedString(grantType)).append("\n"); + sb.append(" refreshToken: ").append(toIndentedString(refreshToken)).append("\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n"); + sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java index 9fccf38e..40670ec4 100644 --- a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java @@ -44,7 +44,7 @@ public class AccountingApiAccountsTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -70,7 +70,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -88,11 +88,11 @@ public void tearDown() { public void testGetAccounts() throws Exception { System.out.println("@Test - getAccounts"); - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + OffsetDateTime ifModifiedSince = null; String where = null; String order = null; - Accounts accounts = accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order); + Accounts accounts = accountingApi.getAccounts(ifModifiedSince, where, order); assert(accounts.getAccounts().size() == 2); assertThat(accounts.getAccounts().get(0).getCode(), is(equalTo("091"))); assertThat(accounts.getAccounts().get(0).getName(), is(equalTo("Business Savings Account"))); @@ -107,10 +107,10 @@ public void testGetAccounts() throws Exception { @Test public void testGetAccount() throws Exception { System.out.println("@Test - getAccount"); - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - Accounts oneAccount = accountingApi.getAccount(xeroTenantId,accountID); + Accounts oneAccount = accountingApi.getAccount(accountID); assertThat(oneAccount.getAccounts().get(0).getName(), is(equalTo("FooBar"))); assertThat(oneAccount.getAccounts().get(0).getCode(), is(equalTo("123456"))); } @@ -119,7 +119,7 @@ public void testGetAccount() throws Exception { public void testCreateAccount() throws Exception { System.out.println("@Test - createAccount"); Account acct = new Account(); - Accounts newAccount = accountingApi.createAccount(xeroTenantId,acct); + Accounts newAccount = accountingApi.createAccount(acct); assertThat(newAccount.getAccounts().get(0).getName(), is(equalTo("Foobar"))); } @@ -128,7 +128,7 @@ public void testUpdateAccount() throws Exception { System.out.println("@Test - updateAccount"); UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); Accounts accts = new Accounts(); - Accounts updatedAccount = accountingApi.updateAccount(xeroTenantId,accountID, accts); + Accounts updatedAccount = accountingApi.updateAccount(accountID, accts); assertThat(updatedAccount.getAccounts().get(0).getName(), is(equalTo("BarFoo"))); } @@ -136,7 +136,7 @@ public void testUpdateAccount() throws Exception { public void testDeleteAccount() throws Exception { System.out.println("@Test - deleteAccount"); UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - Accounts deleteAccount = accountingApi.deleteAccount(xeroTenantId,accountID); + Accounts deleteAccount = accountingApi.deleteAccount(accountID); assertThat(deleteAccount.getAccounts().get(0).getStatus().toString(), is(equalTo("DELETED"))); } @@ -144,7 +144,7 @@ public void testDeleteAccount() throws Exception { public void testGetAccountAttachments() throws Exception { System.out.println("@Test - getAccountAttachments"); UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - Attachments accountsAttachments = accountingApi.getAccountAttachments(xeroTenantId,accountID); + Attachments accountsAttachments = accountingApi.getAccountAttachments(accountID); assertThat(accountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("52a643be-cd5c-489f-9778-53a9fd337756"))); assertThat(accountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); assertThat(accountsAttachments.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); @@ -163,7 +163,7 @@ public void testCreateAccountAttachmentByFileName() throws Exception { File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); String newFileName = "sample5.jpg"; - Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(xeroTenantId,accountID, newFileName, bytes); + Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(accountID, newFileName, bytes); assertThat(createAccountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("ab95b276-9dce-4925-9077-439818ba270f"))); assertThat(createAccountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); @@ -181,7 +181,7 @@ public void testUpdateAccountAttachmentByFileName() throws Exception { File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); String newFileName = "sample.jpg"; - Attachments createAccountsAttachments = accountingApi.updateAccountAttachmentByFileName(xeroTenantId, accountID, newFileName, bytes); + Attachments createAccountsAttachments = accountingApi.updateAccountAttachmentByFileName(accountID, newFileName, bytes); assertThat(createAccountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("3fa85f64-5717-4562-b3fc-2c963f66afa6"))); assertThat(createAccountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java index fbb4c772..720e1471 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java @@ -44,7 +44,7 @@ public class AccountingApiBankTransactionTest { ApiClient defaultClient; AccountingApi api; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -69,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -91,7 +91,7 @@ public void testGetBankTransactions() throws Exception { String order = null; Integer page = null; Integer unitdp = null; - BankTransactions response = api.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + BankTransactions response = api.getBankTransactions(ifModifiedSince, where, order, page, unitdp); assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("db54aab0-ad40-4ced-bcff-0940ba20db2c")))); assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); assertThat(response.getBankTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE))); @@ -107,7 +107,7 @@ public void testGetBankTransactions() throws Exception { public void testGetBankTransaction() throws Exception { System.out.println("@Test - getBankTransaction"); UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - BankTransactions response = api.getBankTransaction(xeroTenantId, bankTransactionID); + BankTransactions response = api.getBankTransaction(bankTransactionID); assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("db54aab0-ad40-4ced-bcff-0940ba20db2c")))); assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); assertThat(response.getBankTransactions().get(0).getType(), is(equalTo(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE))); @@ -123,7 +123,7 @@ public void testUpdateBankTransaction() throws Exception { System.out.println("@Test - updateBankTransaction"); UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); BankTransactions newBankTransactions = new BankTransactions(); - BankTransactions response = api.updateBankTransaction(xeroTenantId, bankTransactionID,newBankTransactions); + BankTransactions response = api.updateBankTransaction(bankTransactionID,newBankTransactions); assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("1289c190-e46d-434b-9628-463ffdb52f00")))); assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); @@ -139,7 +139,7 @@ public void testUpdateBankTransaction() throws Exception { public void testCreateBankTransaction() throws Exception { System.out.println("@Test - createBankTransaction"); BankTransactions newBankTransactions = new BankTransactions(); - BankTransactions response = api.createBankTransaction(xeroTenantId, newBankTransactions,null); + BankTransactions response = api.createBankTransaction(newBankTransactions,null); assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("1289c190-e46d-434b-9628-463ffdb52f00")))); assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); @@ -160,7 +160,7 @@ public void createBankTransactionAttachmentByFileNameTest() throws IOException { File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); String fileName = "sample5.jpg"; - Attachments response = api.createBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, bytes); + Attachments response = api.createBankTransactionAttachmentByFileName(bankTransactionID, fileName, bytes); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b")))); assertThat(response.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); assertThat(response.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); @@ -173,7 +173,7 @@ public void createBankTransactionAttachmentByFileNameTest() throws IOException { public void getBankTransactionAttachmentsTest() throws IOException { System.out.println("@Test - getBankTransactionAttachmentsTest"); UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - Attachments response = api.getBankTransactionAttachments(xeroTenantId, bankTransactionID); + Attachments response = api.getBankTransactionAttachments(bankTransactionID); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); @@ -191,7 +191,7 @@ public void updateBankTransactionAttachmentByFileNameTest() throws IOException { File bytes = new File(classLoade2.getResource("helo-heros2.jpg").getFile()); String fileName = "sample2.jpg"; - Attachments response = api.updateBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, bytes); + Attachments response = api.updateBankTransactionAttachmentByFileName(bankTransactionID, fileName, bytes); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b")))); assertThat(response.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); assertThat(response.getAttachments().get(0).getMimeType().toString(), is(equalTo("image/jpg"))); @@ -203,7 +203,7 @@ public void updateBankTransactionAttachmentByFileNameTest() throws IOException { public void testGetBankTransactionsHistory() throws Exception { System.out.println("@Test - getBankTransactionsHistory"); UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - HistoryRecords hr = api.getBankTransactionsHistory(xeroTenantId, bankTransactionID); + HistoryRecords hr = api.getBankTransactionsHistory(bankTransactionID); assertThat(hr.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); assertThat(hr.getHistoryRecords().get(0).getChanges(), is(equalTo("Attached a file"))); //System.out.println(hr.getHistoryRecords().toString()); diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java index e30a2d83..0ebbab82 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java @@ -43,7 +43,7 @@ public class AccountingApiBankTransferTest { ApiClient defaultClient; AccountingApi api; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File bytes; private static boolean setUpIsDone = false; @@ -72,7 +72,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -93,7 +93,7 @@ public void getBankTransfersTest() throws Exception { String where = null; String order = null; - BankTransfers response = api.getBankTransfers(xeroTenantId,ifModifiedSince, where, order); + BankTransfers response = api.getBankTransfers(ifModifiedSince, where, order); assertThat(response.getBankTransfers().get(0).getBankTransferID(), is(equalTo(UUID.fromString("6221458a-ef7a-4d5f-9b1c-1b96ce03833c")))); assertThat(response.getBankTransfers().get(0).getFromBankTransactionID(), is(equalTo(UUID.fromString("a3eca480-bc04-4292-9bbd-5c57b8ba12b4")))); assertThat(response.getBankTransfers().get(0).getToBankTransactionID(), is(equalTo(UUID.fromString("4ca13f40-f3a0-4530-a442-a600f5696118")))); @@ -109,7 +109,7 @@ public void getBankTransferTest() throws IOException { System.out.println("@Test - getBankTransfer"); UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - BankTransfers response = api.getBankTransfer(xeroTenantId,bankTransferID); + BankTransfers response = api.getBankTransfer(bankTransferID); assertThat(response.getBankTransfers().get(0).getBankTransferID(), is(equalTo(UUID.fromString("6221458a-ef7a-4d5f-9b1c-1b96ce03833c")))); assertThat(response.getBankTransfers().get(0).getFromBankTransactionID(), is(equalTo(UUID.fromString("a3eca480-bc04-4292-9bbd-5c57b8ba12b4")))); assertThat(response.getBankTransfers().get(0).getToBankTransactionID(), is(equalTo(UUID.fromString("4ca13f40-f3a0-4530-a442-a600f5696118")))); @@ -125,7 +125,7 @@ public void createBankTransferTest() throws IOException { System.out.println("@Test - createBankTransfer"); BankTransfers bankTransfers = new BankTransfers(); - BankTransfers response = api.createBankTransfer(xeroTenantId,bankTransfers); + BankTransfers response = api.createBankTransfer(bankTransfers); assertThat(response.getBankTransfers().get(0).getBankTransferID(), is(equalTo(UUID.fromString("76eea4b6-f026-464c-b6f3-5fb39a196145")))); assertThat(response.getBankTransfers().get(0).getFromBankTransactionID(), is(equalTo(UUID.fromString("e4059952-5acb-4a56-b076-53fad85f2930")))); assertThat(response.getBankTransfers().get(0).getToBankAccount().getName(), is(equalTo("Business Wells Fargo"))); @@ -139,7 +139,7 @@ public void getBankTransferHistoryTest() throws IOException { System.out.println("@Test - getBankTransferHistoryTest"); UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - HistoryRecords response = api.getBankTransferHistory(xeroTenantId,bankTransferID); + HistoryRecords response = api.getBankTransferHistory(bankTransferID); assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Attached a file"))); assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Attached the file sample2.jpg through the Xero API using Xero API Partner"))); @@ -162,7 +162,7 @@ public void createBankTransferAttachmentByFileNameTest() throws IOException { UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); String fileName = "sample5.jpg"; - Attachments response = api.createBankTransferAttachmentByFileName(xeroTenantId,bankTransferID, fileName, bytes); + Attachments response = api.createBankTransferAttachmentByFileName(bankTransferID, fileName, bytes); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("9478be4c-c707-48c1-b4a7-83d8eaf442b5")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); @@ -175,7 +175,7 @@ public void getBankTransferAttachmentsTest() throws IOException { System.out.println("@Test - getBankTransferAttachmentsTest"); UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - Attachments response = api.getBankTransferAttachments(xeroTenantId,bankTransferID); + Attachments response = api.getBankTransferAttachments(bankTransferID); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("e05a6fd8-0e47-47a9-9799-b809c8267260")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); @@ -190,7 +190,7 @@ public void updateBankTransferAttachmentByFileNameTest() throws IOException { UUID bankTransferID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); String fileName = "sample5.jpg"; - Attachments response = api.updateBankTransferAttachmentByFileName(xeroTenantId,bankTransferID, fileName, bytes); + Attachments response = api.updateBankTransferAttachmentByFileName(bankTransferID, fileName, bytes); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("0851935c-c4c5-4de8-9247-ce22efde6f82")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java index 40cf6b23..beda8f9b 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java @@ -40,7 +40,7 @@ public class AccountingApiBatchPaymentTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File bytes; private static boolean setUpIsDone = false; @@ -69,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -88,7 +88,7 @@ public void testGetBatchPayment() throws Exception { OffsetDateTime ifModifiedSince = null; String where = null; String order = null; - BatchPayments batchPayments = accountingApi.getBatchPayments(xeroTenantId,ifModifiedSince, where, order); + BatchPayments batchPayments = accountingApi.getBatchPayments(ifModifiedSince, where, order); assertThat(batchPayments.getBatchPayments().get(0).getBatchPaymentID().toString(), is(equalTo("d0e9bbbf-5b8a-48b6-906a-035591fcb061"))); assertThat(batchPayments.getBatchPayments().get(0).getReference(), is(equalTo("Hello World"))); //System.out.println(batchPayments.getBatchPayments().toString()); @@ -101,7 +101,7 @@ public void testCreateBatchPayment() throws Exception { BatchPayments createBatchPayments = new BatchPayments(); BatchPayment createBatchPayment = new BatchPayment(); createBatchPayments.addBatchPaymentsItem(createBatchPayment); - BatchPayments newBatchPayments = accountingApi.createBatchPayment(xeroTenantId,createBatchPayments); + BatchPayments newBatchPayments = accountingApi.createBatchPayment(createBatchPayments); assertThat(newBatchPayments.getBatchPayments().get(0).getBatchPaymentID().toString(), is(equalTo("d318c343-208e-49fe-b04a-45642349bcf1"))); assertThat(newBatchPayments.getBatchPayments().get(0).getReference(), is(equalTo("Foobar123"))); //System.out.println(newBatchPayments.getBatchPayments().toString()); @@ -112,7 +112,7 @@ public void testGetBatchPaymentsHistory() throws Exception { System.out.println("@Test - getBatchPaymentHistory"); UUID batchPaymentID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - HistoryRecords hr = accountingApi.getBatchPaymentHistory(xeroTenantId,batchPaymentID); + HistoryRecords hr = accountingApi.getBatchPaymentHistory(batchPaymentID); assertThat(hr.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); assertThat(hr.getHistoryRecords().get(0).getChanges(), is(equalTo("Approved"))); //System.out.println(hr.getHistoryRecords().toString()); @@ -127,7 +127,7 @@ public void testcreateBatchPaymentHistoryRecord() throws Exception { HistoryRecord newHistoryRecord = new HistoryRecord(); newHistoryRecord.setDetails("Hello World"); newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createBatchPaymentHistoryRecord(xeroTenantId,batchPaymentID,newHistoryRecords); + HistoryRecords newHistory = accountingApi.createBatchPaymentHistoryRecord(batchPaymentID,newHistoryRecords); assertThat(newHistory.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); //System.out.println(newHistory.getHistoryRecords().toString()); } diff --git a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java index f11e81a7..51979c28 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java @@ -41,7 +41,7 @@ public class AccountingApiBrandingThemeTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -66,7 +66,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -84,7 +84,7 @@ public void tearDown() { public void testGetBrandingThemes() throws Exception { System.out.println("@Test - getBrandingThemes"); - BrandingThemes bt = accountingApi.getBrandingThemes(xeroTenantId); + BrandingThemes bt = accountingApi.getBrandingThemes(); assertThat(bt.getBrandingThemes().get(0).getBrandingThemeID().toString(), is(equalTo("dabc7637-62c1-4941-8a6e-ee44fa5090e7"))); assertThat(bt.getBrandingThemes().get(0).getName(), is(equalTo("Standard"))); //System.out.println(bt.toString()); @@ -95,7 +95,7 @@ public void testGetBrandingTheme() throws Exception { System.out.println("@Test - getBrandingTheme"); UUID brandingThemeId = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - BrandingThemes oneBrandingTheme = accountingApi.getBrandingTheme(xeroTenantId,brandingThemeId); + BrandingThemes oneBrandingTheme = accountingApi.getBrandingTheme(brandingThemeId); assertThat(oneBrandingTheme.getBrandingThemes().get(0).getBrandingThemeID().toString(), is(equalTo("dabc7637-62c1-4941-8a6e-ee44fa5090e7"))); assertThat(oneBrandingTheme.getBrandingThemes().get(0).getName(), is(equalTo("Standard"))); //System.out.println(bt.toString()); @@ -106,7 +106,7 @@ public void testGetBrandingThemePaymentServices() throws Exception { System.out.println("@Test - getBrandingThemePaymentServices"); UUID brandingThemeId = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - PaymentServices paymentServicesForBrandingTheme = accountingApi.getBrandingThemePaymentServices(xeroTenantId,brandingThemeId); + PaymentServices paymentServicesForBrandingTheme = accountingApi.getBrandingThemePaymentServices(brandingThemeId); assertThat(paymentServicesForBrandingTheme.getPaymentServices().get(1).getPaymentServiceID().toString(), is(equalTo("dede7858-14e3-4a46-bf95-4d4cc491e645"))); assertThat(paymentServicesForBrandingTheme.getPaymentServices().get(1).getPaymentServiceName(), is(equalTo("ACME Payment"))); //System.out.println(paymentServicesForBrandingTheme.toString()); @@ -123,7 +123,7 @@ public void testCreateBrandingThemePaymentServices() throws Exception { btPaymentService.setPaymentServiceName("ACME Payments"); btPaymentService.setPaymentServiceUrl("http://www.mydomain.com/paymentservice"); btPaymentService.setPayNowText("Pay Now"); - PaymentServices response = accountingApi.createBrandingThemePaymentServices(xeroTenantId,brandingThemeId, btPaymentService); + PaymentServices response = accountingApi.createBrandingThemePaymentServices(brandingThemeId, btPaymentService); assertThat(response.getPaymentServices().get(0).getPaymentServiceID().toString(), is(equalTo("dede7858-14e3-4a46-bf95-4d4cc491e645"))); assertThat(response.getPaymentServices().get(0).getPaymentServiceName(), is(equalTo("ACME Payments"))); assertThat(response.getPaymentServices().get(0).getPaymentServiceUrl(), is(equalTo("https://www.payupnow.com/"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java index b91e722f..df727f0e 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java @@ -44,7 +44,7 @@ public class AccountingApiContactGroupTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -69,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -88,7 +88,7 @@ public void getContactGroupsTest() throws IOException { String where = null; String order = null; - ContactGroups response = accountingApi.getContactGroups(xeroTenantId, where, order); + ContactGroups response = accountingApi.getContactGroups(where, order); assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("d7a86b80-8dac-4d89-a334-9dcf5753676c")))); assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Suppliers"))); assertThat(response.getContactGroups().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ContactGroup.StatusEnum.ACTIVE))); @@ -100,7 +100,7 @@ public void getContactGroupTest() throws IOException { System.out.println("@Test - getContactGroupTest"); UUID contactGroupID = UUID.fromString("17b44ed7-4389-4162-91cb-3dd5766e4e22"); - ContactGroups response = accountingApi.getContactGroup(xeroTenantId, contactGroupID); + ContactGroups response = accountingApi.getContactGroup(contactGroupID); assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("17b44ed7-4389-4162-91cb-3dd5766e4e22")))); assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Oasis"))); @@ -117,7 +117,7 @@ public void createContactGroupTest() throws IOException { System.out.println("@Test - createContactGroupTest"); ContactGroups contactGroups = new ContactGroups(); - ContactGroups response = accountingApi.createContactGroup(xeroTenantId, contactGroups); + ContactGroups response = accountingApi.createContactGroup(contactGroups); assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("d7a86b80-8dac-4d89-a334-9dcf5753676c")))); assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Suppliers"))); assertThat(response.getContactGroups().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ContactGroup.StatusEnum.ACTIVE))); @@ -130,7 +130,7 @@ public void updateContactGroupTest() throws IOException { UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); ContactGroups contactGroups = new ContactGroups(); - ContactGroups response = accountingApi.updateContactGroup(xeroTenantId, contactGroupID, contactGroups); + ContactGroups response = accountingApi.updateContactGroup(contactGroupID, contactGroups); assertThat(response.getContactGroups().get(0).getContactGroupID(), is(equalTo(UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5")))); assertThat(response.getContactGroups().get(0).getName(), is(equalTo("Supplier Vendor"))); assertThat(response.getContactGroups().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ContactGroup.StatusEnum.ACTIVE))); @@ -143,7 +143,7 @@ public void createContactGroupContactsTest() throws IOException { UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); Contacts contacts = new Contacts(); - Contacts response = accountingApi.createContactGroupContacts(xeroTenantId, contactGroupID, contacts); + Contacts response = accountingApi.createContactGroupContacts(contactGroupID, contacts); assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("a3675fc4-f8dd-4f03-ba5b-f1870566bcd7")))); //System.out.println(response.getContacts().get(0).toString()); } @@ -154,7 +154,7 @@ public void deleteContactGroupContactTest() throws IOException { UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); UUID contactID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); - accountingApi.deleteContactGroupContact(xeroTenantId, contactGroupID, contactID); + accountingApi.deleteContactGroupContact(contactGroupID, contactID); } @Test @@ -162,7 +162,7 @@ public void deleteContactGroupContactsTest() throws IOException { System.out.println("@Test - deleteContactGroupContactsTest"); UUID contactGroupID = UUID.fromString("13f47537-7c1d-4e62-966e-617d76558fc5"); - accountingApi.deleteContactGroupContacts(xeroTenantId, contactGroupID); + accountingApi.deleteContactGroupContacts(contactGroupID); } } diff --git a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java index 70b2b917..5711b07c 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java @@ -44,7 +44,7 @@ public class AccountingApiContactsTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File body; private static boolean setUpIsDone = false; @@ -73,7 +73,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -95,7 +95,7 @@ public void getContactsTest() throws IOException { String order = null; String ids = null; Boolean includeArchived = null; - Contacts response = accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); + Contacts response = accountingApi.getContacts(ifModifiedSince, where, order, ids, null, includeArchived); assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("5cc8cf28-567e-4d43-b287-687cfcaec47c")))); assertThat(response.getContacts().get(0).getName(), is(equalTo("Katherine Warren"))); @@ -127,7 +127,7 @@ public void getContactTest() throws IOException { System.out.println("@Test - getContactTest"); UUID contactID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Contacts response = accountingApi.getContact(xeroTenantId, contactID); + Contacts response = accountingApi.getContact(contactID); assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d")))); assertThat(response.getContacts().get(0).getContactNumber(), is(equalTo("SB2"))); @@ -184,7 +184,7 @@ public void createContactTest() throws IOException { System.out.println("@Test - createContactTest"); Contact contact = new Contact(); - Contacts response = accountingApi.createContact(xeroTenantId, contact); + Contacts response = accountingApi.createContact(contact); assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("3ff6d40c-af9a-40a3-89ce-3c1556a25591")))); assertThat(response.getContacts().get(0).getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); assertThat(response.getContacts().get(0).getName(), is(equalTo("Foo9987"))); @@ -204,7 +204,7 @@ public void updateContactTest() throws IOException { UUID contactID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); Contacts contacts = new Contacts(); - Contacts response = accountingApi.updateContact(xeroTenantId, contactID,contacts); + Contacts response = accountingApi.updateContact(contactID,contacts); assertThat(response.getContacts().get(0).getContactID(), is(equalTo(UUID.fromString("d5be01fb-b09f-4c3a-9c67-e10c2a03412c")))); assertThat(response.getContacts().get(0).getContactStatus(), is(equalTo(com.xero.models.accounting.Contact.ContactStatusEnum.ACTIVE))); assertThat(response.getContacts().get(0).getName(), is(equalTo("FooBar"))); @@ -228,7 +228,7 @@ public void getContactHistoryTest() throws IOException { System.out.println("@Test - getContactHistoryTest"); UUID contactID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - HistoryRecords response = accountingApi.getContactHistory(xeroTenantId, contactID); + HistoryRecords response = accountingApi.getContactHistory(contactID); assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Edited"))); assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Name changed from Foo9987 to Bar8156."))); @@ -242,7 +242,7 @@ public void createContactHistoryTest() throws IOException { UUID contactID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); HistoryRecords historyRecords = new HistoryRecords(); - HistoryRecords response = accountingApi.createContactHistory(xeroTenantId, contactID, historyRecords); + HistoryRecords response = accountingApi.createContactHistory(contactID, historyRecords); assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-02-28T16:15:24.272-08:00")))); //System.out.println(response.getHistoryRecords().get(0).toString()); @@ -255,7 +255,7 @@ public void createContactAttachmentByFileNameTest() throws IOException { UUID contactID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); String fileName = "sample5.jpg"; - Attachments response = accountingApi.createContactAttachmentByFileName(xeroTenantId, contactID, fileName, body); + Attachments response = accountingApi.createContactAttachmentByFileName(contactID, fileName, body); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("27e37b01-6996-4ebe-836c-95fd472ad674")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); @@ -271,7 +271,7 @@ public void getContactAttachmentsTest() throws IOException { System.out.println("@Test - getContactAttachmentsTest"); UUID contactID = UUID.fromString("04e0a3e3-b116-456a-9f32-9706f0d33afa"); - Attachments response = accountingApi.getContactAttachments(xeroTenantId, contactID); + Attachments response = accountingApi.getContactAttachments(contactID); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("04e0a3e3-b116-456a-9f32-9706f0d33afa")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java index f371a4ea..a951be90 100644 --- a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java @@ -44,7 +44,7 @@ public class AccountingApiCreditNotesTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File body; private static boolean setUpIsDone = false; @@ -73,7 +73,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -91,7 +91,7 @@ public void createCreditNoteTest() throws IOException { System.out.println("@Test - createCreditNote"); Boolean summarizeErrors = null; CreditNotes creditNotes = new CreditNotes(); - CreditNotes response = accountingApi.createCreditNote(xeroTenantId, creditNotes, summarizeErrors); + CreditNotes response = accountingApi.createCreditNote(creditNotes, summarizeErrors); assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT))); assertThat(response.getCreditNotes().get(0).getStatus(), is(equalTo(com.xero.models.accounting.CreditNote.StatusEnum.DRAFT))); @@ -125,7 +125,7 @@ public void createCreditNoteAllocationTest() throws IOException { System.out.println("@Test - createCreditNoteAllocation"); UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); Allocations allocations = new Allocations(); - Allocations response = accountingApi.createCreditNoteAllocation(xeroTenantId, creditNoteID, allocations); + Allocations response = accountingApi.createCreditNoteAllocation(creditNoteID, allocations); assertThat(response.getAllocations().get(0).getAmount(), is(equalTo(1.0))); assertThat(response.getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 04)))); @@ -137,7 +137,7 @@ public void createCreditNoteAttachmentByFileNameTest() throws IOException { System.out.println("@Test - createCreditNoteAttachmentByFileName"); UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); String fileName = "sample5.jpg"; - Attachments response = accountingApi.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body); + Attachments response = accountingApi.createCreditNoteAttachmentByFileName(creditNoteID, fileName, body); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("91bbae3f-5de5-4e3d-875f-8662f25897bd")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("sample5.jpg"))); @@ -154,7 +154,7 @@ public void createCreditNoteHistoryTest() throws IOException { System.out.println("@Test - createCreditNoteHistory"); UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); HistoryRecords historyRecords = new HistoryRecords(); - HistoryRecords response = accountingApi.createCreditNoteHistory(xeroTenantId, creditNoteID, historyRecords); + HistoryRecords response = accountingApi.createCreditNoteHistory(creditNoteID, historyRecords); assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-05T15:29:04.585-08:00")))); @@ -165,7 +165,7 @@ public void createCreditNoteHistoryTest() throws IOException { public void getCreditNoteTest() throws IOException { System.out.println("@Test - getCreditNote"); UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - CreditNotes response = accountingApi.getCreditNote(xeroTenantId, creditNoteID); + CreditNotes response = accountingApi.getCreditNote(creditNoteID); assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCRECCREDIT))); assertThat(response.getCreditNotes().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 04)))); @@ -201,7 +201,7 @@ public void getCreditNoteTest() throws IOException { public void getCreditNoteAttachmentsTest() throws IOException { System.out.println("@Test - getCreditNoteAttachments"); UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Attachments response = accountingApi.getCreditNoteAttachments(xeroTenantId, creditNoteID); + Attachments response = accountingApi.getCreditNoteAttachments(creditNoteID); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("b7eb1fc9-a0f9-4e8e-9373-6689f5350832")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.png"))); @@ -216,7 +216,7 @@ public void getCreditNoteAttachmentsTest() throws IOException { public void getCreditNoteHistoryTest() throws IOException { System.out.println("@Test - getCreditNoteHistory"); UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = accountingApi.getCreditNoteHistory(xeroTenantId, creditNoteID); + HistoryRecords response = accountingApi.getCreditNoteHistory(creditNoteID); assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Cash Refunded"))); @@ -233,7 +233,7 @@ public void getCreditNotesTest() throws IOException { String where = null; String order = null; Integer page = null; - CreditNotes response = accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, page); + CreditNotes response = accountingApi.getCreditNotes(ifModifiedSince, where, order, page); assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCRECCREDIT))); assertThat(response.getCreditNotes().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 04)))); @@ -270,7 +270,7 @@ public void updateCreditNoteTest() throws IOException { System.out.println("@Test - updateCreditNote"); UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); CreditNotes creditNotes = new CreditNotes(); - CreditNotes response = accountingApi.updateCreditNote(xeroTenantId, creditNoteID, creditNotes); + CreditNotes response = accountingApi.updateCreditNote(creditNoteID, creditNotes); assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT))); assertThat(response.getCreditNotes().get(0).getDate(), is(equalTo(LocalDate.of(2019, 01, 04)))); @@ -306,7 +306,7 @@ public void updateCreditNoteAttachmentByFileNameTest() throws IOException { UUID creditNoteID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); String fileName = "sample5.jpg"; - Attachments response = accountingApi.updateCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body); + Attachments response = accountingApi.updateCreditNoteAttachmentByFileName(creditNoteID, fileName, body); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("103e49f1-e47c-4b4d-b5e8-77d9d00fa70a")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java index 3b571f08..25f1ef9f 100644 --- a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java @@ -44,7 +44,7 @@ public class AccountingApiEmployeesTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -69,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -86,7 +86,7 @@ public void tearDown() { public void createEmployeeTest() throws IOException { System.out.println("@Test - createEmployee"); Employees employees = new Employees(); - Employees response = accountingApi.createEmployee(xeroTenantId, employees); + Employees response = accountingApi.createEmployee(employees); assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("e1ada26b-a10e-4065-a941-af34b53740e3")))); assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); @@ -102,7 +102,7 @@ public void createEmployeeTest() throws IOException { public void getEmployeeTest() throws IOException { System.out.println("@Test - getEmployee"); UUID employeeID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Employees response = accountingApi.getEmployee(xeroTenantId, employeeID); + Employees response = accountingApi.getEmployee(employeeID); assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("972615c5-ad3d-47a0-b579-20370d374578")))); assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); @@ -121,7 +121,7 @@ public void getEmployeesTest() throws IOException { OffsetDateTime ifModifiedSince = null; String where = null; String order = null; - Employees response = accountingApi.getEmployees(xeroTenantId, ifModifiedSince, where, order); + Employees response = accountingApi.getEmployees(ifModifiedSince, where, order); assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("972615c5-ad3d-47a0-b579-20370d374578")))); assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); @@ -138,7 +138,7 @@ public void updateEmployeeTest() throws IOException { System.out.println("@Test - updateEmployee"); UUID employeeID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); Employees employees = new Employees(); - Employees response = accountingApi.updateEmployee(xeroTenantId, employeeID, employees); + Employees response = accountingApi.updateEmployee(employeeID, employees); assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("ad3db144-6362-459c-8c36-5d31d196e629")))); assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); diff --git a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java index d9b255a2..ac363491 100644 --- a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java @@ -43,7 +43,7 @@ public class AccountingApiExpenseClaimsTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File body; private static boolean setUpIsDone = false; @@ -72,7 +72,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -90,7 +90,7 @@ public void createExpenseClaimTest() throws IOException { System.out.println("@Test - createExpenseClaim"); ExpenseClaims expenseClaims = new ExpenseClaims(); Boolean summarizeErrors = null; - ExpenseClaims response = accountingApi.createExpenseClaim(xeroTenantId, expenseClaims, summarizeErrors); + ExpenseClaims response = accountingApi.createExpenseClaim(expenseClaims, summarizeErrors); assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); assertThat(response.getExpenseClaims().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED))); @@ -132,7 +132,7 @@ public void createExpenseClaimHistoryTest() throws IOException { public void getExpenseClaimTest() throws IOException { System.out.println("@Test - getExpenseClaim"); UUID expenseClaimID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - ExpenseClaims response = accountingApi.getExpenseClaim(xeroTenantId, expenseClaimID); + ExpenseClaims response = accountingApi.getExpenseClaim(expenseClaimID); assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); assertThat(response.getExpenseClaims().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED))); @@ -159,7 +159,7 @@ public void getExpenseClaimTest() throws IOException { public void getExpenseClaimHistoryTest() throws IOException { System.out.println("@Test - getExpenseClaimHistory"); UUID expenseClaimID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = accountingApi.getExpenseClaimHistory(xeroTenantId, expenseClaimID); + HistoryRecords response = accountingApi.getExpenseClaimHistory(expenseClaimID); assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Voided"))); @@ -173,7 +173,7 @@ public void getExpenseClaimsTest() throws IOException { OffsetDateTime ifModifiedSince = null; String where = null; String order = null; - ExpenseClaims response = accountingApi.getExpenseClaims(xeroTenantId, ifModifiedSince, where, order); + ExpenseClaims response = accountingApi.getExpenseClaims(ifModifiedSince, where, order); // TODO: test validations assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); @@ -200,7 +200,7 @@ public void updateExpenseClaimTest() throws IOException { System.out.println("@Test - updateExpenseClaim"); UUID expenseClaimID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); ExpenseClaims expenseClaims = new ExpenseClaims(); - ExpenseClaims response = accountingApi.updateExpenseClaim(xeroTenantId, expenseClaimID, expenseClaims); + ExpenseClaims response = accountingApi.updateExpenseClaim(expenseClaimID, expenseClaims); // TODO: test validations assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); diff --git a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java index 1414333e..99bda5a9 100644 --- a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java @@ -44,7 +44,6 @@ public class AccountingApiInvoicesTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; File body; private static boolean setUpIsDone = false; @@ -73,7 +72,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -91,7 +90,7 @@ public void createInvoiceTest() throws IOException { System.out.println("@Test - createInvoice"); Invoices invoices = new Invoices(); Boolean summarizeErrors = null; - Invoices response = accountingApi.createInvoice(xeroTenantId, invoices, summarizeErrors); + Invoices response = accountingApi.createInvoice(invoices, summarizeErrors); assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 10)))); @@ -142,7 +141,7 @@ public void createInvoiceHistoryTest() throws IOException { System.out.println("@Test - createInvoiceHistory"); UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); HistoryRecords historyRecords = new HistoryRecords(); - HistoryRecords response = accountingApi.createInvoiceHistory(xeroTenantId, invoiceID, historyRecords); + HistoryRecords response = accountingApi.createInvoiceHistory(invoiceID, historyRecords); assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-11T12:08:03.349-07:00")))); @@ -153,7 +152,7 @@ public void createInvoiceHistoryTest() throws IOException { public void getInvoiceTest() throws IOException { System.out.println("@Test - getInvoiceTest"); UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Invoices response = accountingApi.getInvoice(xeroTenantId, invoiceID); + Invoices response = accountingApi.getInvoice(invoiceID); assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,06)))); @@ -220,7 +219,7 @@ public void getInvoiceTest() throws IOException { public void getInvoiceAttachmentsTest() throws IOException { System.out.println("@Test - getInvoiceAttachments"); UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Attachments response = accountingApi.getInvoiceAttachments(xeroTenantId, invoiceID); + Attachments response = accountingApi.getInvoiceAttachments(invoiceID); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("9808ad7f-c8d4-41cf-995e-bc29cb76fd2c")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("foobar.jpg"))); @@ -235,7 +234,7 @@ public void getInvoiceAttachmentsTest() throws IOException { public void getInvoiceHistoryTest() throws IOException { System.out.println("@Test - getInvoiceHistory"); UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = accountingApi.getInvoiceHistory(xeroTenantId, invoiceID); + HistoryRecords response = accountingApi.getInvoiceHistory(invoiceID); assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Paid"))); @@ -258,7 +257,7 @@ public void getInvoicesTest() throws IOException { Boolean includeArchived = null; Boolean createdByMyApp = null; Integer unitdp = null; - Invoices response = accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); + Invoices response = accountingApi.getInvoices(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2018,10,19)))); @@ -296,7 +295,7 @@ public void getInvoicesTest() throws IOException { public void getOnlineInvoiceTest() throws IOException { System.out.println("@Test - getOnlineInvoice"); UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - OnlineInvoices response = accountingApi.getOnlineInvoice(xeroTenantId, invoiceID); + OnlineInvoices response = accountingApi.getOnlineInvoice(invoiceID); assertThat(response.getOnlineInvoices().get(0).getOnlineInvoiceUrl(), is(equalTo("https://in.xero.com/bCWCCfytGdTXoJam9HENWlQt07G6zcDaj4gQojHu"))); //System.out.println(response.getOnlineInvoices().get(0).toString()); @@ -307,7 +306,7 @@ public void updateInvoiceTest() throws IOException { System.out.println("@Test - updateInvoice"); UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); Invoices invoices = new Invoices(); - Invoices response = accountingApi.updateInvoice(xeroTenantId, invoiceID, invoices); + Invoices response = accountingApi.updateInvoice(invoiceID, invoices); assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,10)))); @@ -353,7 +352,7 @@ public void updateInvoiceAttachmentByFileNameTest() throws IOException { System.out.println("@Test - updateInvoiceAttachmentByFileName"); UUID invoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); String fileName = "sample5.jpg"; - Attachments response = accountingApi.updateInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body); + Attachments response = accountingApi.updateInvoiceAttachmentByFileName(invoiceID, fileName, body); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("08085449-fda3-45f4-a685-ff44c8a29ee3")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); @@ -367,7 +366,7 @@ public void updateInvoiceAttachmentByFileNameTest() throws IOException { @Test public void getInvoiceRemindersTest() throws IOException { System.out.println("@Test - getInvoiceReminders"); - InvoiceReminders response = accountingApi.getInvoiceReminders(xeroTenantId); + InvoiceReminders response = accountingApi.getInvoiceReminders(); assertThat(response.getInvoiceReminders().get(0).getEnabled(), is(equalTo(false))); //System.out.println(response.getInvoiceReminders().get(0).toString()); diff --git a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java index ae41254d..bb5413ca 100644 --- a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java @@ -44,7 +44,7 @@ public class AccountingApiItemsTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -69,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -86,7 +86,7 @@ public void tearDown() { public void createItemTest() throws IOException { System.out.println("@Test - createItem"); Items items = new Items(); - Items response = accountingApi.createItem(xeroTenantId, items); + Items response = accountingApi.createItem(items); assertThat(response.getItems().get(0).getCode(), is(equalTo("abc65591"))); assertThat(response.getItems().get(0).getName(), is(equalTo("Hello11350"))); @@ -114,7 +114,7 @@ public void createItemHistoryTest() throws IOException { public void getItemTest() throws IOException { System.out.println("@Test - getItem"); UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Items response = accountingApi.getItem(xeroTenantId, itemID); + Items response = accountingApi.getItem(itemID); assertThat(response.getItems().get(0).getCode(), is(equalTo("123"))); assertThat(response.getItems().get(0).getInventoryAssetAccountCode(), is(equalTo("630"))); @@ -143,7 +143,7 @@ public void getItemTest() throws IOException { public void getItemHistoryTest() throws IOException { System.out.println("@Test - getItemHistory"); UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = accountingApi.getItemHistory(xeroTenantId, itemID); + HistoryRecords response = accountingApi.getItemHistory(itemID); assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Created"))); @@ -159,7 +159,7 @@ public void getItemsTest() throws IOException { String where = null; String order = null; Integer unitdp = null; - Items response = accountingApi.getItems(xeroTenantId, ifModifiedSince, where, order, unitdp); + Items response = accountingApi.getItems(ifModifiedSince, where, order, unitdp); assertThat(response.getItems().get(0).getCode(), is(equalTo("123"))); assertThat(response.getItems().get(0).getName(), is(equalTo("Guitars"))); @@ -180,7 +180,7 @@ public void updateItemTest() throws IOException { System.out.println("@Test - updateItem"); UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); Items items = new Items(); - Items response = accountingApi.updateItem(xeroTenantId, itemID, items); + Items response = accountingApi.updateItem(itemID, items); assertThat(response.getItems().get(0).getCode(), is(equalTo("abc38306"))); assertThat(response.getItems().get(0).getName(), is(equalTo("Hello8746"))); @@ -197,6 +197,6 @@ public void updateItemTest() throws IOException { public void deleteItemTest() throws IOException { System.out.println("@Test - deleteItem"); UUID itemID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - accountingApi.deleteItem(xeroTenantId, itemID); + accountingApi.deleteItem(itemID); } } diff --git a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java index a8590ba5..59ad3e53 100644 --- a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java @@ -44,7 +44,7 @@ public class AccountingApiJournalsTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -69,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -86,7 +86,7 @@ public void tearDown() { public void getJournalTest() throws IOException { System.out.println("@Test - getJournal"); UUID journalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Journals response = accountingApi.getJournal(xeroTenantId, journalID); + Journals response = accountingApi.getJournal(journalID); assertThat(response.getJournals().get(0).getJournalID(), is(equalTo(UUID.fromString("1b31feeb-aa23-404c-8c19-24c827c53661")))); assertThat(response.getJournals().get(0).getJournalDate(), is(equalTo(LocalDate.of(2018,10,19)))); @@ -128,7 +128,7 @@ public void getJournalsTest() throws IOException { OffsetDateTime ifModifiedSince = null; Integer offset = null; Boolean paymentsOnly = null; - Journals response = accountingApi.getJournals(xeroTenantId, ifModifiedSince, offset, paymentsOnly); + Journals response = accountingApi.getJournals(ifModifiedSince, offset, paymentsOnly); assertThat(response.getJournals().get(0).getJournalID(), is(equalTo(UUID.fromString("1b31feeb-aa23-404c-8c19-24c827c53661")))); assertThat(response.getJournals().get(0).getJournalDate(), is(equalTo(LocalDate.of(2018,10,19)))); diff --git a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java index c8811f7e..45c2c32d 100644 --- a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java @@ -44,7 +44,7 @@ public class AccountingApiLinkedTransactionsTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -69,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -86,7 +86,7 @@ public void tearDown() { public void createLinkedTransactionTest() throws IOException { System.out.println("@Test - createLinkedTransaction"); LinkedTransactions linkedTransactions = new LinkedTransactions(); - LinkedTransactions response = accountingApi.createLinkedTransaction(xeroTenantId, linkedTransactions); + LinkedTransactions response = accountingApi.createLinkedTransaction(linkedTransactions); assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("a848644a-f20f-4630-98c3-386bd7505631")))); assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("b0df260d-3cc8-4ced-9bd6-41924f624ed3")))); @@ -103,14 +103,14 @@ public void createLinkedTransactionTest() throws IOException { public void deleteLinkedTransactionTest() throws IOException { System.out.println("@Test - deleteLinkedTransaction"); UUID linkedTransactionID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - accountingApi.deleteLinkedTransaction(xeroTenantId, linkedTransactionID); + accountingApi.deleteLinkedTransaction(linkedTransactionID); } @Test public void getLinkedTransactionTest() throws IOException { System.out.println("@Test - getLinkedTransaction"); UUID linkedTransactionID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - LinkedTransactions response = accountingApi.getLinkedTransaction(xeroTenantId, linkedTransactionID); + LinkedTransactions response = accountingApi.getLinkedTransaction(linkedTransactionID); assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("aec416dd-38ea-40dc-9f0b-813c8c71f87f")))); assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("77e0b23b-5b79-4f4b-ae20-c9031d41442f")))); @@ -134,7 +134,7 @@ public void getLinkedTransactionsTest() throws IOException { String contactID = null; String status = null; String targetTransactionID = null; - LinkedTransactions response = accountingApi.getLinkedTransactions(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); + LinkedTransactions response = accountingApi.getLinkedTransactions(page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("aec416dd-38ea-40dc-9f0b-813c8c71f87f")))); assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("77e0b23b-5b79-4f4b-ae20-c9031d41442f")))); @@ -154,7 +154,7 @@ public void updateLinkedTransactionTest() throws IOException { System.out.println("@Test - updateLinkedTransaction"); UUID linkedTransactionID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); LinkedTransactions linkedTransactions = new LinkedTransactions(); - LinkedTransactions response = accountingApi.updateLinkedTransaction(xeroTenantId, linkedTransactionID, linkedTransactions); + LinkedTransactions response = accountingApi.updateLinkedTransaction(linkedTransactionID, linkedTransactions); assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("a848644a-f20f-4630-98c3-386bd7505631")))); assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("b0df260d-3cc8-4ced-9bd6-41924f624ed3")))); diff --git a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java index 473be892..190a49ee 100644 --- a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java @@ -44,7 +44,7 @@ public class AccountingApiManualJournalsTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File body; private static boolean setUpIsDone = false; @@ -73,7 +73,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -90,7 +90,7 @@ public void tearDown() { public void createManualJournalTest() throws IOException { System.out.println("@Test - createManualJournal"); ManualJournals manualJournals = new ManualJournals(); - ManualJournals response = accountingApi.createManualJournal(xeroTenantId, manualJournals); + ManualJournals response = accountingApi.createManualJournal(manualJournals); assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Foo bar"))); assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount(), is(equalTo(100.0))); @@ -126,7 +126,7 @@ public void createManualJournalAttachmentByFileNameTest() throws IOException { System.out.println("@Test - createManualJournalAttachmentByFileName"); UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); String fileName = "sample5.jpg"; - Attachments response = accountingApi.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body); + Attachments response = accountingApi.createManualJournalAttachmentByFileName(manualJournalID, fileName, body); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("47ac97ff-d4f9-48a0-8a8e-49fae29129e7")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("foobar.jpg"))); @@ -141,7 +141,7 @@ public void createManualJournalAttachmentByFileNameTest() throws IOException { public void getManualJournalTest() throws IOException { System.out.println("@Test - getManualJournal"); UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - ManualJournals response = accountingApi.getManualJournal(xeroTenantId, manualJournalID); + ManualJournals response = accountingApi.getManualJournal(manualJournalID); assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("These aren't the droids you are looking for"))); assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount(), is(equalTo(100.0))); @@ -175,7 +175,7 @@ public void getManualJournalTest() throws IOException { public void getManualJournalAttachmentsTest() throws IOException { System.out.println("@Test - getManualJournalAttachments"); UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Attachments response = accountingApi.getManualJournalAttachments(xeroTenantId, manualJournalID); + Attachments response = accountingApi.getManualJournalAttachments(manualJournalID); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("16e86f32-3e25-4209-8662-c0dfd91b654c")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); @@ -193,7 +193,7 @@ public void getManualJournalsTest() throws IOException { String where = null; String order = null; Integer page = null; - ManualJournals response = accountingApi.getManualJournals(xeroTenantId, ifModifiedSince, where, order, page); + ManualJournals response = accountingApi.getManualJournals(ifModifiedSince, where, order, page); assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Reversal: These aren't the droids you are looking for"))); assertThat(response.getManualJournals().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,20)))); @@ -211,7 +211,7 @@ public void updateManualJournalTest() throws IOException { System.out.println("@Test - updateManualJournal"); UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); ManualJournals manualJournals = new ManualJournals(); - ManualJournals response = accountingApi.updateManualJournal(xeroTenantId, manualJournalID, manualJournals); + ManualJournals response = accountingApi.updateManualJournal(manualJournalID, manualJournals); assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Hello Xero"))); assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount(), is(equalTo(100.0))); @@ -241,7 +241,7 @@ public void updateManualJournalAttachmentByFileNameTest() throws IOException { System.out.println("@Test - updateManualJournalAttachmentByFileName"); UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); String fileName = "sample5.jpg"; - Attachments response = accountingApi.updateManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body); + Attachments response = accountingApi.updateManualJournalAttachmentByFileName(manualJournalID, fileName, body); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("16e86f32-3e25-4209-8662-c0dfd91b654c")))); assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java index ce733ba8..941e1106 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java @@ -44,7 +44,7 @@ public class AccountingApiOrganisationsTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -69,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -85,7 +85,7 @@ public void tearDown() { @Test public void getOrganisationsTest() throws IOException { System.out.println("@Test - getOrganisations"); - Organisations response = accountingApi.getOrganisations(xeroTenantId); + Organisations response = accountingApi.getOrganisations(); assertThat(response.getOrganisations().get(0).getOrganisationID(), is(equalTo(UUID.fromString("b2c885a9-4bb9-4a00-9b6e-6c2bf60b1a2b")))); assertThat(response.getOrganisations().get(0).getApIKey(), is(equalTo("CTJ60UH519MXQIXEJSDPDALS3EOZ5Y"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java index 9fd654b6..dd2919c9 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java @@ -44,7 +44,7 @@ public class AccountingApiOverpaymentsTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + File body; private static boolean setUpIsDone = false; @@ -73,7 +73,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -91,7 +91,7 @@ public void createOverpaymentAllocationTest() throws IOException { System.out.println("@Test - createOverpaymentAllocation"); UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); Allocations allocations = new Allocations(); - Allocations response = accountingApi.createOverpaymentAllocation(xeroTenantId, overpaymentID, allocations); + Allocations response = accountingApi.createOverpaymentAllocation(overpaymentID, allocations); // TODO: test validations assertThat(response.getAllocations().get(0).getInvoice().getInvoiceID(), is(equalTo(UUID.fromString("c45720a1-ade3-4a38-a064-d15489be6841")))); @@ -115,7 +115,7 @@ public void createOverpaymentHistoryTest() throws IOException { public void getOverpaymentTest() throws IOException { System.out.println("@Test - getOverpayment"); UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Overpayments response = accountingApi.getOverpayment(xeroTenantId, overpaymentID); + Overpayments response = accountingApi.getOverpayment(overpaymentID); //assertThat(response.getOverpayments().get(0).getType(), is(equalTo(com.xero.models.accounting.Overpayment.TypeEnum.SPEND-OVERPAYMENT))); assertThat(response.getOverpayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); @@ -157,7 +157,7 @@ public void getOverpaymentTest() throws IOException { public void getOverpaymentHistoryTest() throws IOException { System.out.println("@Test - getOverpaymentHistory"); UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = accountingApi.getOverpaymentHistory(xeroTenantId, overpaymentID); + HistoryRecords response = accountingApi.getOverpaymentHistory(overpaymentID); assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Applied"))); @@ -174,7 +174,7 @@ public void getOverpaymentsTest() throws IOException { String order = null; Integer page = null; Integer unitdp = null; - Overpayments response = accountingApi.getOverpayments(xeroTenantId, ifModifiedSince, where, order, page,unitdp); + Overpayments response = accountingApi.getOverpayments(ifModifiedSince, where, order, page,unitdp); assertThat(response.getOverpayments().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,11)))); assertThat(response.getOverpayments().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Overpayment.StatusEnum.AUTHORISED))); diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java index 83e7e8c3..9640226a 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java @@ -44,7 +44,7 @@ public class AccountingApiPaymentServicesTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -69,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -86,7 +86,7 @@ public void tearDown() { public void createPaymentServiceTest() throws IOException { System.out.println("@Test - createPaymentService"); PaymentServices paymentServices = new PaymentServices(); - PaymentServices response = accountingApi.createPaymentService(xeroTenantId, paymentServices); + PaymentServices response = accountingApi.createPaymentService(paymentServices); assertThat(response.getPaymentServices().get(0).getPaymentServiceID(), is(equalTo(UUID.fromString("54b3b4f6-0443-4fba-bcd1-61ec0c35ca55")))); assertThat(response.getPaymentServices().get(0).getPaymentServiceName(), is(equalTo("PayUpNow"))); @@ -100,7 +100,7 @@ public void createPaymentServiceTest() throws IOException { @Test public void getPaymentServicesTest() throws IOException { System.out.println("@Test - getPaymentServices"); - PaymentServices response = accountingApi.getPaymentServices(xeroTenantId); + PaymentServices response = accountingApi.getPaymentServices(); assertThat(response.getPaymentServices().get(0).getPaymentServiceID(), is(equalTo(UUID.fromString("54b3b4f6-0443-4fba-bcd1-61ec0c35ca55")))); assertThat(response.getPaymentServices().get(0).getPaymentServiceName(), is(equalTo("PayUpNow"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java index fcf52291..93d9fa7e 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java @@ -44,7 +44,7 @@ public class AccountingApiPaymentsTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -69,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -86,7 +86,7 @@ public void tearDown() { public void createPaymentTest() throws IOException { System.out.println("@Test - createPayment"); Payments payments = new Payments(); - Payments response = accountingApi.createPayment(xeroTenantId, payments); + Payments response = accountingApi.createPayment(payments); assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0004"))); assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("970"))); @@ -121,7 +121,7 @@ public void deletePaymentTest() throws IOException { System.out.println("@Test - deletePayment"); UUID paymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); Payments payments = new Payments(); - Payments response = accountingApi.deletePayment(xeroTenantId, paymentID, payments); + Payments response = accountingApi.deletePayment(paymentID, payments); assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0006"))); assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("980"))); @@ -145,7 +145,7 @@ public void deletePaymentTest() throws IOException { public void getPaymentTest() throws IOException { System.out.println("@Test - getPayment"); UUID paymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Payments response = accountingApi.getPayment(xeroTenantId, paymentID); + Payments response = accountingApi.getPayment(paymentID); assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0002"))); assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("970"))); @@ -168,7 +168,7 @@ public void getPaymentTest() throws IOException { public void getPaymentHistoryTest() throws IOException { System.out.println("@Test - getPaymentHistory"); UUID paymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = accountingApi.getPaymentHistory(xeroTenantId, paymentID); + HistoryRecords response = accountingApi.getPaymentHistory(paymentID); assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Created"))); @@ -182,7 +182,7 @@ public void getPaymentsTest() throws IOException { OffsetDateTime ifModifiedSince = null; String where = null; String order = null; - Payments response = accountingApi.getPayments(xeroTenantId, ifModifiedSince, where, order); + Payments response = accountingApi.getPayments(ifModifiedSince, where, order); assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0002"))); assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("970"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java index 9474a12d..c9f9962d 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java @@ -44,7 +44,7 @@ public class AccountingApiPrepaymentsTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; + private static boolean setUpIsDone = false; @@ -69,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 30 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -87,7 +87,7 @@ public void createPrepaymentAllocationTest() throws IOException { System.out.println("@Test - createPrepaymentAllocation"); UUID prepaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); Allocations allocations = new Allocations(); - Allocations response = accountingApi.createPrepaymentAllocation(xeroTenantId, prepaymentID, allocations); + Allocations response = accountingApi.createPrepaymentAllocation(prepaymentID, allocations); assertThat(response.getAllocations().get(0).getAmount(), is(equalTo(1.0))); assertThat(response.getAllocations().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); @@ -109,7 +109,7 @@ public void createPrepaymentHistoryTest() throws IOException { public void getPrepaymentTest() throws IOException { System.out.println("@Test - getPrepayment"); UUID prepaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Prepayments response = accountingApi.getPrepayment(xeroTenantId, prepaymentID); + Prepayments response = accountingApi.getPrepayment(prepaymentID); assertThat(response.getPrepayments().get(0).getType().toString(), is(equalTo("RECEIVE-PREPAYMENT"))); assertThat(response.getPrepayments().get(0).getContact().getName(), is(equalTo("Luke Skywalker"))); @@ -152,7 +152,7 @@ public void getPrepaymentTest() throws IOException { public void getPrepaymentHistoryTest() throws IOException { System.out.println("@Test - getPrepaymentHistory"); UUID prepaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = accountingApi.getPrepaymentHistory(xeroTenantId, prepaymentID); + HistoryRecords response = accountingApi.getPrepaymentHistory(prepaymentID); assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre"))); assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Cash Refunded"))); @@ -169,7 +169,7 @@ public void getPrepaymentsTest() throws IOException { String order = null; Integer page = null; Integer unitdp = null; - Prepayments response = accountingApi.getPrepayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp); + Prepayments response = accountingApi.getPrepayments(ifModifiedSince, where, order, page, unitdp); assertThat(response.getPrepayments().get(0).getType().toString(), is(equalTo("RECEIVE-PREPAYMENT"))); assertThat(response.getPrepayments().get(0).getContact().getName(), is(equalTo("Luke Skywalker"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java index 3db7f0e0..a7197e83 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java @@ -44,8 +44,7 @@ public class AccountingApiPurchaseOrdersTest { ApiClient defaultClient; AccountingApi accountingApi; - String xeroTenantId = "3697c2dc5-cc47-4afd-8ec8-74990b8761e9"; - + private static boolean setUpIsDone = false; @Before @@ -69,7 +68,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60); + Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } @@ -87,7 +86,7 @@ public void createPurchaseOrderTest() throws IOException { System.out.println("@Test - createPurchaseOrder"); PurchaseOrders purchaseOrders = new PurchaseOrders(); Boolean summarizeErrors = null; - PurchaseOrders response = accountingApi.createPurchaseOrder(xeroTenantId, purchaseOrders, summarizeErrors); + PurchaseOrders response = accountingApi.createPurchaseOrder(purchaseOrders, summarizeErrors); // TODO: test validations assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); @@ -127,7 +126,7 @@ public void createPurchaseOrderHistoryTest() throws IOException { System.out.println("@Test - createPurchaseOrderHistory"); UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); HistoryRecords historyRecords = new HistoryRecords(); - HistoryRecords response = accountingApi.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID, historyRecords); + HistoryRecords response = accountingApi.createPurchaseOrderHistory(purchaseOrderID, historyRecords); assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Hello World"))); assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:39:39.354-07:00")))); @@ -138,7 +137,7 @@ public void createPurchaseOrderHistoryTest() throws IOException { public void getPurchaseOrderTest() throws IOException { System.out.println("@Test - getPurchaseOrder"); UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - PurchaseOrders response = accountingApi.getPurchaseOrder(xeroTenantId, purchaseOrderID); + PurchaseOrders response = accountingApi.getPurchaseOrder(purchaseOrderID); assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("8a9d3eca-e052-43bc-9b87-221d0648c045")))); @@ -190,7 +189,7 @@ public void getPurchaseOrderTest() throws IOException { public void getPurchaseOrderHistoryTest() throws IOException { System.out.println("@Test - getPurchaseOrderHistory"); UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - HistoryRecords response = accountingApi.getPurchaseOrderHistory(xeroTenantId, purchaseOrderID); + HistoryRecords response = accountingApi.getPurchaseOrderHistory(purchaseOrderID); assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Note"))); @@ -208,7 +207,7 @@ public void getPurchaseOrdersTest() throws IOException { String dateTo = null; String order = null; Integer page = null; - PurchaseOrders response = accountingApi.getPurchaseOrders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page); + PurchaseOrders response = accountingApi.getPurchaseOrders(ifModifiedSince, status, dateFrom, dateTo, order, page); assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("0f7b54b8-bfa4-4c5d-9c22-73dbd5796e54")))); @@ -241,7 +240,7 @@ public void updatePurchaseOrderTest() throws IOException { System.out.println("@Test - updatePurchaseOrder"); UUID purchaseOrderID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); PurchaseOrders purchaseOrders = new PurchaseOrders(); - PurchaseOrders response = accountingApi.updatePurchaseOrder(xeroTenantId, purchaseOrderID, purchaseOrders); + PurchaseOrders response = accountingApi.updatePurchaseOrder(purchaseOrderID, purchaseOrders); assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); assertThat(response.getPurchaseOrders().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("d1d9b2cd-c9f2-4445-8d98-0b8096cf4dae")))); diff --git a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java new file mode 100644 index 00000000..4348075d --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java @@ -0,0 +1,266 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiReceiptsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + File body; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + ClassLoader classLoader = getClass().getClassLoader(); + body = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60000); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createReceiptTest() throws IOException { + System.out.println("@Test - createReceipt"); + Receipts receipts = new Receipts(); + Receipts response = accountingApi.createReceipt(receipts); + + assertThat(response.getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,13)))); + assertThat(response.getReceipts().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getReceipts().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); + assertThat(response.getReceipts().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); + assertThat(response.getReceipts().get(0).getSubTotal(), is(equalTo(40.0))); + assertThat(response.getReceipts().get(0).getSubTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getReceipts().get(0).getTotalTax(), is(equalTo(0.0))); + assertThat(response.getReceipts().get(0).getTotalTax().toString(), is(equalTo("0.0"))); + assertThat(response.getReceipts().get(0).getTotal(), is(equalTo(40.0))); + assertThat(response.getReceipts().get(0).getTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("a44fd147-af4e-4fe8-a09a-55332df74162")))); + assertThat(response.getReceipts().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Receipt.StatusEnum.DRAFT))); + assertThat(response.getReceipts().get(0).getReceiptNumber(), is(equalTo("1"))); + assertThat(response.getReceipts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:49:43.367-07:00")))); + assertThat(response.getReceipts().get(0).getHasAttachments(), is(equalTo(false))); + assertThat(response.getReceipts().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("A valid user should be identified using the UserID."))); + //System.out.println(response.getReceipts().get(0).toString()); + } + + @Test + public void createReceiptAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - createReceiptAttachmentByFileName"); + UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + String fileName = "sample5.jpg"; + Attachments response = accountingApi.createReceiptAttachmentByFileName(receiptID, fileName, body); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("3451e34c-66a6-42b0-91e2-88618bdc169b")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("foobar.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Receipts/a44fd147-af4e-4fe8-a09a-55332df74162/Attachments/foobar.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + + @Test + public void createReceiptHistoryTest() throws IOException { + System.out.println("@Test - createReceiptHistory - not implemented"); + UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords historyRecords = new HistoryRecords(); + //HistoryRecords response = accountingApi.createReceiptHistory(receiptID, historyRecords); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getReceiptTest() throws IOException { + System.out.println("@Test - getReceipt"); + UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Receipts response = accountingApi.getReceipt(receiptID); + + assertThat(response.getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); + assertThat(response.getReceipts().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getReceipts().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); + assertThat(response.getReceipts().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); + assertThat(response.getReceipts().get(0).getSubTotal(), is(equalTo(40.0))); + assertThat(response.getReceipts().get(0).getSubTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getReceipts().get(0).getTotalTax(), is(equalTo(0.0))); + assertThat(response.getReceipts().get(0).getTotalTax().toString(), is(equalTo("0.0"))); + assertThat(response.getReceipts().get(0).getTotal(), is(equalTo(40.0))); + assertThat(response.getReceipts().get(0).getTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("a44fd147-af4e-4fe8-a09a-55332df74162")))); + assertThat(response.getReceipts().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Receipt.StatusEnum.DRAFT))); + assertThat(response.getReceipts().get(0).getReceiptNumber(), is(equalTo("1"))); + assertThat(response.getReceipts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:49:43.983-07:00")))); + assertThat(response.getReceipts().get(0).getHasAttachments(), is(equalTo(true))); + assertThat(response.getReceipts().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("e02a84f6-b83a-4983-b3b9-35cd8880c7bc")))); + assertThat(response.getReceipts().get(0).getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); + assertThat(response.getReceipts().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getReceipts().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/receipts/a44fd147-af4e-4fe8-a09a-55332df74162/Attachments/HelloWorld.jpg"))); + assertThat(response.getReceipts().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getReceipts().get(0).getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getReceipts().get(0).toString()); + } + + @Test + public void getReceiptAttachmentsTest() throws IOException { + System.out.println("@Test - getReceiptAttachments"); + UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Attachments response = accountingApi.getReceiptAttachments(receiptID); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("11e5ca6b-d38c-42ab-a29f-c1710d171aa1")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("giphy.gif"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/gif"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Receipts/7923c00d-163d-404c-a608-af3de333db29/Attachments/giphy.gif"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("495727")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + @Test + public void getReceiptHistoryTest() throws IOException { + System.out.println("@Test - getReceiptHistory"); + UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords response = accountingApi.getReceiptHistory(receiptID); + + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Edited"))); + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Received through the Xero API from Java Partner Example"))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:49:43.983-07:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getReceiptsTest() throws IOException { + System.out.println("@Test - getReceipts"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + Integer unitdp = null; + Receipts response = accountingApi.getReceipts(ifModifiedSince, where, order,unitdp); + + assertThat(response.getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,12)))); + assertThat(response.getReceipts().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getReceipts().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); + assertThat(response.getReceipts().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); + assertThat(response.getReceipts().get(0).getSubTotal(), is(equalTo(40.0))); + assertThat(response.getReceipts().get(0).getSubTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getReceipts().get(0).getTotalTax(), is(equalTo(0.0))); + assertThat(response.getReceipts().get(0).getTotalTax().toString(), is(equalTo("0.0"))); + assertThat(response.getReceipts().get(0).getTotal(), is(equalTo(40.0))); + assertThat(response.getReceipts().get(0).getTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("a44fd147-af4e-4fe8-a09a-55332df74162")))); + assertThat(response.getReceipts().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Receipt.StatusEnum.DRAFT))); + assertThat(response.getReceipts().get(0).getReceiptNumber(), is(equalTo("1"))); + assertThat(response.getReceipts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-13T17:49:43.983-07:00")))); + assertThat(response.getReceipts().get(0).getHasAttachments(), is(equalTo(false))); + //System.out.println(response.getReceipts().get(0).toString()); + } + + @Test + public void updateReceiptTest() throws IOException { + System.out.println("@Test - updateReceipt"); + UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Receipts receipts = new Receipts(); + Receipts response = accountingApi.updateReceipt(receiptID, receipts); + + assertThat(response.getReceipts().get(0).getDate(), is(equalTo(LocalDate.of(2019,03,15)))); + assertThat(response.getReceipts().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getReceipts().get(0).getUser().getUserID(), is(equalTo(UUID.fromString("d1164823-0ac1-41ad-987b-b4e30fe0b273")))); + assertThat(response.getReceipts().get(0).getReference(), is(equalTo("Foobar"))); + assertThat(response.getReceipts().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); + assertThat(response.getReceipts().get(0).getSubTotal(), is(equalTo(40.0))); + assertThat(response.getReceipts().get(0).getSubTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getReceipts().get(0).getTotalTax(), is(equalTo(0.0))); + assertThat(response.getReceipts().get(0).getTotalTax().toString(), is(equalTo("0.0"))); + assertThat(response.getReceipts().get(0).getTotal(), is(equalTo(40.0))); + assertThat(response.getReceipts().get(0).getTotal().toString(), is(equalTo("40.0"))); + assertThat(response.getReceipts().get(0).getReceiptID(), is(equalTo(UUID.fromString("e3686fdc-c661-4581-b9df-cbb20782ea66")))); + assertThat(response.getReceipts().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Receipt.StatusEnum.DRAFT))); + assertThat(response.getReceipts().get(0).getReceiptNumber(), is(equalTo("2"))); + assertThat(response.getReceipts().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-15T11:45:56.927-07:00")))); + assertThat(response.getReceipts().get(0).getHasAttachments(), is(equalTo(false))); + //System.out.println(response.getReceipts().get(0).toString()); + } + /* + @Test + public void updateReceiptAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - updateReceiptAttachmentByFileName"); + UUID receiptID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + String fileName = "sample5.jpg"; + Attachments response = accountingApi.updateReceiptAttachmentByFileName(receiptID, fileName, body); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("e02a84f6-b83a-4983-b3b9-35cd8880c7bc")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Receipts/a44fd147-af4e-4fe8-a09a-55332df74162/Attachments/HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + */ +} diff --git a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java new file mode 100644 index 00000000..c7e8802d --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java @@ -0,0 +1,242 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiRepeatingInvoicesTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + File body; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + ClassLoader classLoader = getClass().getClassLoader(); + body = new File(classLoader.getResource("helo-heros.jpg").getFile()); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60000); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createRepeatingInvoiceAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - createRepeatingInvoiceAttachmentByFileName"); + UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + String fileName = "sample5.jpg"; + Attachments response = accountingApi.createRepeatingInvoiceAttachmentByFileName(repeatingInvoiceID, fileName, body); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("e078e56c-9a2b-4f6c-a1fa-5d19b0dab611")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("foobar.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/RepeatingInvoices/428c0d75-909f-4b04-8403-a48dc27283b0/Attachments/foobar.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + @Test + public void createRepeatingInvoiceHistoryTest() throws IOException { + System.out.println("@Test - createRepeatingInvoiceHistory - not implmented"); + UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords historyRecords = new HistoryRecords(); + //HistoryRecords response = accountingApi.createRepeatingInvoiceHistory(repeatingInvoiceID, historyRecords); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getRepeatingInvoiceTest() throws IOException { + System.out.println("@Test - getRepeatingInvoice"); + UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + RepeatingInvoices response = accountingApi.getRepeatingInvoice(repeatingInvoiceID); + + assertThat(response.getRepeatingInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.RepeatingInvoice.TypeEnum.ACCREC))); + assertThat(response.getRepeatingInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getPeriod(), is(equalTo(1))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getUnit(), is(equalTo(com.xero.models.accounting.Schedule.UnitEnum.MONTHLY))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getDueDate(), is(equalTo(10))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getDueDateType(), is(equalTo(com.xero.models.accounting.Schedule.DueDateTypeEnum.OFFOLLOWINGMONTH))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getStartDate(), is(equalTo(LocalDate.of(2019,04,14)))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getNextScheduledDate(), is(equalTo(LocalDate.of(2019,04,14)))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getEndDate(), is(equalTo(LocalDate.of(2019,9,29)))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("13a8353c-d2af-4d5b-920c-438449f08900")))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getDescription(), is(equalTo("Guitars Fender Strat"))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(5000.0))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getTaxType(), is(equalTo("OUTPUT2"))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(750.0))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(5000.0))); + assertThat(response.getRepeatingInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getRepeatingInvoices().get(0).getReference(), is(equalTo("[Week]"))); + assertThat(response.getRepeatingInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getRepeatingInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.RepeatingInvoice.StatusEnum.AUTHORISED))); + assertThat(response.getRepeatingInvoices().get(0).getSubTotal(), is(equalTo(5000.0))); + assertThat(response.getRepeatingInvoices().get(0).getSubTotal().toString(), is(equalTo("5000.0"))); + assertThat(response.getRepeatingInvoices().get(0).getTotalTax(), is(equalTo(750.0))); + assertThat(response.getRepeatingInvoices().get(0).getTotalTax().toString(), is(equalTo("750.0"))); + assertThat(response.getRepeatingInvoices().get(0).getTotal(), is(equalTo(5750.0))); + assertThat(response.getRepeatingInvoices().get(0).getTotal().toString(), is(equalTo("5750.0"))); + assertThat(response.getRepeatingInvoices().get(0).getRepeatingInvoiceID(), is(equalTo(UUID.fromString("428c0d75-909f-4b04-8403-a48dc27283b0")))); + assertThat(response.getRepeatingInvoices().get(0).getID(), is(equalTo(UUID.fromString("428c0d75-909f-4b04-8403-a48dc27283b0")))); + assertThat(response.getRepeatingInvoices().get(0).getHasAttachments(), is(equalTo(true))); + assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("2a488b0f-3966-4b6e-a7e1-b6d3286351f2")))); + assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); + assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/Invoices/428c0d75-909f-4b04-8403-a48dc27283b0/Attachments/HelloWorld.jpg"))); + assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getRepeatingInvoices().get(0).getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getRepeatingInvoices().get(0).toString()); + } + + @Test + public void getRepeatingInvoiceAttachmentsTest() throws IOException { + System.out.println("@Test - getRepeatingInvoiceAttachments"); + UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Attachments response = accountingApi.getRepeatingInvoiceAttachments(repeatingInvoiceID); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("2a488b0f-3966-4b6e-a7e1-b6d3286351f2")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/RepeatingInvoices/428c0d75-909f-4b04-8403-a48dc27283b0/Attachments/HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + + @Test + public void getRepeatingInvoiceHistoryTest() throws IOException { + System.out.println("@Test - getRepeatingInvoiceHistory"); + UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + HistoryRecords response = accountingApi.getRepeatingInvoiceHistory(repeatingInvoiceID); + + assertThat(response.getHistoryRecords().get(0).getUser(), is(equalTo("System Generated"))); + assertThat(response.getHistoryRecords().get(0).getChanges(), is(equalTo("Attached a file"))); + assertThat(response.getHistoryRecords().get(0).getDetails(), is(equalTo("Attached the file foobar.jpg through the Xero API using Java Partner Example"))); + assertThat(response.getHistoryRecords().get(0).getDateUTC(), is(equalTo(OffsetDateTime.parse("2019-03-15T15:07:28.587-07:00")))); + //System.out.println(response.getHistoryRecords().get(0).toString()); + } + + @Test + public void getRepeatingInvoicesTest() throws IOException { + System.out.println("@Test - getRepeatingInvoices"); + String where = null; + String order = null; + RepeatingInvoices response = accountingApi.getRepeatingInvoices(where, order); + + assertThat(response.getRepeatingInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.RepeatingInvoice.TypeEnum.ACCREC))); + assertThat(response.getRepeatingInvoices().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getPeriod(), is(equalTo(1))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getUnit(), is(equalTo(com.xero.models.accounting.Schedule.UnitEnum.MONTHLY))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getDueDate(), is(equalTo(10))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getDueDateType(), is(equalTo(com.xero.models.accounting.Schedule.DueDateTypeEnum.OFFOLLOWINGMONTH))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getStartDate(), is(equalTo(LocalDate.of(2019,04,14)))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getNextScheduledDate(), is(equalTo(LocalDate.of(2019,04,14)))); + assertThat(response.getRepeatingInvoices().get(0).getSchedule().getEndDate(), is(equalTo(LocalDate.of(2019,9,29)))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getLineItemID(), is(equalTo(UUID.fromString("13a8353c-d2af-4d5b-920c-438449f08900")))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getDescription(), is(equalTo("Guitars Fender Strat"))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getQuantity(), is(equalTo(1.0))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getUnitAmount(), is(equalTo(5000.0))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getTaxType(), is(equalTo("OUTPUT2"))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("200"))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(750.0))); + assertThat(response.getRepeatingInvoices().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(5000.0))); + assertThat(response.getRepeatingInvoices().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.EXCLUSIVE))); + assertThat(response.getRepeatingInvoices().get(0).getReference(), is(equalTo("[Week]"))); + assertThat(response.getRepeatingInvoices().get(0).getCurrencyCode(), is(equalTo(com.xero.models.accounting.CurrencyCode.NZD))); + assertThat(response.getRepeatingInvoices().get(0).getStatus(), is(equalTo(com.xero.models.accounting.RepeatingInvoice.StatusEnum.AUTHORISED))); + assertThat(response.getRepeatingInvoices().get(0).getSubTotal(), is(equalTo(5000.0))); + assertThat(response.getRepeatingInvoices().get(0).getSubTotal().toString(), is(equalTo("5000.0"))); + assertThat(response.getRepeatingInvoices().get(0).getTotalTax(), is(equalTo(750.0))); + assertThat(response.getRepeatingInvoices().get(0).getTotalTax().toString(), is(equalTo("750.0"))); + assertThat(response.getRepeatingInvoices().get(0).getTotal(), is(equalTo(5750.0))); + assertThat(response.getRepeatingInvoices().get(0).getTotal().toString(), is(equalTo("5750.0"))); + assertThat(response.getRepeatingInvoices().get(0).getRepeatingInvoiceID(), is(equalTo(UUID.fromString("428c0d75-909f-4b04-8403-a48dc27283b0")))); + assertThat(response.getRepeatingInvoices().get(0).getID(), is(equalTo(UUID.fromString("428c0d75-909f-4b04-8403-a48dc27283b0")))); + assertThat(response.getRepeatingInvoices().get(0).getHasAttachments(), is(equalTo(true))); + //System.out.println(response.getRepeatingInvoices().get(0).toString()); + } +/* + @Test + public void updateRepeatingInvoiceAttachmentByFileNameTest() throws IOException { + System.out.println("@Test - updateRepeatingInvoiceAttachmentByFileName"); + UUID repeatingInvoiceID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + String fileName = "sample5.jpg"; + Attachments response = accountingApi.updateRepeatingInvoiceAttachmentByFileName(repeatingInvoiceID, fileName, body); + + assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("d086d5f4-9c3d-4edc-a87e-906248eeb652")))); + assertThat(response.getAttachments().get(0).getFileName(), is(equalTo("HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getMimeType(), is(equalTo("image/jpg"))); + assertThat(response.getAttachments().get(0).getUrl(), is(equalTo("https://api.xero.com/api.xro/2.0/RepeatingInvoices/428c0d75-909f-4b04-8403-a48dc27283b0/Attachments/HelloWorld.jpg"))); + assertThat(response.getAttachments().get(0).getContentLength(), is(equalTo(new BigDecimal("2878711")))); + assertThat(response.getAttachments().get(0).getIncludeOnline(), is(equalTo(null))); + //System.out.println(response.getAttachments().get(0).toString()); + } + */ +} diff --git a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java new file mode 100644 index 00000000..f07df248 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java @@ -0,0 +1,401 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiReportsTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60000); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void getReportAgedPayablesByContactTest() throws IOException { + System.out.println("@Test - getReportAgedPayablesByContact"); + UUID contactId = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + LocalDate date = null; + LocalDate fromDate = null; + LocalDate toDate = null; + ReportWithRows response = accountingApi.getReportAgedPayablesByContact(contactId, date, fromDate, toDate); + + assertThat(response.getReports().get(0).getReportID(), is(equalTo("AgedPayablesByContact"))); + assertThat(response.getReports().get(0).getReportName(), is(equalTo("Aged Payables By Contact"))); + assertThat(response.getReports().get(0).getReportType(), is("AgedPayablesByContact")); + assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Invoices"))); + assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("ABC"))); + assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("From 10 October 2017 to 22 April 2019"))); + assertThat(response.getReports().get(0).getReportTitles().get(3), is(equalTo("Showing payments to 22 April 2019"))); + assertThat(response.getReports().get(0).getReportDate(), is(equalTo("22 April 2019"))); + assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-22T15:11:28.085-07:00")))); + assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Date"))); + assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("2017-10-10T00:00:00"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Opening Balance"))); + assertThat(response.getReports().get(0).getRows().get(2).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getValue(), is(equalTo("2018-10-09T00:00:00"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("invoiceID"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("1f3960ae-0537-4438-a4dd-76d785e6d7d8"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SUMMARYROW))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(0).getValue(), is(equalTo("Total"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(4).getValue(), is(equalTo("250.00"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(7).getValue(), is(equalTo("250.00"))); + //System.out.println(response.getReports().toString()); + } + + @Test + public void getReportAgedReceivablesByContactTest() throws IOException { + System.out.println("@Test - getReportAgedReceivablesByContact"); + UUID contactId = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + LocalDate date = null; + LocalDate fromDate = null; + LocalDate toDate = null; + ReportWithRows response = accountingApi.getReportAgedReceivablesByContact(contactId, date, fromDate, toDate); + + assertThat(response.getReports().get(0).getReportID(), is(equalTo("AgedReceivablesByContact"))); + assertThat(response.getReports().get(0).getReportName(), is(equalTo("Aged Receivables By Contact"))); + assertThat(response.getReports().get(0).getReportType(), is("AgedReceivablesByContact")); + assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Invoices"))); + assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("ABC"))); + assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("From 10 October 2017 to 23 April 2019"))); + assertThat(response.getReports().get(0).getReportTitles().get(3), is(equalTo("Showing payments to 23 April 2019"))); + assertThat(response.getReports().get(0).getReportDate(), is(equalTo("23 April 2019"))); + assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-23T08:21:02.815-07:00")))); + assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Date"))); + assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("2017-10-10T00:00:00"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Opening Balance"))); + assertThat(response.getReports().get(0).getRows().get(2).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getValue(), is(equalTo("2018-05-13T00:00:00"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("invoiceID"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("40ebad47-24e2-4dc9-a5f5-579df427671b"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(0).getValue(), is(equalTo("2019-04-23T00:00:00"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(4).getValue(), is(equalTo("50.00"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(7).getValue(), is(equalTo("50.00"))); + assertThat(response.getReports().get(0).getRows().get(3).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(3).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SUMMARYROW))); + assertThat(response.getReports().get(0).getRows().get(3).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Closing Balance"))); + assertThat(response.getReports().get(0).getRows().get(3).getRows().get(0).getCells().get(4).getValue(), is(equalTo("150.00"))); + //System.out.println(response.getReports().get(0).toString()); + } + + @Test + public void getReportBalanceSheetTest() throws IOException { + System.out.println("@Test - getReportBalanceSheet"); + String date = null; + Integer periods = null; + String timeframe = null; + String trackingOptionID1 = null; + String trackingOptionID2 = null; + Boolean standardLayout = null; + Boolean paymentsOnly = null; + ReportWithRows response = accountingApi.getReportBalanceSheet(date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); + + assertThat(response.getReports().get(0).getReportID(), is(equalTo("BalanceSheet"))); + assertThat(response.getReports().get(0).getReportName(), is(equalTo("Balance Sheet"))); + assertThat(response.getReports().get(0).getReportType(), is(equalTo("BalanceSheet"))); + assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Balance Sheet"))); + assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 3 (NZ-2016-02)"))); + assertThat(response.getReports().get(0).getReportDate(), is(equalTo("12 April 2019"))); + assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-12T13:03:32.778-07:00")))); + assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("30 Apr 2019"))); + assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(1).getTitle(), is(equalTo("Assets"))); + assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(2).getTitle(), is(equalTo("Bank"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Country Savings"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("041207d2-3d61-4e5d-8c1a-b9236955a71c"))); + //System.out.println(response.getReports().toString()); + } + + @Test + public void getReportBankSummaryTest() throws IOException { + System.out.println("@Test - getReportBankSummary"); + LocalDate date = null; + Integer period = null; + Integer timeframe = null; + + ReportWithRows response = accountingApi.getReportBankSummary(date, period, timeframe); + assertThat(response.getReports().get(0).getReportID(), is(equalTo("BankSummary"))); + assertThat(response.getReports().get(0).getReportName(), is(equalTo("Bank Summary"))); + assertThat(response.getReports().get(0).getReportType(), is("BankSummary")); + assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Bank Summary"))); + assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("MindBody Test 10 (AU-2016-02)"))); + assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("From 1 April 2019 to 30 April 2019"))); + assertThat(response.getReports().get(0).getReportDate(), is(equalTo("23 April 2019"))); + assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-23T09:05:26.223-07:00")))); + assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Bank Accounts"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Opening Balance"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(2).getValue(), is(equalTo("Cash Received"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(3).getValue(), is(equalTo("Cash Spent"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(4).getValue(), is(equalTo("Closing Balance"))); + assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big City Bank"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("accountID"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("03f9cf1e-2deb-4bf1-b0a8-b57f08672eb8"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SUMMARYROW))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(0).getValue(), is(equalTo("Total"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(4).getValue(), is(equalTo("10.00"))); + //System.out.println(response.getReports().get(0).toString()); + } + + @Test + public void getReportExecutiveSummaryTest() throws IOException { + System.out.println("@Test - getReportExecutiveSummary"); + LocalDate date = null; + ReportWithRows response = accountingApi.getReportExecutiveSummary(date); + + assertThat(response.getReports().get(0).getReportID(), is(equalTo("ExecutiveSummary"))); + assertThat(response.getReports().get(0).getReportName(), is(equalTo("Executive Summary"))); + assertThat(response.getReports().get(0).getReportType(), is("ExecutiveSummary")); + assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Executive Summary"))); + assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); + assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("For the month of April 2019"))); + assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); + assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T11:04:57.941-07:00")))); + assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Apr 2019"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(2).getValue(), is(equalTo("Mar 2019"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(3).getValue(), is(equalTo("Variance"))); + assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(1).getTitle(), is("Cash")); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Cash received"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getValue(), is(equalTo("0.00"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(2).getValue(), is(equalTo("0.00"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(3).getValue(), is(equalTo("0.0%"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(0).getValue(), is(equalTo("Cash spent"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(1).getValue(), is(equalTo("0.00"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(2).getValue(), is(equalTo("20.00"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(3).getValue(), is(equalTo("-100.0%"))); + //System.out.println(response.getReports().get(0).toString()); + } + + @Test + public void getReportTenNinetyNineTest() throws IOException { + System.out.println("@Test - getReportTenNinetyNine"); + String reportYear = null; + Reports response = accountingApi.getReportTenNinetyNine(reportYear); + + assertThat(response.getReports().get(0).getReportName(), is(equalTo("1099 report"))); + assertThat(response.getReports().get(0).getReportDate(), is(equalTo("1 Jan 2016 to 31 Dec 2016"))); + assertThat(response.getReports().get(0).getContacts().get(0).getBox3(), is(equalTo(1000.00))); + assertThat(response.getReports().get(0).getContacts().get(0).getName(), is(equalTo("Bank West"))); + assertThat(response.getReports().get(0).getContacts().get(0).getFederalTaxIDType(), is(equalTo("SSN"))); + assertThat(response.getReports().get(0).getContacts().get(0).getCity(), is(equalTo("Pinehaven"))); + assertThat(response.getReports().get(0).getContacts().get(0).getZip(), is(equalTo("12345"))); + assertThat(response.getReports().get(0).getContacts().get(0).getState(), is(equalTo("CA"))); + assertThat(response.getReports().get(0).getContacts().get(0).getEmail(), is(equalTo("jack@bowest.com"))); + assertThat(response.getReports().get(0).getContacts().get(0).getTaxID(), is(equalTo("234-22-2223"))); + assertThat(response.getReports().get(0).getContacts().get(0).getContactId(), is(equalTo(UUID.fromString("81d5706a-8057-4338-8511-747cd85f4c68")))); + assertThat(response.getReports().get(0).getContacts().get(2).getBox1(), is(equalTo(5543.75))); + //System.out.println(response.getReports().toString()); + } + + @Test + public void getReportTrialBalanceTest() throws IOException { + System.out.println("@Test - getReportTrialBalance"); + LocalDate date = null; + Boolean paymentsOnly = null; + ReportWithRows response = accountingApi.getReportTrialBalance(date, paymentsOnly); + + assertThat(response.getReports().get(0).getReportID(), is(equalTo("TrialBalance"))); + assertThat(response.getReports().get(0).getReportName(), is(equalTo("Trial Balance"))); + assertThat(response.getReports().get(0).getReportType(), is("TrialBalance")); + assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Trial Balance"))); + assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); + assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("As at 24 April 2019"))); + assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); + assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T11:12:38.724-07:00")))); + assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Account"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Debit"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(2).getValue(), is(equalTo("Credit"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(3).getValue(), is(equalTo("YTD Debit"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(4).getValue(), is(equalTo("YTD Credit"))); + assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(1).getTitle(), is("Revenue")); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big Expense (002)"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); + //System.out.println(response.getReports().get(0).toString()); + } + + @Test + public void getReportBudgetSummaryTest() throws IOException { + System.out.println("@Test - getReportBudgetSummary"); + LocalDate date = null; + Integer period = null; + Integer timeframe = null; + ReportWithRows response = accountingApi.getReportBudgetSummary(date, period, timeframe); + + assertThat(response.getReports().get(0).getReportID(), is(equalTo("BudgetSummary"))); + assertThat(response.getReports().get(0).getReportName(), is(equalTo("Budget Summary"))); + assertThat(response.getReports().get(0).getReportType(), is("BudgetSummary")); + assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Overall Budget"))); + assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Budget Summary"))); + assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); + assertThat(response.getReports().get(0).getReportTitles().get(3), is(equalTo("April 2019 to March 2022"))); + assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); + assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T11:59:36.350-07:00")))); + assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Account"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Jun-19"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(2).getValue(), is(equalTo("Sep-19"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(3).getValue(), is(equalTo("Dec-19"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(4).getValue(), is(equalTo("Mar-20"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(5).getValue(), is(equalTo("Jun-20"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(6).getValue(), is(equalTo("Sep-20"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(7).getValue(), is(equalTo("Dec-20"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(8).getValue(), is(equalTo("Mar-21"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(9).getValue(), is(equalTo("Jun-21"))); + assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(1).getTitle(), is("Income")); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big Expense"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); + //System.out.println(response.toString()); + } + + @Test + public void getReportProfitAndLossTest() throws IOException { + System.out.println("@Test - getReportProfitAndLoss"); + + LocalDate fromDate = null; + LocalDate toDate = null; + String timeframe = "MONTH"; + Boolean standardLayout = true; + Boolean paymentsOnly = false; + + Integer periods = null; + String trackingCategoryID = null; + String trackingCategoryID2 = null; + String trackingOptionID = null; + String trackingOptionID2 = null; + ReportWithRows response = accountingApi.getReportProfitAndLoss(fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); + + assertThat(response.getReports().get(0).getReportID(), is(equalTo("ProfitAndLoss"))); + assertThat(response.getReports().get(0).getReportName(), is(equalTo("Profit and Loss"))); + assertThat(response.getReports().get(0).getReportType(), is("ProfitAndLoss")); + assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Income Statement"))); + assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); + assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("10 October 2018 to 24 April 2019"))); + assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); + assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T12:12:53.644-07:00")))); + assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("24 Apr 19"))); + assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + assertThat(response.getReports().get(0).getRows().get(1).getTitle(), is("Revenue")); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big Expense"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getValue(), is(equalTo("480.00"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getAttributes().get(0).getId(), is(equalTo("account"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); + //System.out.println(response.toString()); + } + + @Test + public void getReportBASorGSTTest() throws IOException { + System.out.println("@Test - getReportBASorGST - not implemented"); + String reportID = null; + //ReportWithRows response = accountingApi.getReportBASorGST(reportID); + + // TODO: test validations + //System.out.println(response.getReports().get(0).toString()); + } + + @Test + public void getReportBASorGSTListTest() throws IOException { + System.out.println("@Test - getReportBASorGSTList - not implemented"); + //ReportWithRows response = accountingApi.getReportBASorGSTList(); + + // TODO: test validations + //System.out.println(response.getReports().get(0).toString()); + } +} \ No newline at end of file diff --git a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java new file mode 100644 index 00000000..db7fd787 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java @@ -0,0 +1,163 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiTaxRatesTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60000); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createTaxRateTest() throws IOException { + System.out.println("@Test - createTaxRate"); + TaxRates taxRates = new TaxRates(); + TaxRates response = accountingApi.createTaxRate(taxRates); + + assertThat(response.getTaxRates().get(0).getName(), is(equalTo("SDKTax29067"))); + assertThat(response.getTaxRates().get(0).getTaxType(), is(equalTo("TAX002"))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getName(), is(equalTo("State Tax"))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getRate(), is(equalTo(2.25))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsCompound(), is(equalTo(false))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsNonRecoverable(), is(equalTo(false))); + assertThat(response.getTaxRates().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TaxRate.StatusEnum.ACTIVE))); + assertThat(response.getTaxRates().get(0).getReportTaxType(), is(equalTo(com.xero.models.accounting.TaxRate.ReportTaxTypeEnum.INPUT))); + assertThat(response.getTaxRates().get(0).getCanApplyToAssets(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToEquity(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToExpenses(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToLiabilities(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToRevenue(), is(equalTo(false))); + assertThat(response.getTaxRates().get(0).getDisplayTaxRate(), is(equalTo(2.25))); + assertThat(response.getTaxRates().get(0).getDisplayTaxRate().toString(), is(equalTo("2.25"))); + assertThat(response.getTaxRates().get(0).getEffectiveRate(), is(equalTo(2.25))); + assertThat(response.getTaxRates().get(0).getEffectiveRate().toString(), is(equalTo("2.25"))); + //System.out.println(response.getTaxRates().get(0).toString()); + } + + @Test + public void getTaxRatesTest() throws IOException { + System.out.println("@Test - getTaxRates"); + String where = null; + String order = null; + String taxType = null; + TaxRates response = accountingApi.getTaxRates(where, order, taxType); + + assertThat(response.getTaxRates().get(0).getName(), is(equalTo("15% GST on Expenses"))); + assertThat(response.getTaxRates().get(0).getTaxType(), is(equalTo("INPUT2"))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getName(), is(equalTo("GST"))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getRate(), is(equalTo(15.0))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsCompound(), is(equalTo(false))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsNonRecoverable(), is(equalTo(false))); + assertThat(response.getTaxRates().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TaxRate.StatusEnum.ACTIVE))); + assertThat(response.getTaxRates().get(0).getReportTaxType(), is(equalTo(com.xero.models.accounting.TaxRate.ReportTaxTypeEnum.INPUT))); + assertThat(response.getTaxRates().get(0).getCanApplyToAssets(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToEquity(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToExpenses(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToLiabilities(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToRevenue(), is(equalTo(false))); + assertThat(response.getTaxRates().get(0).getDisplayTaxRate(), is(equalTo(15.0))); + assertThat(response.getTaxRates().get(0).getDisplayTaxRate().toString(), is(equalTo("15.0"))); + assertThat(response.getTaxRates().get(0).getEffectiveRate(), is(equalTo(15.0))); + assertThat(response.getTaxRates().get(0).getEffectiveRate().toString(), is(equalTo("15.0"))); + //System.out.println(response.getTaxRates().get(0).toString()); + } + + @Test + public void updateTaxRateTest() throws IOException { + System.out.println("@Test - updateTaxRate"); + TaxRates taxRates = new TaxRates(); + TaxRates response = accountingApi.updateTaxRate(taxRates); + + assertThat(response.getTaxRates().get(0).getName(), is(equalTo("SDKTax29067"))); + assertThat(response.getTaxRates().get(0).getTaxType(), is(equalTo("TAX002"))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getName(), is(equalTo("State Tax"))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getRate(), is(equalTo(2.25))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsCompound(), is(equalTo(false))); + assertThat(response.getTaxRates().get(0).getTaxComponents().get(0).getIsNonRecoverable(), is(equalTo(false))); + assertThat(response.getTaxRates().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TaxRate.StatusEnum.DELETED))); + assertThat(response.getTaxRates().get(0).getReportTaxType(), is(equalTo(com.xero.models.accounting.TaxRate.ReportTaxTypeEnum.INPUT))); + assertThat(response.getTaxRates().get(0).getCanApplyToAssets(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToEquity(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToExpenses(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToLiabilities(), is(equalTo(true))); + assertThat(response.getTaxRates().get(0).getCanApplyToRevenue(), is(equalTo(false))); + assertThat(response.getTaxRates().get(0).getDisplayTaxRate(), is(equalTo(2.25))); + assertThat(response.getTaxRates().get(0).getDisplayTaxRate().toString(), is(equalTo("2.25"))); + assertThat(response.getTaxRates().get(0).getEffectiveRate(), is(equalTo(2.25))); + assertThat(response.getTaxRates().get(0).getEffectiveRate().toString(), is(equalTo("2.25"))); + //System.out.println(response.getTaxRates().get(0).toString()); + } +} \ No newline at end of file diff --git a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java new file mode 100644 index 00000000..a5b71eb7 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java @@ -0,0 +1,172 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiTrackingCategoriesTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60000); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void createTrackingCategoryTest() throws IOException { + System.out.println("@Test - createTrackingCategory"); + TrackingCategory trackingCategory = new TrackingCategory(); + TrackingCategories response = accountingApi.createTrackingCategory(trackingCategory); + + assertThat(response.getTrackingCategories().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("b1df776b-b093-4730-b6ea-590cca40e723")))); + assertThat(response.getTrackingCategories().get(0).getName(), is(equalTo("FooBar"))); + assertThat(response.getTrackingCategories().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingCategory.StatusEnum.ACTIVE))); + //System.out.println(response.getTrackingCategories().get(0).toString()); + } + + @Test + public void createTrackingOptionsTest() throws IOException { + System.out.println("@Test - createTrackingOptions"); + UUID trackingCategoryID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + TrackingOption trackingOption = new TrackingOption(); + TrackingOptions response = accountingApi.createTrackingOptions(trackingCategoryID, trackingOption); + + assertThat(response.getOptions().get(0).getTrackingOptionID(), is(equalTo(UUID.fromString("34669548-b989-487a-979f-0787d04568a2")))); + assertThat(response.getOptions().get(0).getName(), is(equalTo("Bar40423"))); + assertThat(response.getOptions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingOption.StatusEnum.ACTIVE))); + //System.out.println(response.getOptions().get(0).toString()); + } + + @Test + public void deleteTrackingCategoryTest() throws IOException { + System.out.println("@Test - deleteTrackingCategory"); + UUID trackingCategoryID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + TrackingCategories response = accountingApi.deleteTrackingCategory(trackingCategoryID); + + assertThat(response.getTrackingCategories().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("0390bdfd-94f2-49d6-b7a0-4a38c46ebf03")))); + assertThat(response.getTrackingCategories().get(0).getName(), is(equalTo("Foo46189"))); + assertThat(response.getTrackingCategories().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingCategory.StatusEnum.DELETED))); + //System.out.println(response.getTrackingCategories().get(0).toString()); + } + + @Test + public void deleteTrackingOptionsTest() throws IOException { + System.out.println("@Test - deleteTrackingOptions"); + UUID trackingCategoryID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + UUID trackingOptionID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + TrackingOptions response = accountingApi.deleteTrackingOptions(trackingCategoryID, trackingOptionID); + + assertThat(response.getOptions().get(0).getTrackingOptionID(), is(equalTo(UUID.fromString("34669548-b989-487a-979f-0787d04568a2")))); + assertThat(response.getOptions().get(0).getName(), is(equalTo("Bar40423"))); + assertThat(response.getOptions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingOption.StatusEnum.DELETED))); + //System.out.println(response.getOptions().toString()); + } + + @Test + public void getTrackingCategoriesTest() throws IOException { + System.out.println("@Test - getTrackingCategories"); + String where = null; + String order = null; + Boolean includeArchived = null; + TrackingCategories response = accountingApi.getTrackingCategories(where, order, includeArchived); + + assertThat(response.getTrackingCategories().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("22f10184-0deb-44ae-a312-b1f6ea70e51f")))); + assertThat(response.getTrackingCategories().get(0).getName(), is(equalTo("BarFoo"))); + assertThat(response.getTrackingCategories().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingCategory.StatusEnum.ACTIVE))); + //System.out.println(response.getTrackingCategories().get(0).toString()); + } + + @Test + public void getTrackingCategoryTest() throws IOException { + System.out.println("@Test - getTrackingCategory"); + UUID trackingCategoryID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + TrackingCategories response = accountingApi.getTrackingCategory(trackingCategoryID); + + assertThat(response.getTrackingCategories().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("22f10184-0deb-44ae-a312-b1f6ea70e51f")))); + assertThat(response.getTrackingCategories().get(0).getName(), is(equalTo("Foo41157"))); + assertThat(response.getTrackingCategories().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingCategory.StatusEnum.DELETED))); + //System.out.println(response.getTrackingCategories().get(0).toString()); + } + + @Test + public void updateTrackingCategoryTest() throws IOException { + System.out.println("@Test - updateTrackingCategory"); + UUID trackingCategoryID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + TrackingCategory trackingCategory = new TrackingCategory(); + TrackingCategories response = accountingApi.updateTrackingCategory(trackingCategoryID, trackingCategory); + + assertThat(response.getTrackingCategories().get(0).getTrackingCategoryID(), is(equalTo(UUID.fromString("b1df776b-b093-4730-b6ea-590cca40e723")))); + assertThat(response.getTrackingCategories().get(0).getName(), is(equalTo("BarFoo"))); + assertThat(response.getTrackingCategories().get(0).getStatus(), is(equalTo(com.xero.models.accounting.TrackingCategory.StatusEnum.ACTIVE))); + //System.out.println(response.getTrackingCategories().get(0).toString()); + } +} \ No newline at end of file diff --git a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java new file mode 100644 index 00000000..52f42b09 --- /dev/null +++ b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java @@ -0,0 +1,117 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.accounting.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; +import java.util.List; +import java.util.ArrayList; +import java.math.BigDecimal; + +public class AccountingApiUsersTest { + + ApiClient defaultClient; + AccountingApi accountingApi; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + // Set Access Token from Storage + String accessToken = "123"; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,requestFactory); + accountingApi = new AccountingApi(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } + + try { + System.out.println("Sleep for 30 seconds"); + Thread.sleep(60000); + } catch(InterruptedException e) { + System.out.println(e); + } + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + accountingApi = null; + defaultClient = null; + } + + @Test + public void getUserTest() throws IOException { + System.out.println("@Test - getUser"); + UUID userID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + Users response = accountingApi.getUser(userID); + + assertThat(response.getUsers().get(0).getUserID(), is(equalTo(UUID.fromString("3c37ef1d-cd49-4589-9787-3c418ed8b6ac")))); + assertThat(response.getUsers().get(0).getEmailAddress(), is(equalTo("sid.maestre@xero.com"))); + assertThat(response.getUsers().get(0).getFirstName(), is(equalTo("Sidney"))); + assertThat(response.getUsers().get(0).getLastName(), is(equalTo("Maestre"))); + assertThat(response.getUsers().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-10-20T11:14:21.613-07:00")))); + assertThat(response.getUsers().get(0).getIsSubscriber(), is(equalTo(false))); + assertThat(response.getUsers().get(0).getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); + //System.out.println(response.getUsers().get(0).toString()); + } + + @Test + public void getUsersTest() throws IOException { + System.out.println("@Test - getUsers"); + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + Users response = accountingApi.getUsers(ifModifiedSince, where, order); + + assertThat(response.getUsers().get(0).getUserID(), is(equalTo(UUID.fromString("3c37ef1d-cd49-4589-9787-3c418ed8b6ac")))); + assertThat(response.getUsers().get(0).getEmailAddress(), is(equalTo("sid.maestre@xero.com"))); + assertThat(response.getUsers().get(0).getFirstName(), is(equalTo("Sidney"))); + assertThat(response.getUsers().get(0).getLastName(), is(equalTo("Maestre"))); + assertThat(response.getUsers().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2017-10-20T11:14:21.613-07:00")))); + assertThat(response.getUsers().get(0).getIsSubscriber(), is(equalTo(false))); + assertThat(response.getUsers().get(0).getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER))); + //System.out.println(response.getUsers().toString()); + } +} From ecb5b7fb1bb9551ddf26a7cb62843373c0eb968c Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Wed, 26 Jun 2019 22:15:10 -0700 Subject: [PATCH 13/76] remove unnecessary dependencies --- pom.xml | 61 ++------------------------------------------------------- 1 file changed, 2 insertions(+), 59 deletions(-) diff --git a/pom.xml b/pom.xml index 9c7dbaeb..1cbf2851 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.xeroapi xero-java jar - 3.0.0-beta-5 + 3.0.0-beta-6 Xero-Java SDK This is the official Java SDK for Xero API https://github.com/XeroAPI/Xero-Java @@ -43,11 +43,6 @@ google-api-client ${google-api-client-version} - - com.github.scribejava - scribejava-apis - 6.6.2 - com.googlecode.json-simple json-simple @@ -77,16 +72,6 @@ 1.3 test - - org.apache.httpcomponents - httpclient - ${org-apache-httpcomponents} - - - org.apache.httpcomponents - httpmime - ${org-apache-httpcomponents} - org.apache.logging.log4j log4j-api @@ -124,7 +109,6 @@ ${swagger-annotations-version} - org.glassfish.jersey.core @@ -148,36 +132,6 @@ 2.2 - - - - io.github.openfeign - feign-core - ${feign-version} - - - io.github.openfeign - feign-jackson - ${feign-version} - - - io.github.openfeign - feign-slf4j - ${feign-version} - - - io.github.openfeign.form - feign-form - ${feign-form-version} - - - - - org.apache.oltu.oauth2 - org.apache.oltu.oauth2.client - ${oltu-version} - - junit @@ -185,18 +139,7 @@ ${junit-version} test - - com.squareup.okhttp3 - mockwebserver - 3.6.0 - test - - - org.assertj - assertj-core - 1.7.1 - test - + Xero-Java-SDK From 33a92d595b3e65031d1d19cc9dbc15f0b47574b8 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Wed, 26 Jun 2019 22:20:04 -0700 Subject: [PATCH 14/76] fix basePath for connection in identity --- src/main/java/com/xero/api/client/IdentityApi.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/xero/api/client/IdentityApi.java b/src/main/java/com/xero/api/client/IdentityApi.java index 639bfecd..4d618f4c 100644 --- a/src/main/java/com/xero/api/client/IdentityApi.java +++ b/src/main/java/com/xero/api/client/IdentityApi.java @@ -75,7 +75,7 @@ public HttpResponse getConnectionsForHttpResponse() throws IOException { headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); String correctPath = "/connections"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + UriBuilder uriBuilder = UriBuilder.fromUri("https://api.xero.com" + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); From 0d08a4c83400515ef792875ba48051a6d6934b65 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Wed, 26 Jun 2019 22:36:26 -0700 Subject: [PATCH 15/76] added userAgent string to header --- pom.xml | 2 +- .../com/xero/api/client/AccountingApi.java | 393 +++++++++++++++++- 2 files changed, 393 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1cbf2851..80868ab9 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.xeroapi xero-java jar - 3.0.0-beta-6 + 3.0.0-beta-7 Xero-Java SDK This is the official Java SDK for Xero API https://github.com/XeroAPI/Xero-Java diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index d9d9cc93..da064f6d 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -68,6 +68,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; +import java.util.List; import org.apache.commons.io.IOUtils; import org.apache.logging.log4j.LogManager; @@ -77,6 +78,8 @@ public class AccountingApi { private ApiClient apiClient; private String xeroTenantId; + private String userAgent = "Default"; + private String version = "3.0.0-beta-7"; public AccountingApi() { this(new ApiClient()); @@ -94,7 +97,7 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } - public String getXeroTenantId(String xeroTenantId) { + public String getXeroTenantId() { return xeroTenantId; } @@ -102,6 +105,14 @@ public void setXeroTenantId(String xeroTenantId) { this.xeroTenantId = xeroTenantId; } + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public String getUserAgent() { + return this.userAgent + "[Xero-Java-" + this.version + "]"; + } + /** * Allows you to create a new chart of accounts *

200 - Success - created new Account and return response of type Accounts array with new Account @@ -124,6 +135,8 @@ public HttpResponse createAccountForHttpResponse( Account account) throws IOExce HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Accounts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -173,6 +186,8 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( UUID accou HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; // create a map of path variables @@ -223,6 +238,8 @@ public HttpResponse createBankTransactionForHttpResponse( BankTransactions bankT HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransactions"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { @@ -283,6 +300,8 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( UU HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; // create a map of path variables @@ -336,6 +355,8 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse( UUID bank HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransactions/{BankTransactionID}/History"; // create a map of path variables @@ -382,6 +403,8 @@ public HttpResponse createBankTransferForHttpResponse( BankTransfers bankTransfe HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransfers"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -430,6 +453,8 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; // create a map of path variables @@ -482,6 +507,8 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse( UUID bankTra HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransfers/{BankTransferID}/History"; // create a map of path variables @@ -528,6 +555,8 @@ public HttpResponse createBatchPaymentForHttpResponse( BatchPayments batchPaymen HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BatchPayments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -573,6 +602,8 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( UUID batchPa HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BatchPayments/{BatchPaymentID}/History"; // create a map of path variables @@ -623,6 +654,8 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse( UUID bran HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; // create a map of path variables @@ -668,6 +701,8 @@ public HttpResponse createContactForHttpResponse( Contact contact) throws IOExce HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -716,6 +751,8 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( UUID conta HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; // create a map of path variables @@ -765,6 +802,8 @@ public HttpResponse createContactGroupForHttpResponse( ContactGroups contactGrou HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ContactGroups"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -810,6 +849,8 @@ public HttpResponse createContactGroupContactsForHttpResponse( UUID contactGroup HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; // create a map of path variables @@ -860,6 +901,8 @@ public HttpResponse createContactHistoryForHttpResponse( UUID contactID, Histor HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts/{ContactID}/History"; // create a map of path variables @@ -907,6 +950,8 @@ public HttpResponse createCreditNoteForHttpResponse( CreditNotes creditNotes, B HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { @@ -963,6 +1008,8 @@ public HttpResponse createCreditNoteAllocationForHttpResponse( UUID creditNoteID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes/{CreditNoteID}/Allocations"; // create a map of path variables @@ -1017,6 +1064,8 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( UUID cr HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; // create a map of path variables @@ -1070,6 +1119,8 @@ public HttpResponse createCreditNoteHistoryForHttpResponse( UUID creditNoteID, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes/{CreditNoteID}/History"; // create a map of path variables @@ -1114,6 +1165,8 @@ public HttpResponse createCurrencyForHttpResponse( Currencies currencies) throws HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Currencies"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -1155,6 +1208,8 @@ public HttpResponse createEmployeeForHttpResponse( Employees employees) throws I HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Employees"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -1197,6 +1252,8 @@ public HttpResponse createExpenseClaimForHttpResponse( ExpenseClaims expenseClai HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ExpenseClaims"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { @@ -1252,6 +1309,8 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse( UUID expenseClaimI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; // create a map of path variables @@ -1299,6 +1358,8 @@ public HttpResponse createInvoiceForHttpResponse( Invoices invoices, Boolean su HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { @@ -1359,6 +1420,8 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( UUID invoi HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; // create a map of path variables @@ -1412,6 +1475,8 @@ public HttpResponse createInvoiceHistoryForHttpResponse( UUID invoiceID, Histor HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}/History"; // create a map of path variables @@ -1458,6 +1523,8 @@ public HttpResponse createItemForHttpResponse( Items items) throws IOException { HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Items"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -1502,6 +1569,8 @@ public HttpResponse createItemHistoryForHttpResponse( UUID itemID, HistoryRecor HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Items/{ItemID}/History"; // create a map of path variables @@ -1548,6 +1617,8 @@ public HttpResponse createLinkedTransactionForHttpResponse( LinkedTransactions l HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/LinkedTransactions"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -1589,6 +1660,8 @@ public HttpResponse createManualJournalForHttpResponse( ManualJournals manualJou HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ManualJournals"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -1638,6 +1711,8 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; // create a map of path variables @@ -1691,6 +1766,8 @@ public HttpResponse createOverpaymentAllocationForHttpResponse( UUID overpayment HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Overpayments/{OverpaymentID}/Allocations"; // create a map of path variables @@ -1741,6 +1818,8 @@ public HttpResponse createOverpaymentHistoryForHttpResponse( UUID overpaymentID, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Overpayments/{OverpaymentID}/History"; // create a map of path variables @@ -1787,6 +1866,8 @@ public HttpResponse createPaymentForHttpResponse( Payments payments) throws IOEx HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Payments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -1832,6 +1913,8 @@ public HttpResponse createPaymentHistoryForHttpResponse( UUID paymentID, Histor HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Payments/{PaymentID}/History"; // create a map of path variables @@ -1878,6 +1961,8 @@ public HttpResponse createPaymentServiceForHttpResponse( PaymentServices payment HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/PaymentServices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -1923,6 +2008,8 @@ public HttpResponse createPrepaymentAllocationForHttpResponse( UUID prepaymentID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Prepayments/{PrepaymentID}/Allocations"; // create a map of path variables @@ -1973,6 +2060,8 @@ public HttpResponse createPrepaymentHistoryForHttpResponse( UUID prepaymentID, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Prepayments/{PrepaymentID}/History"; // create a map of path variables @@ -2020,6 +2109,8 @@ public HttpResponse createPurchaseOrderForHttpResponse( PurchaseOrders purchaseO HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/PurchaseOrders"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (summarizeErrors != null) { @@ -2076,6 +2167,8 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse( UUID purchaseOrde HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; // create a map of path variables @@ -2122,6 +2215,8 @@ public HttpResponse createReceiptForHttpResponse( Receipts receipts) throws IOEx HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Receipts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -2171,6 +2266,8 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( UUID recei HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; // create a map of path variables @@ -2224,6 +2321,8 @@ public HttpResponse createReceiptHistoryForHttpResponse( UUID receiptID, Histor HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Receipts/{ReceiptID}/History"; // create a map of path variables @@ -2278,6 +2377,8 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( U HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; // create a map of path variables @@ -2331,6 +2432,8 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( UUID repeating HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; // create a map of path variables @@ -2377,6 +2480,8 @@ public HttpResponse createTaxRateForHttpResponse( TaxRates taxRates) throws IOEx HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/TaxRates"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -2418,6 +2523,8 @@ public HttpResponse createTrackingCategoryForHttpResponse( TrackingCategory trac HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/TrackingCategories"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -2463,6 +2570,8 @@ public HttpResponse createTrackingOptionsForHttpResponse( UUID trackingCategoryI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options"; // create a map of path variables @@ -2509,6 +2618,8 @@ public HttpResponse deleteAccountForHttpResponse( UUID accountID) throws IOExcep HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Accounts/{AccountID}"; // create a map of path variables @@ -2554,6 +2665,8 @@ public HttpResponse deleteContactGroupContactForHttpResponse( UUID contactGroupI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"; // create a map of path variables @@ -2595,6 +2708,8 @@ public HttpResponse deleteContactGroupContactsForHttpResponse( UUID contactGroup HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ContactGroups/{ContactGroupID}/Contacts"; // create a map of path variables @@ -2636,6 +2751,8 @@ public HttpResponse deleteItemForHttpResponse( UUID itemID) throws IOException { HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Items/{ItemID}"; // create a map of path variables @@ -2677,6 +2794,8 @@ public HttpResponse deleteLinkedTransactionForHttpResponse( UUID linkedTransacti HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; // create a map of path variables @@ -2725,6 +2844,8 @@ public HttpResponse deletePaymentForHttpResponse( UUID paymentID, Payments paym HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Payments/{PaymentID}"; // create a map of path variables @@ -2771,6 +2892,8 @@ public HttpResponse deleteTrackingCategoryForHttpResponse( UUID trackingCategory HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; // create a map of path variables @@ -2819,6 +2942,8 @@ public HttpResponse deleteTrackingOptionsForHttpResponse( UUID trackingCategoryI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; // create a map of path variables @@ -2865,6 +2990,8 @@ public HttpResponse emailInvoiceForHttpResponse( UUID invoiceID, RequestEmpty r HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}/Email"; // create a map of path variables @@ -2910,6 +3037,8 @@ public HttpResponse getAccountForHttpResponse( UUID accountID) throws IOExceptio HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Accounts/{AccountID}"; // create a map of path variables @@ -2962,6 +3091,8 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse( UUID accountI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint @@ -3022,6 +3153,8 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse( UUID accountID, UU HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Accounts/{AccountID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint @@ -3073,6 +3206,8 @@ public HttpResponse getAccountAttachmentsForHttpResponse( UUID accountID) throws HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Accounts/{AccountID}/Attachments"; // create a map of path variables @@ -3115,6 +3250,8 @@ public HttpResponse getAccountsForHttpResponse( OffsetDateTime ifModifiedSince, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Accounts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -3174,6 +3311,8 @@ public HttpResponse getBankTransactionForHttpResponse( UUID bankTransactionID) t HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransactions/{BankTransactionID}"; // create a map of path variables @@ -3226,6 +3365,8 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint @@ -3286,6 +3427,8 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( UUID bankTr HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint @@ -3337,6 +3480,8 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse( UUID bankTrans HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments"; // create a map of path variables @@ -3381,6 +3526,8 @@ public HttpResponse getBankTransactionsForHttpResponse( OffsetDateTime ifModifie HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransactions"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -3460,6 +3607,8 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse( UUID bankTransact HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransactions/{BankTransactionID}/History"; // create a map of path variables @@ -3503,6 +3652,8 @@ public HttpResponse getBankTransferForHttpResponse( UUID bankTransferID) throws HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransfers/{BankTransferID}"; // create a map of path variables @@ -3555,6 +3706,8 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( UUID ban HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint @@ -3615,6 +3768,8 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse( UUID bankTrans HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint @@ -3666,6 +3821,8 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse( UUID bankTransfer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransfers/{BankTransferID}/Attachments"; // create a map of path variables @@ -3709,6 +3866,8 @@ public HttpResponse getBankTransferHistoryForHttpResponse( UUID bankTransferID) HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransfers/{BankTransferID}/History"; // create a map of path variables @@ -3751,6 +3910,8 @@ public HttpResponse getBankTransfersForHttpResponse( OffsetDateTime ifModifiedSi HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransfers"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -3810,6 +3971,8 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse( UUID batchPaymentID) HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BatchPayments/{BatchPaymentID}/History"; // create a map of path variables @@ -3852,6 +4015,8 @@ public HttpResponse getBatchPaymentsForHttpResponse( OffsetDateTime ifModifiedSi HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BatchPayments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -3911,6 +4076,8 @@ public HttpResponse getBrandingThemeForHttpResponse( UUID brandingThemeID) throw HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BrandingThemes/{BrandingThemeID}"; // create a map of path variables @@ -3954,6 +4121,8 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse( UUID brandin HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BrandingThemes/{BrandingThemeID}/PaymentServices"; // create a map of path variables @@ -3993,6 +4162,8 @@ public HttpResponse getBrandingThemesForHttpResponse() throws IOException { HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BrandingThemes"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -4031,6 +4202,8 @@ public HttpResponse getContactForHttpResponse( UUID contactID) throws IOExceptio HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts/{ContactID}"; // create a map of path variables @@ -4083,6 +4256,8 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse( UUID contactI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint @@ -4143,6 +4318,8 @@ public HttpResponse getContactAttachmentByIdForHttpResponse( UUID contactID, UU HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts/{ContactID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint @@ -4194,6 +4371,8 @@ public HttpResponse getContactAttachmentsForHttpResponse( UUID contactID) throws HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts/{ContactID}/Attachments"; // create a map of path variables @@ -4237,6 +4416,8 @@ public HttpResponse getContactCISSettingsForHttpResponse( UUID contactID) throws HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts/{ContactID}/CISSettings"; // create a map of path variables @@ -4280,6 +4461,8 @@ public HttpResponse getContactGroupForHttpResponse( UUID contactGroupID) throws HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ContactGroups/{ContactGroupID}"; // create a map of path variables @@ -4321,6 +4504,8 @@ public HttpResponse getContactGroupsForHttpResponse( String where, String order HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ContactGroups"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -4380,6 +4565,8 @@ public HttpResponse getContactHistoryForHttpResponse( UUID contactID) throws IOE HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts/{ContactID}/History"; // create a map of path variables @@ -4425,6 +4612,8 @@ public HttpResponse getContactsForHttpResponse( OffsetDateTime ifModifiedSince, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -4514,6 +4703,8 @@ public HttpResponse getCreditNoteForHttpResponse( UUID creditNoteID) throws IOEx HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes/{CreditNoteID}"; // create a map of path variables @@ -4562,6 +4753,8 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse( UUID creditNoteID, Strin HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes/{CreditNoteID}/pdf"; // Hacky path manipulation to support different return types from same endpoint @@ -4621,6 +4814,8 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( UUID credi HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint @@ -4681,6 +4876,8 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( UUID creditNoteI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint @@ -4732,6 +4929,8 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse( UUID creditNoteID) HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments"; // create a map of path variables @@ -4775,6 +4974,8 @@ public HttpResponse getCreditNoteHistoryForHttpResponse( UUID creditNoteID) thro HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes/{CreditNoteID}/History"; // create a map of path variables @@ -4818,6 +5019,8 @@ public HttpResponse getCreditNotesForHttpResponse( OffsetDateTime ifModifiedSinc HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -4885,6 +5088,8 @@ public HttpResponse getCurrenciesForHttpResponse( String where, String order) t HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Currencies"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -4944,6 +5149,8 @@ public HttpResponse getEmployeeForHttpResponse( UUID employeeID) throws IOExcept HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Employees/{EmployeeID}"; // create a map of path variables @@ -4986,6 +5193,8 @@ public HttpResponse getEmployeesForHttpResponse( OffsetDateTime ifModifiedSince, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Employees"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -5045,6 +5254,8 @@ public HttpResponse getExpenseClaimForHttpResponse( UUID expenseClaimID) throws HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; // create a map of path variables @@ -5088,6 +5299,8 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse( UUID expenseClaimID) HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ExpenseClaims/{ExpenseClaimID}/History"; // create a map of path variables @@ -5130,6 +5343,8 @@ public HttpResponse getExpenseClaimsForHttpResponse( OffsetDateTime ifModifiedSi HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ExpenseClaims"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -5189,6 +5404,8 @@ public HttpResponse getInvoiceForHttpResponse( UUID invoiceID) throws IOExceptio HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}"; // create a map of path variables @@ -5237,6 +5454,8 @@ public HttpResponse getInvoiceAsPdfForHttpResponse( UUID invoiceID, String cont HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}/pdf"; // Hacky path manipulation to support different return types from same endpoint @@ -5296,6 +5515,8 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( UUID invoiceI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint @@ -5356,6 +5577,8 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse( UUID invoiceID, UU HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint @@ -5407,6 +5630,8 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse( UUID invoiceID) throws HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}/Attachments"; // create a map of path variables @@ -5450,6 +5675,8 @@ public HttpResponse getInvoiceHistoryForHttpResponse( UUID invoiceID) throws IOE HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}/History"; // create a map of path variables @@ -5489,6 +5716,8 @@ public HttpResponse getInvoiceRemindersForHttpResponse() throws IOException { HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/InvoiceReminders/Settings"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -5534,6 +5763,8 @@ public HttpResponse getInvoicesForHttpResponse( OffsetDateTime ifModifiedSince, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -5673,6 +5904,8 @@ public HttpResponse getItemForHttpResponse( UUID itemID) throws IOException { HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Items/{ItemID}"; // create a map of path variables @@ -5716,6 +5949,8 @@ public HttpResponse getItemHistoryForHttpResponse( UUID itemID) throws IOExcepti HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Items/{ItemID}/History"; // create a map of path variables @@ -5759,6 +5994,8 @@ public HttpResponse getItemsForHttpResponse( OffsetDateTime ifModifiedSince, St HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Items"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -5828,6 +6065,8 @@ public HttpResponse getJournalForHttpResponse( UUID journalID) throws IOExceptio HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Journals/{JournalID}"; // create a map of path variables @@ -5870,6 +6109,8 @@ public HttpResponse getJournalsForHttpResponse( OffsetDateTime ifModifiedSince, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Journals"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (offset != null) { @@ -5929,6 +6170,8 @@ public HttpResponse getLinkedTransactionForHttpResponse( UUID linkedTransactionI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; // create a map of path variables @@ -5974,6 +6217,8 @@ public HttpResponse getLinkedTransactionsForHttpResponse( Integer page, String HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/LinkedTransactions"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (page != null) { @@ -6073,6 +6318,8 @@ public HttpResponse getManualJournalForHttpResponse( UUID manualJournalID) throw HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ManualJournals/{ManualJournalID}"; // create a map of path variables @@ -6125,6 +6372,8 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( UUID ma HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint @@ -6185,6 +6434,8 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse( UUID manualJo HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint @@ -6236,6 +6487,8 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse( UUID manualJourn HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments"; // create a map of path variables @@ -6279,6 +6532,8 @@ public HttpResponse getManualJournalsForHttpResponse( OffsetDateTime ifModifiedS HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ManualJournals"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -6348,6 +6603,8 @@ public HttpResponse getOnlineInvoiceForHttpResponse( UUID invoiceID) throws IOEx HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}/OnlineInvoice"; // create a map of path variables @@ -6391,6 +6648,8 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse( UUID organisation HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Organisation/{OrganisationID}/CISSettings"; // create a map of path variables @@ -6430,6 +6689,8 @@ public HttpResponse getOrganisationsForHttpResponse() throws IOException { HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Organisation"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -6468,6 +6729,8 @@ public HttpResponse getOverpaymentForHttpResponse( UUID overpaymentID) throws IO HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Overpayments/{OverpaymentID}"; // create a map of path variables @@ -6511,6 +6774,8 @@ public HttpResponse getOverpaymentHistoryForHttpResponse( UUID overpaymentID) th HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Overpayments/{OverpaymentID}/History"; // create a map of path variables @@ -6555,6 +6820,8 @@ public HttpResponse getOverpaymentsForHttpResponse( OffsetDateTime ifModifiedSin HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Overpayments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -6634,6 +6901,8 @@ public HttpResponse getPaymentForHttpResponse( UUID paymentID) throws IOExceptio HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Payments/{PaymentID}"; // create a map of path variables @@ -6677,6 +6946,8 @@ public HttpResponse getPaymentHistoryForHttpResponse( UUID paymentID) throws IOE HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Payments/{PaymentID}/History"; // create a map of path variables @@ -6716,6 +6987,8 @@ public HttpResponse getPaymentServicesForHttpResponse() throws IOException { HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/PaymentServices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -6753,6 +7026,8 @@ public HttpResponse getPaymentsForHttpResponse( OffsetDateTime ifModifiedSince, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Payments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -6812,6 +7087,8 @@ public HttpResponse getPrepaymentForHttpResponse( UUID prepaymentID) throws IOEx HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Prepayments/{PrepaymentID}"; // create a map of path variables @@ -6855,6 +7132,8 @@ public HttpResponse getPrepaymentHistoryForHttpResponse( UUID prepaymentID) thro HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Prepayments/{PrepaymentID}/History"; // create a map of path variables @@ -6899,6 +7178,8 @@ public HttpResponse getPrepaymentsForHttpResponse( OffsetDateTime ifModifiedSinc HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Prepayments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -6978,6 +7259,8 @@ public HttpResponse getPurchaseOrderForHttpResponse( UUID purchaseOrderID) throw HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; // create a map of path variables @@ -7021,6 +7304,8 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse( UUID purchaseOrderID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/PurchaseOrders/{PurchaseOrderID}/History"; // create a map of path variables @@ -7066,6 +7351,8 @@ public HttpResponse getPurchaseOrdersForHttpResponse( OffsetDateTime ifModifiedS HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/PurchaseOrders"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (status != null) { @@ -7155,6 +7442,8 @@ public HttpResponse getReceiptForHttpResponse( UUID receiptID) throws IOExceptio HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Receipts/{ReceiptID}"; // create a map of path variables @@ -7207,6 +7496,8 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( UUID receiptI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint @@ -7267,6 +7558,8 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse( UUID receiptID, UU HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Receipts/{ReceiptID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint @@ -7318,6 +7611,8 @@ public HttpResponse getReceiptAttachmentsForHttpResponse( UUID receiptID) throws HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Receipts/{ReceiptID}/Attachments"; // create a map of path variables @@ -7361,6 +7656,8 @@ public HttpResponse getReceiptHistoryForHttpResponse( UUID receiptID) throws IOE HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Receipts/{ReceiptID}/History"; // create a map of path variables @@ -7404,6 +7701,8 @@ public HttpResponse getReceiptsForHttpResponse( OffsetDateTime ifModifiedSince, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Receipts"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -7473,6 +7772,8 @@ public HttpResponse getRepeatingInvoiceForHttpResponse( UUID repeatingInvoiceID) HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}"; // create a map of path variables @@ -7525,6 +7826,8 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; // Hacky path manipulation to support different return types from same endpoint @@ -7585,6 +7888,8 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( UUID repea HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"; // Hacky path manipulation to support different return types from same endpoint @@ -7636,6 +7941,8 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( UUID repeatin HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"; // create a map of path variables @@ -7679,6 +7986,8 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( UUID repeatingInv HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/History"; // create a map of path variables @@ -7720,6 +8029,8 @@ public HttpResponse getRepeatingInvoicesForHttpResponse( String where, String o HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/RepeatingInvoices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -7782,6 +8093,8 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse( UUID contactI HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Reports/AgedPayablesByContact"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (contactId != null) { @@ -7864,6 +8177,8 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse( UUID conta HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Reports/AgedReceivablesByContact"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (contactId != null) { @@ -7943,6 +8258,8 @@ public HttpResponse getReportBASorGSTForHttpResponse( String reportID) throws IO HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Reports/{ReportID}"; // create a map of path variables @@ -7982,6 +8299,8 @@ public HttpResponse getReportBASorGSTListForHttpResponse() throws IOException { HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Reports"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -8023,6 +8342,8 @@ public HttpResponse getReportBalanceSheetForHttpResponse( String date, Integer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Reports/BalanceSheet"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { @@ -8131,6 +8452,8 @@ public HttpResponse getReportBankSummaryForHttpResponse( LocalDate date, Intege HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Reports/BankSummary"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { @@ -8199,6 +8522,8 @@ public HttpResponse getReportBudgetSummaryForHttpResponse( LocalDate date, Inte HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Reports/BudgetSummary"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { @@ -8265,6 +8590,8 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse( LocalDate date) th HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Reports/ExecutiveSummary"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { @@ -8320,6 +8647,8 @@ public HttpResponse getReportProfitAndLossForHttpResponse( LocalDate fromDate, HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Reports/ProfitAndLoss"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (fromDate != null) { @@ -8456,6 +8785,8 @@ public HttpResponse getReportTenNinetyNineForHttpResponse( String reportYear) th HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Reports/TenNinetyNine"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (reportYear != null) { @@ -8503,6 +8834,8 @@ public HttpResponse getReportTrialBalanceForHttpResponse( LocalDate date, Boole HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Reports/TrialBalance"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (date != null) { @@ -8561,6 +8894,8 @@ public HttpResponse getTaxRatesForHttpResponse( String where, String order, St HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/TaxRates"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -8629,6 +8964,8 @@ public HttpResponse getTrackingCategoriesForHttpResponse( String where, String HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/TrackingCategories"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -8698,6 +9035,8 @@ public HttpResponse getTrackingCategoryForHttpResponse( UUID trackingCategoryID) HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; // create a map of path variables @@ -8741,6 +9080,8 @@ public HttpResponse getUserForHttpResponse( UUID userID) throws IOException { HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Users/{UserID}"; // create a map of path variables @@ -8783,6 +9124,8 @@ public HttpResponse getUsersForHttpResponse( OffsetDateTime ifModifiedSince, St HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Users"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { @@ -8847,6 +9190,8 @@ public HttpResponse updateAccountForHttpResponse( UUID accountID, Accounts acco HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Accounts/{AccountID}"; // create a map of path variables @@ -8901,6 +9246,8 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( UUID accou HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Accounts/{AccountID}/Attachments/{FileName}"; // create a map of path variables @@ -8954,6 +9301,8 @@ public HttpResponse updateBankTransactionForHttpResponse( UUID bankTransactionID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransactions/{BankTransactionID}"; // create a map of path variables @@ -9008,6 +9357,8 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( UU HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"; // create a map of path variables @@ -9064,6 +9415,8 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/BankTransfers/{BankTransferID}/Attachments/{FileName}"; // create a map of path variables @@ -9116,6 +9469,8 @@ public HttpResponse updateContactForHttpResponse( UUID contactID, Contacts cont HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts/{ContactID}"; // create a map of path variables @@ -9169,6 +9524,8 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( UUID conta HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Contacts/{ContactID}/Attachments/{FileName}"; // create a map of path variables @@ -9222,6 +9579,8 @@ public HttpResponse updateContactGroupForHttpResponse( UUID contactGroupID, Con HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ContactGroups/{ContactGroupID}"; // create a map of path variables @@ -9272,6 +9631,8 @@ public HttpResponse updateCreditNoteForHttpResponse( UUID creditNoteID, CreditN HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes/{CreditNoteID}"; // create a map of path variables @@ -9326,6 +9687,8 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( UUID cr HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"; // create a map of path variables @@ -9379,6 +9742,8 @@ public HttpResponse updateEmployeeForHttpResponse( UUID employeeID, Employees e HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Employees/{EmployeeID}"; // create a map of path variables @@ -9429,6 +9794,8 @@ public HttpResponse updateExpenseClaimForHttpResponse( UUID expenseClaimID, Exp HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ExpenseClaims/{ExpenseClaimID}"; // create a map of path variables @@ -9479,6 +9846,8 @@ public HttpResponse updateInvoiceForHttpResponse( UUID invoiceID, Invoices invo HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}"; // create a map of path variables @@ -9533,6 +9902,8 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( UUID invoi HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Invoices/{InvoiceID}/Attachments/{FileName}"; // create a map of path variables @@ -9586,6 +9957,8 @@ public HttpResponse updateItemForHttpResponse( UUID itemID, Items items) throws HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Items/{ItemID}"; // create a map of path variables @@ -9636,6 +10009,8 @@ public HttpResponse updateLinkedTransactionForHttpResponse( UUID linkedTransacti HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/LinkedTransactions/{LinkedTransactionID}"; // create a map of path variables @@ -9686,6 +10061,8 @@ public HttpResponse updateManualJournalForHttpResponse( UUID manualJournalID, M HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ManualJournals/{ManualJournalID}"; // create a map of path variables @@ -9740,6 +10117,8 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( UUID HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; // create a map of path variables @@ -9793,6 +10172,8 @@ public HttpResponse updatePurchaseOrderForHttpResponse( UUID purchaseOrderID, P HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/PurchaseOrders/{PurchaseOrderID}"; // create a map of path variables @@ -9843,6 +10224,8 @@ public HttpResponse updateReceiptForHttpResponse( UUID receiptID, Receipts rece HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Receipts/{ReceiptID}"; // create a map of path variables @@ -9897,6 +10280,8 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( UUID recei HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/Receipts/{ReceiptID}/Attachments/{FileName}"; // create a map of path variables @@ -9954,6 +10339,8 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( U HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"; // create a map of path variables @@ -10003,6 +10390,8 @@ public HttpResponse updateTaxRateForHttpResponse( TaxRates taxRates) throws IOEx HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/TaxRates"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); @@ -10048,6 +10437,8 @@ public HttpResponse updateTrackingCategoryForHttpResponse( UUID trackingCategory HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/TrackingCategories/{TrackingCategoryID}"; // create a map of path variables From 3904383d7e49dc8539efb176f1130591ee8b7766 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Thu, 27 Jun 2019 06:32:54 -0700 Subject: [PATCH 16/76] cleaned up code --- .../xero/example/AuthenticatedResource.java | 61 +---------- .../java/com/xero/example/Authorization.java | 14 +-- src/main/java/com/xero/example/Callback.java | 100 +++++++++--------- .../com/xero/example/RefreshCredential.java | 3 +- 4 files changed, 58 insertions(+), 120 deletions(-) diff --git a/src/main/java/com/xero/example/AuthenticatedResource.java b/src/main/java/com/xero/example/AuthenticatedResource.java index 0d02a1a5..43aee497 100755 --- a/src/main/java/com/xero/example/AuthenticatedResource.java +++ b/src/main/java/com/xero/example/AuthenticatedResource.java @@ -1,17 +1,10 @@ package com.xero.example; -import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.File; -import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; import java.io.PrintWriter; -import java.net.URLConnection; -import java.nio.file.Files; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Calendar; import java.util.List; @@ -25,38 +18,15 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.google.api.client.auth.oauth2.AuthorizationCodeFlow; -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.ClientCredentialsTokenRequest; -import com.google.api.client.auth.oauth2.ClientParametersAuthentication; import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.auth.oauth2.CredentialRefreshListener; -import com.google.api.client.auth.oauth2.DataStoreCredentialRefreshListener; -import com.google.api.client.auth.oauth2.TokenErrorResponse; -import com.google.api.client.auth.oauth2.TokenResponse; -import com.google.api.client.auth.oauth2.TokenResponseException; -import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; -import com.google.api.client.googleapis.util.Utils; -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.HttpHeaders; -import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpRequestInitializer; -import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.JsonFactory; -import com.google.api.client.json.jackson2.JacksonFactory; -import com.google.api.client.util.store.DataStoreFactory; -import com.google.api.client.util.store.MemoryDataStoreFactory; import com.xero.api.*; import com.xero.models.accounting.*; import com.xero.models.accounting.Phone.PhoneTypeEnum; -import com.xero.models.accounting.TaxRate.ReportTaxTypeEnum; import com.xero.api.client.AccountingApi; -import org.apache.commons.io.IOUtils; -//import java.time.LocalDate; import org.threeten.bp.*; @WebServlet("/AuthenticatedResource") @@ -180,34 +150,11 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) // Set Access Token from Storage TokenStorage store = new TokenStorage(); - final String clientId = "CEC496D0B24D4448A8F1D8B6A3F5C00E"; - final String clientSecret = "RyndE0-u_Drvu-jIwBNO4Hcsug-kCcQQgUQOB4AHTHpHl2z9"; - - //HttpTransport httpTransport = new NetHttpTransport(); - //JsonFactory jsonFactory = new JacksonFactory(); - final HttpServletResponse resp = response; - Credential credential = com.xero.example.RefreshCredential.createRefreshCredential(resp, clientId, clientSecret).build(); - /* - Credential credential = new XeroCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory) - .setClientSecrets(clientId, clientSecret) - .addRefreshListener(new CredentialRefreshListener() { - - @Override - public void onTokenResponse(Credential credential, TokenResponse tokenResponse) throws IOException { - TokenStorage store = new TokenStorage(); - store.saveItem(resp, "access_token", tokenResponse.getAccessToken()); - store.saveItem(resp, "refresh_token", tokenResponse.getRefreshToken()); - store.saveItem(resp, "expires_in_seconds", tokenResponse.getExpiresInSeconds().toString()); - } + final String clientId = "--YOUR_CLIENT_ID--"; + final String clientSecret = "--YOUR_CLIENT_SECRET--"; - @Override - public void onTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse) - throws IOException { - System.out.println("Error Response"); - } - }).build(); - */ - + final HttpServletResponse resp = response; + Credential credential = com.xero.example.RefreshCredential.createRefreshCredential(resp, clientId, clientSecret).build(); credential.setAccessToken(store.get(request, "access_token")); credential.setRefreshToken(store.get(request, "refresh_token")); credential.setExpiresInSeconds( Long.parseLong(store.get(request, "expires_in_seconds"))); diff --git a/src/main/java/com/xero/example/Authorization.java b/src/main/java/com/xero/example/Authorization.java index 91cef123..870b1714 100644 --- a/src/main/java/com/xero/example/Authorization.java +++ b/src/main/java/com/xero/example/Authorization.java @@ -39,9 +39,9 @@ public Authorization() { */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - final String clientId = "CEC496D0B24D4448A8F1D8B6A3F5C00E"; - final String clientSecret = "RyndE0-u_Drvu-jIwBNO4Hcsug-kCcQQgUQOB4AHTHpHl2z9"; - final String redirectURI = "http://localhost:8080/xero-sdk-oauth2-dev-01/Callback"; + final String clientId = "--YOUR_CLIENT_ID--"; + final String clientSecret = "--YOUR_CLIENT_SECRET--"; + final String redirectURI = "--YOUR_REDIRECT_URI--"; final String secretState = "secret" + new Random().nextInt(999_999); ArrayList scopeList = new ArrayList(); @@ -80,12 +80,4 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t response.sendRedirect(url); } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - doGet(request, response); - } } diff --git a/src/main/java/com/xero/example/Callback.java b/src/main/java/com/xero/example/Callback.java index 2e6acf3e..73bad16c 100644 --- a/src/main/java/com/xero/example/Callback.java +++ b/src/main/java/com/xero/example/Callback.java @@ -49,59 +49,59 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t if (request.getParameter("code") != null) { code = request.getParameter("code"); } - final String clientId = "CEC496D0B24D4448A8F1D8B6A3F5C00E"; - final String clientSecret = "RyndE0-u_Drvu-jIwBNO4Hcsug-kCcQQgUQOB4AHTHpHl2z9"; - final String redirectURI = "http://localhost:8080/xero-sdk-oauth2-dev-01/Callback"; + + final String clientId = "--YOUR_CLIENT_ID--"; + final String clientSecret = "--YOUR_CLIENT_SECRET--"; + final String redirectURI = "--YOUR_REDIRECT_URI--"; - ArrayList scopeList = new ArrayList(); - scopeList.add("openid"); - scopeList.add("email"); - scopeList.add("profile"); - scopeList.add("offline_access"); - scopeList.add("accounting.settings"); - scopeList.add("accounting.transactions"); - scopeList.add("accounting.contacts"); - scopeList.add("accounting.journals.read"); - scopeList.add("accounting.reports.read"); - scopeList.add("accounting.attachments"); - scopeList.add("paymentservices"); - - final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport(); - final JsonFactory JSON_FACTORY = new JacksonFactory(); - final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; - final String AUTHORIZATION_SERVER_URL = "https://login.xero.com/identity/connect/authorize"; - DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory(); - - AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(), - HTTP_TRANSPORT, - JSON_FACTORY, - new GenericUrl(TOKEN_SERVER_URL), - new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL).setScopes(scopeList).setDataStoreFactory(DATA_STORE_FACTORY).build(); - TokenResponse accessToken = flow.newTokenRequest(code).setRedirectUri(redirectURI).execute(); - - HttpTransport httpTransport = new NetHttpTransport(); - JsonFactory jsonFactory = new JacksonFactory(); - GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory).setClientSecrets(clientId, clientSecret).build(); - credential.setAccessToken(accessToken.getAccessToken()); - credential.setRefreshToken(accessToken.getRefreshToken()); - credential.setExpiresInSeconds(accessToken.getExpiresInSeconds()); - - - // Create requestFactory with credentials - HttpTransport transport = new NetHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + ArrayList scopeList = new ArrayList(); + scopeList.add("openid"); + scopeList.add("email"); + scopeList.add("profile"); + scopeList.add("offline_access"); + scopeList.add("accounting.settings"); + scopeList.add("accounting.transactions"); + scopeList.add("accounting.contacts"); + scopeList.add("accounting.journals.read"); + scopeList.add("accounting.reports.read"); + scopeList.add("accounting.attachments"); + scopeList.add("paymentservices"); + + final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport(); + final JsonFactory JSON_FACTORY = new JacksonFactory(); + final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; + final String AUTHORIZATION_SERVER_URL = "https://login.xero.com/identity/connect/authorize"; + DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory(); + + AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(), + HTTP_TRANSPORT, + JSON_FACTORY, + new GenericUrl(TOKEN_SERVER_URL), + new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL).setScopes(scopeList).setDataStoreFactory(DATA_STORE_FACTORY).build(); + TokenResponse accessToken = flow.newTokenRequest(code).setRedirectUri(redirectURI).execute(); + + HttpTransport httpTransport = new NetHttpTransport(); + JsonFactory jsonFactory = new JacksonFactory(); + GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory).setClientSecrets(clientId, clientSecret).build(); + credential.setAccessToken(accessToken.getAccessToken()); + credential.setRefreshToken(accessToken.getRefreshToken()); + credential.setExpiresInSeconds(accessToken.getExpiresInSeconds()); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - // Init IdentityApi client - ApiClient defaultClient = new ApiClient(null,null,null,null,requestFactory); - IdentityApi idApi = new IdentityApi(defaultClient); - List connection = idApi.getConnections(); + // Init IdentityApi client + ApiClient defaultClient = new ApiClient("https://api.xero.com",null,null,null,requestFactory); + IdentityApi idApi = new IdentityApi(defaultClient); + List connection = idApi.getConnections(); - TokenStorage store = new TokenStorage(); - store.saveItem(response, "access_token", accessToken.getAccessToken()); - store.saveItem(response, "refresh_token", accessToken.getRefreshToken()); - store.saveItem(response, "expires_in_seconds", accessToken.getExpiresInSeconds().toString()); - store.saveItem(response, "xero_tenant_id", connection.get(0).getTenantId().toString()); + TokenStorage store = new TokenStorage(); + store.saveItem(response, "access_token", accessToken.getAccessToken()); + store.saveItem(response, "refresh_token", accessToken.getRefreshToken()); + store.saveItem(response, "expires_in_seconds", accessToken.getExpiresInSeconds().toString()); + store.saveItem(response, "xero_tenant_id", connection.get(0).getTenantId().toString()); - response.sendRedirect("./AuthenticatedResource"); + response.sendRedirect("./AuthenticatedResource"); } } diff --git a/src/main/java/com/xero/example/RefreshCredential.java b/src/main/java/com/xero/example/RefreshCredential.java index 479b5c24..bb68ffa4 100644 --- a/src/main/java/com/xero/example/RefreshCredential.java +++ b/src/main/java/com/xero/example/RefreshCredential.java @@ -47,8 +47,7 @@ public void onTokenErrorResponse(Credential credential, TokenErrorResponse token throws IOException { System.out.println("Error Response"); } - }); + }); return credentials; } - } From ef3230b4b8dd29cfc6edf72ba0b562a11105dbf3 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 2 Jul 2019 15:40:02 -0700 Subject: [PATCH 17/76] add Assets API and model --- .../java/com/xero/api/client/AssetApi.java | 451 ++++++++++++++++++ .../java/com/xero/models/assets/Asset.java | 409 ++++++++++++++++ .../com/xero/models/assets/AssetType.java | 232 +++++++++ .../java/com/xero/models/assets/Assets.java | 127 +++++ .../models/assets/BookDepreciationDetail.java | 231 +++++++++ .../assets/BookDepreciationSetting.java | 299 ++++++++++++ .../com/xero/models/assets/Pagination.java | 161 +++++++ .../java/com/xero/models/assets/Setting.java | 255 ++++++++++ 8 files changed, 2165 insertions(+) create mode 100644 src/main/java/com/xero/api/client/AssetApi.java create mode 100644 src/main/java/com/xero/models/assets/Asset.java create mode 100644 src/main/java/com/xero/models/assets/AssetType.java create mode 100644 src/main/java/com/xero/models/assets/Assets.java create mode 100644 src/main/java/com/xero/models/assets/BookDepreciationDetail.java create mode 100644 src/main/java/com/xero/models/assets/BookDepreciationSetting.java create mode 100644 src/main/java/com/xero/models/assets/Pagination.java create mode 100644 src/main/java/com/xero/models/assets/Setting.java diff --git a/src/main/java/com/xero/api/client/AssetApi.java b/src/main/java/com/xero/api/client/AssetApi.java new file mode 100644 index 00000000..64dc0229 --- /dev/null +++ b/src/main/java/com/xero/api/client/AssetApi.java @@ -0,0 +1,451 @@ +package com.xero.api.client; + +import com.xero.api.ApiClient; + +import com.xero.models.assets.Asset; +import com.xero.models.assets.AssetType; +import com.xero.models.assets.Assets; +import com.xero.models.assets.Setting; +import java.util.UUID; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.GenericUrl; +import com.google.api.client.http.HttpContent; +import com.google.api.client.http.HttpMethods; +import com.google.api.client.http.HttpHeaders; +import com.google.api.client.http.HttpResponse; +import com.google.api.client.http.FileContent; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.file.Files; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; + +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + + +public class AssetApi { + private ApiClient apiClient; + private String xeroTenantId; + private String userAgent = "Default"; + private String version = "3.0.0-beta-7"; + + public AssetApi() { + this(new ApiClient()); + } + + public AssetApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public String getXeroTenantId() { + return xeroTenantId; + } + + public void setXeroTenantId(String xeroTenantId) { + this.xeroTenantId = xeroTenantId; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public String getUserAgent() { + return this.userAgent + "[Xero-Java-" + this.version + "]"; + } + + private static String convertStreamToString(InputStream is) { + + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + StringBuilder sb = new StringBuilder(); + + String line = null; + try { + while ((line = reader.readLine()) != null) { + sb.append(line + "\n"); + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return sb.toString(); + } + + + /** + * adds a fixed asset + * Adds an asset to the system + *

200 - return single object - create new asset + *

400 - invalid input, object invalid + * @param asset Fixed asset to add + * @return Asset + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Asset createAsset(Asset asset) throws IOException { + HttpResponse response = createAssetForHttpResponse(asset); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createAssetForHttpResponse( Asset asset) throws IOException { + // verify the required parameter 'asset' is set + if (asset == null) { + throw new IllegalArgumentException("Missing the required parameter 'asset' when calling createAsset"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Assets"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(asset); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * adds a fixed asset type + * Adds an fixed asset type to the system + *

200 - results single object - created fixed type + *

400 - invalid input, object invalid + *

409 - a type already exists + * @param assetType Asset type to add + * @return AssetType + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public AssetType createAssetType(AssetType assetType) throws IOException { + HttpResponse response = createAssetTypeForHttpResponse(assetType); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createAssetTypeForHttpResponse( AssetType assetType) throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/AssetTypes"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(assetType); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * retrieves fixed asset by id + * By passing in the appropriate asset id, you can search for a specific fixed asset in the system + *

200 - search results matching criteria + *

400 - bad input parameter + * @param id fixed asset id for single object + * @return Asset + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Asset getAssetById(UUID id) throws IOException { + HttpResponse response = getAssetByIdForHttpResponse(id); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAssetByIdForHttpResponse( UUID id) throws IOException { + // verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling getAssetById"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Assets/{id}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("id", id); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches fixed asset settings + * By passing in the appropriate options, you can search for available fixed asset types in the system + *

200 - search results matching criteria + *

400 - bad input parameter + * @return Setting + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Setting getAssetSettings() throws IOException { + HttpResponse response = getAssetSettingsForHttpResponse(); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAssetSettingsForHttpResponse() throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Settings"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches fixed asset types + * By passing in the appropriate options, you can search for available fixed asset types in the system + *

200 - search results matching criteria + *

400 - bad input parameter + * @return List<AssetType> + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public List getAssetTypes() throws IOException { + HttpResponse response = getAssetTypesForHttpResponse(); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference>() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAssetTypesForHttpResponse() throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/AssetTypes"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches fixed asset + * By passing in the appropriate options, you can search for available fixed asset in the system + *

200 - search results matching criteria + *

400 - bad input parameter + * @param status Required when retrieving a collection of assets. See Asset Status Codes + * @param page Results are paged. This specifies which page of the results to return. The default page is 1. + * @param pageSize The number of records returned per page. By default the number of records returned is 10. + * @param orderBy Requests can be ordered by AssetType, AssetName, AssetNumber, PurchaseDate and PurchasePrice. If the asset status is DISPOSED it also allows DisposalDate and DisposalPrice. + * @param sortDirection ASC or DESC + * @param filterBy A string that can be used to filter the list to only return assets containing the text. Checks it against the AssetName, AssetNumber, Description and AssetTypeName fields. + * @return Assets + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Assets getAssets(String status, Integer page, Integer pageSize, String orderBy, String sortDirection, String filterBy) throws IOException { + HttpResponse response = getAssetsForHttpResponse(status, page, pageSize, orderBy, sortDirection, filterBy); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAssetsForHttpResponse( String status, Integer page, Integer pageSize, String orderBy, String sortDirection, String filterBy) throws IOException { + // verify the required parameter 'status' is set + if (status == null) { + throw new IllegalArgumentException("Missing the required parameter 'status' when calling getAssets"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Assets"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (status != null) { + String key = "status"; + Object value = status; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (pageSize != null) { + String key = "pageSize"; + Object value = pageSize; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (orderBy != null) { + String key = "orderBy"; + Object value = orderBy; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (sortDirection != null) { + String key = "sortDirection"; + Object value = sortDirection; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (filterBy != null) { + String key = "filterBy"; + Object value = filterBy; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + + 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(); + } + + } +} diff --git a/src/main/java/com/xero/models/assets/Asset.java b/src/main/java/com/xero/models/assets/Asset.java new file mode 100644 index 00000000..e6da40c9 --- /dev/null +++ b/src/main/java/com/xero/models/assets/Asset.java @@ -0,0 +1,409 @@ +/* + * Xero Assets API + * This the Xero Assets API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.assets; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.assets.BookDepreciationDetail; +import com.xero.models.assets.BookDepreciationSetting; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; +import org.threeten.bp.LocalDate; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Asset + */ + +public class Asset { + @JsonProperty("assetId") + private UUID assetId; + + @JsonProperty("assetName") + private String assetName; + + @JsonProperty("assetNumber") + private String assetNumber; + + @JsonProperty("purchaseDate") + private LocalDate purchaseDate; + + @JsonProperty("purchasePrice") + private Integer purchasePrice; + + @JsonProperty("disposalPrice") + private Integer disposalPrice; + + /** + * See Asset Status Codes. + */ + public enum AssetStatusEnum { + DRAFT("Draft"), + + REGISTERED("Registered"), + + DISPOSED("Disposed"); + + private String value; + + AssetStatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static AssetStatusEnum fromValue(String value) { + for (AssetStatusEnum b : AssetStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("assetStatus") + private AssetStatusEnum assetStatus; + + @JsonProperty("warrantyExpiryDate") + private String warrantyExpiryDate; + + @JsonProperty("serialNumber") + private String serialNumber; + + @JsonProperty("bookDepreciationSetting") + private BookDepreciationSetting bookDepreciationSetting = null; + + @JsonProperty("bookDepreciationDetail") + private BookDepreciationDetail bookDepreciationDetail = null; + + @JsonProperty("canRollBack") + private Boolean canRollBack; + + @JsonProperty("AccountingBookValue") + private Integer accountingBookValue; + + public Asset assetId(UUID assetId) { + this.assetId = assetId; + return this; + } + + /** + * The Xero-generated Id for the asset + * @return assetId + **/ + @ApiModelProperty(example = "3b5b3a38-5649-495f-87a1-14a4e5918634", required = true, value = "The Xero-generated Id for the asset") + public UUID getAssetId() { + return assetId; + } + + public void setAssetId(UUID assetId) { + this.assetId = assetId; + } + + public Asset assetName(String assetName) { + this.assetName = assetName; + return this; + } + + /** + * The name of the asset + * @return assetName + **/ + @ApiModelProperty(example = "Awesome Truck 3", required = true, value = "The name of the asset") + public String getAssetName() { + return assetName; + } + + public void setAssetName(String assetName) { + this.assetName = assetName; + } + + public Asset assetNumber(String assetNumber) { + this.assetNumber = assetNumber; + return this; + } + + /** + * Must be unique. + * @return assetNumber + **/ + @ApiModelProperty(example = "FA-0013", value = "Must be unique.") + public String getAssetNumber() { + return assetNumber; + } + + public void setAssetNumber(String assetNumber) { + this.assetNumber = assetNumber; + } + + public Asset purchaseDate(LocalDate purchaseDate) { + this.purchaseDate = purchaseDate; + return this; + } + + /** + * The date the asset was purchased YYYY-MM-DD + * @return purchaseDate + **/ + @ApiModelProperty(value = "The date the asset was purchased YYYY-MM-DD") + public LocalDate getPurchaseDate() { + return purchaseDate; + } + + public void setPurchaseDate(LocalDate purchaseDate) { + this.purchaseDate = purchaseDate; + } + + public Asset purchasePrice(Integer purchasePrice) { + this.purchasePrice = purchasePrice; + return this; + } + + /** + * The purchase price of the asset + * @return purchasePrice + **/ + @ApiModelProperty(example = "1000", value = "The purchase price of the asset") + public Integer getPurchasePrice() { + return purchasePrice; + } + + public void setPurchasePrice(Integer purchasePrice) { + this.purchasePrice = purchasePrice; + } + + public Asset disposalPrice(Integer disposalPrice) { + this.disposalPrice = disposalPrice; + return this; + } + + /** + * The price the asset was disposed at + * @return disposalPrice + **/ + @ApiModelProperty(example = "0", value = "The price the asset was disposed at") + public Integer getDisposalPrice() { + return disposalPrice; + } + + public void setDisposalPrice(Integer disposalPrice) { + this.disposalPrice = disposalPrice; + } + + public Asset assetStatus(AssetStatusEnum assetStatus) { + this.assetStatus = assetStatus; + return this; + } + + /** + * See Asset Status Codes. + * @return assetStatus + **/ + @ApiModelProperty(example = "Draft", value = "See Asset Status Codes.") + public AssetStatusEnum getAssetStatus() { + return assetStatus; + } + + public void setAssetStatus(AssetStatusEnum assetStatus) { + this.assetStatus = assetStatus; + } + + public Asset warrantyExpiryDate(String warrantyExpiryDate) { + this.warrantyExpiryDate = warrantyExpiryDate; + return this; + } + + /** + * The date the asset’s warranty expires (if needed) YYYY-MM-DD + * @return warrantyExpiryDate + **/ + @ApiModelProperty(example = "ca4c6b39-4f4f-43e8-98da-5e1f350a6694", value = "The date the asset’s warranty expires (if needed) YYYY-MM-DD") + public String getWarrantyExpiryDate() { + return warrantyExpiryDate; + } + + public void setWarrantyExpiryDate(String warrantyExpiryDate) { + this.warrantyExpiryDate = warrantyExpiryDate; + } + + public Asset serialNumber(String serialNumber) { + this.serialNumber = serialNumber; + return this; + } + + /** + * The asset's serial number + * @return serialNumber + **/ + @ApiModelProperty(example = "ca4c6b39-4f4f-43e8-98da-5e1f350a6694", value = "The asset's serial number") + public String getSerialNumber() { + return serialNumber; + } + + public void setSerialNumber(String serialNumber) { + this.serialNumber = serialNumber; + } + + public Asset bookDepreciationSetting(BookDepreciationSetting bookDepreciationSetting) { + this.bookDepreciationSetting = bookDepreciationSetting; + return this; + } + + /** + * Get bookDepreciationSetting + * @return bookDepreciationSetting + **/ + @ApiModelProperty(required = true, value = "") + public BookDepreciationSetting getBookDepreciationSetting() { + return bookDepreciationSetting; + } + + public void setBookDepreciationSetting(BookDepreciationSetting bookDepreciationSetting) { + this.bookDepreciationSetting = bookDepreciationSetting; + } + + public Asset bookDepreciationDetail(BookDepreciationDetail bookDepreciationDetail) { + this.bookDepreciationDetail = bookDepreciationDetail; + return this; + } + + /** + * Get bookDepreciationDetail + * @return bookDepreciationDetail + **/ + @ApiModelProperty(value = "") + public BookDepreciationDetail getBookDepreciationDetail() { + return bookDepreciationDetail; + } + + public void setBookDepreciationDetail(BookDepreciationDetail bookDepreciationDetail) { + this.bookDepreciationDetail = bookDepreciationDetail; + } + + public Asset canRollBack(Boolean canRollBack) { + this.canRollBack = canRollBack; + return this; + } + + /** + * Boolean to indicate whether depreciation can be rolled back for this asset individually. This is true if it doesn't have 'legacy' journal entries and if there is no lock period that would prevent this asset from rolling back. + * @return canRollBack + **/ + @ApiModelProperty(example = "true", value = "Boolean to indicate whether depreciation can be rolled back for this asset individually. This is true if it doesn't have 'legacy' journal entries and if there is no lock period that would prevent this asset from rolling back.") + public Boolean getCanRollBack() { + return canRollBack; + } + + public void setCanRollBack(Boolean canRollBack) { + this.canRollBack = canRollBack; + } + + public Asset accountingBookValue(Integer accountingBookValue) { + this.accountingBookValue = accountingBookValue; + return this; + } + + /** + * The accounting value of the asset + * @return accountingBookValue + **/ + @ApiModelProperty(example = "0", value = "The accounting value of the asset") + public Integer getAccountingBookValue() { + return accountingBookValue; + } + + public void setAccountingBookValue(Integer accountingBookValue) { + this.accountingBookValue = accountingBookValue; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Asset asset = (Asset) o; + return Objects.equals(this.assetId, asset.assetId) && + Objects.equals(this.assetName, asset.assetName) && + Objects.equals(this.assetNumber, asset.assetNumber) && + Objects.equals(this.purchaseDate, asset.purchaseDate) && + Objects.equals(this.purchasePrice, asset.purchasePrice) && + Objects.equals(this.disposalPrice, asset.disposalPrice) && + Objects.equals(this.assetStatus, asset.assetStatus) && + Objects.equals(this.warrantyExpiryDate, asset.warrantyExpiryDate) && + Objects.equals(this.serialNumber, asset.serialNumber) && + Objects.equals(this.bookDepreciationSetting, asset.bookDepreciationSetting) && + Objects.equals(this.bookDepreciationDetail, asset.bookDepreciationDetail) && + Objects.equals(this.canRollBack, asset.canRollBack) && + Objects.equals(this.accountingBookValue, asset.accountingBookValue); + } + + @Override + public int hashCode() { + return Objects.hash(assetId, assetName, assetNumber, purchaseDate, purchasePrice, disposalPrice, assetStatus, warrantyExpiryDate, serialNumber, bookDepreciationSetting, bookDepreciationDetail, canRollBack, accountingBookValue); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Asset {\n"); + sb.append(" assetId: ").append(toIndentedString(assetId)).append("\n"); + sb.append(" assetName: ").append(toIndentedString(assetName)).append("\n"); + sb.append(" assetNumber: ").append(toIndentedString(assetNumber)).append("\n"); + sb.append(" purchaseDate: ").append(toIndentedString(purchaseDate)).append("\n"); + sb.append(" purchasePrice: ").append(toIndentedString(purchasePrice)).append("\n"); + sb.append(" disposalPrice: ").append(toIndentedString(disposalPrice)).append("\n"); + sb.append(" assetStatus: ").append(toIndentedString(assetStatus)).append("\n"); + sb.append(" warrantyExpiryDate: ").append(toIndentedString(warrantyExpiryDate)).append("\n"); + sb.append(" serialNumber: ").append(toIndentedString(serialNumber)).append("\n"); + sb.append(" bookDepreciationSetting: ").append(toIndentedString(bookDepreciationSetting)).append("\n"); + sb.append(" bookDepreciationDetail: ").append(toIndentedString(bookDepreciationDetail)).append("\n"); + sb.append(" canRollBack: ").append(toIndentedString(canRollBack)).append("\n"); + sb.append(" accountingBookValue: ").append(toIndentedString(accountingBookValue)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/assets/AssetType.java b/src/main/java/com/xero/models/assets/AssetType.java new file mode 100644 index 00000000..15c119a4 --- /dev/null +++ b/src/main/java/com/xero/models/assets/AssetType.java @@ -0,0 +1,232 @@ +/* + * Xero Assets API + * This the Xero Assets API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.assets; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.assets.BookDepreciationSetting; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * AssetType + */ + +public class AssetType { + @JsonProperty("assetTypeId") + private UUID assetTypeId; + + @JsonProperty("assetTypeName") + private String assetTypeName; + + @JsonProperty("fixedAssetAccountId") + private UUID fixedAssetAccountId; + + @JsonProperty("depreciationExpenseAccountId") + private UUID depreciationExpenseAccountId; + + @JsonProperty("accumulatedDepreciationAccountId") + private UUID accumulatedDepreciationAccountId; + + @JsonProperty("bookDepreciationSetting") + private BookDepreciationSetting bookDepreciationSetting = null; + + @JsonProperty("locks") + private Integer locks; + + public AssetType assetTypeId(UUID assetTypeId) { + this.assetTypeId = assetTypeId; + return this; + } + + /** + * Xero generated unique identifier for asset types + * @return assetTypeId + **/ + @ApiModelProperty(example = "5da209c5-5e19-4a43-b925-71b776c49ced", required = true, value = "Xero generated unique identifier for asset types") + public UUID getAssetTypeId() { + return assetTypeId; + } + + public void setAssetTypeId(UUID assetTypeId) { + this.assetTypeId = assetTypeId; + } + + public AssetType assetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + return this; + } + + /** + * The name of the asset type + * @return assetTypeName + **/ + @ApiModelProperty(example = "Computer Equipment", required = true, value = "The name of the asset type") + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public AssetType fixedAssetAccountId(UUID fixedAssetAccountId) { + this.fixedAssetAccountId = fixedAssetAccountId; + return this; + } + + /** + * The asset account for fixed assets of this type + * @return fixedAssetAccountId + **/ + @ApiModelProperty(example = "24e260f1-bfc4-4766-ad7f-8a8ce01de879", value = "The asset account for fixed assets of this type") + public UUID getFixedAssetAccountId() { + return fixedAssetAccountId; + } + + public void setFixedAssetAccountId(UUID fixedAssetAccountId) { + this.fixedAssetAccountId = fixedAssetAccountId; + } + + public AssetType depreciationExpenseAccountId(UUID depreciationExpenseAccountId) { + this.depreciationExpenseAccountId = depreciationExpenseAccountId; + return this; + } + + /** + * The expense account for the depreciation of fixed assets of this type + * @return depreciationExpenseAccountId + **/ + @ApiModelProperty(example = "b23fc79b-d66b-44b0-a240-e138e086fcbc", value = "The expense account for the depreciation of fixed assets of this type") + public UUID getDepreciationExpenseAccountId() { + return depreciationExpenseAccountId; + } + + public void setDepreciationExpenseAccountId(UUID depreciationExpenseAccountId) { + this.depreciationExpenseAccountId = depreciationExpenseAccountId; + } + + public AssetType accumulatedDepreciationAccountId(UUID accumulatedDepreciationAccountId) { + this.accumulatedDepreciationAccountId = accumulatedDepreciationAccountId; + return this; + } + + /** + * The account for accumulated depreciation of fixed assets of this type + * @return accumulatedDepreciationAccountId + **/ + @ApiModelProperty(example = "ca4c6b39-4f4f-43e8-98da-5e1f350a6694", value = "The account for accumulated depreciation of fixed assets of this type") + public UUID getAccumulatedDepreciationAccountId() { + return accumulatedDepreciationAccountId; + } + + public void setAccumulatedDepreciationAccountId(UUID accumulatedDepreciationAccountId) { + this.accumulatedDepreciationAccountId = accumulatedDepreciationAccountId; + } + + public AssetType bookDepreciationSetting(BookDepreciationSetting bookDepreciationSetting) { + this.bookDepreciationSetting = bookDepreciationSetting; + return this; + } + + /** + * Get bookDepreciationSetting + * @return bookDepreciationSetting + **/ + @ApiModelProperty(required = true, value = "") + public BookDepreciationSetting getBookDepreciationSetting() { + return bookDepreciationSetting; + } + + public void setBookDepreciationSetting(BookDepreciationSetting bookDepreciationSetting) { + this.bookDepreciationSetting = bookDepreciationSetting; + } + + public AssetType locks(Integer locks) { + this.locks = locks; + return this; + } + + /** + * All asset types that have accumulated depreciation for any assets that use them are deemed ‘locked’ and cannot be removed. + * @return locks + **/ + @ApiModelProperty(example = "33", value = "All asset types that have accumulated depreciation for any assets that use them are deemed ‘locked’ and cannot be removed.") + public Integer getLocks() { + return locks; + } + + public void setLocks(Integer locks) { + this.locks = locks; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AssetType assetType = (AssetType) o; + return Objects.equals(this.assetTypeId, assetType.assetTypeId) && + Objects.equals(this.assetTypeName, assetType.assetTypeName) && + Objects.equals(this.fixedAssetAccountId, assetType.fixedAssetAccountId) && + Objects.equals(this.depreciationExpenseAccountId, assetType.depreciationExpenseAccountId) && + Objects.equals(this.accumulatedDepreciationAccountId, assetType.accumulatedDepreciationAccountId) && + Objects.equals(this.bookDepreciationSetting, assetType.bookDepreciationSetting) && + Objects.equals(this.locks, assetType.locks); + } + + @Override + public int hashCode() { + return Objects.hash(assetTypeId, assetTypeName, fixedAssetAccountId, depreciationExpenseAccountId, accumulatedDepreciationAccountId, bookDepreciationSetting, locks); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AssetType {\n"); + sb.append(" assetTypeId: ").append(toIndentedString(assetTypeId)).append("\n"); + sb.append(" assetTypeName: ").append(toIndentedString(assetTypeName)).append("\n"); + sb.append(" fixedAssetAccountId: ").append(toIndentedString(fixedAssetAccountId)).append("\n"); + sb.append(" depreciationExpenseAccountId: ").append(toIndentedString(depreciationExpenseAccountId)).append("\n"); + sb.append(" accumulatedDepreciationAccountId: ").append(toIndentedString(accumulatedDepreciationAccountId)).append("\n"); + sb.append(" bookDepreciationSetting: ").append(toIndentedString(bookDepreciationSetting)).append("\n"); + sb.append(" locks: ").append(toIndentedString(locks)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/assets/Assets.java b/src/main/java/com/xero/models/assets/Assets.java new file mode 100644 index 00000000..2af37230 --- /dev/null +++ b/src/main/java/com/xero/models/assets/Assets.java @@ -0,0 +1,127 @@ +/* + * Xero Assets API + * This the Xero Assets API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.assets; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.assets.Asset; +import com.xero.models.assets.Pagination; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Assets + */ + +public class Assets { + @JsonProperty("pagination") + private Pagination pagination = null; + + @JsonProperty("items") + private List items = new ArrayList(); + + public Assets pagination(Pagination pagination) { + this.pagination = pagination; + return this; + } + + /** + * Get pagination + * @return pagination + **/ + @ApiModelProperty(value = "") + public Pagination getPagination() { + return pagination; + } + + public void setPagination(Pagination pagination) { + this.pagination = pagination; + } + + public Assets items(List items) { + this.items = items; + return this; + } + + public Assets addItemsItem(Asset itemsItem) { + if (this.items == null) { + this.items = new ArrayList(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Get items + * @return items + **/ + @ApiModelProperty(value = "") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Assets assets = (Assets) o; + return Objects.equals(this.pagination, assets.pagination) && + Objects.equals(this.items, assets.items); + } + + @Override + public int hashCode() { + return Objects.hash(pagination, items); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Assets {\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/assets/BookDepreciationDetail.java b/src/main/java/com/xero/models/assets/BookDepreciationDetail.java new file mode 100644 index 00000000..b3ab9ef6 --- /dev/null +++ b/src/main/java/com/xero/models/assets/BookDepreciationDetail.java @@ -0,0 +1,231 @@ +/* + * Xero Assets API + * This the Xero Assets API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.assets; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.threeten.bp.LocalDate; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * BookDepreciationDetail + */ + +public class BookDepreciationDetail { + @JsonProperty("currentCapitalGain") + private Integer currentCapitalGain; + + @JsonProperty("currentGainLoss") + private Integer currentGainLoss; + + @JsonProperty("depreciationStartDate") + private LocalDate depreciationStartDate; + + @JsonProperty("costLimit") + private Integer costLimit; + + @JsonProperty("residualValue") + private Integer residualValue; + + @JsonProperty("priorAccumDepreciationAmount") + private Integer priorAccumDepreciationAmount; + + @JsonProperty("currentAccumDepreciationAmount") + private Integer currentAccumDepreciationAmount; + + public BookDepreciationDetail currentCapitalGain(Integer currentCapitalGain) { + this.currentCapitalGain = currentCapitalGain; + return this; + } + + /** + * When an asset is disposed, this will be the sell price minus the purchase price if a profit was made. + * @return currentCapitalGain + **/ + @ApiModelProperty(example = "0", value = "When an asset is disposed, this will be the sell price minus the purchase price if a profit was made.") + public Integer getCurrentCapitalGain() { + return currentCapitalGain; + } + + public void setCurrentCapitalGain(Integer currentCapitalGain) { + this.currentCapitalGain = currentCapitalGain; + } + + public BookDepreciationDetail currentGainLoss(Integer currentGainLoss) { + this.currentGainLoss = currentGainLoss; + return this; + } + + /** + * When an asset is disposed, this will be the lowest one of sell price or purchase price, minus the current book value. + * @return currentGainLoss + **/ + @ApiModelProperty(example = "0", value = "When an asset is disposed, this will be the lowest one of sell price or purchase price, minus the current book value.") + public Integer getCurrentGainLoss() { + return currentGainLoss; + } + + public void setCurrentGainLoss(Integer currentGainLoss) { + this.currentGainLoss = currentGainLoss; + } + + public BookDepreciationDetail depreciationStartDate(LocalDate depreciationStartDate) { + this.depreciationStartDate = depreciationStartDate; + return this; + } + + /** + * YYYY-MM-DD + * @return depreciationStartDate + **/ + @ApiModelProperty(value = "YYYY-MM-DD") + public LocalDate getDepreciationStartDate() { + return depreciationStartDate; + } + + public void setDepreciationStartDate(LocalDate depreciationStartDate) { + this.depreciationStartDate = depreciationStartDate; + } + + public BookDepreciationDetail costLimit(Integer costLimit) { + this.costLimit = costLimit; + return this; + } + + /** + * The value of the asset you want to depreciate, if this is less than the cost of the asset. + * @return costLimit + **/ + @ApiModelProperty(example = "100000", value = "The value of the asset you want to depreciate, if this is less than the cost of the asset.") + public Integer getCostLimit() { + return costLimit; + } + + public void setCostLimit(Integer costLimit) { + this.costLimit = costLimit; + } + + public BookDepreciationDetail residualValue(Integer residualValue) { + this.residualValue = residualValue; + return this; + } + + /** + * The value of the asset remaining when you've fully depreciated it. + * @return residualValue + **/ + @ApiModelProperty(example = "10000", value = "The value of the asset remaining when you've fully depreciated it.") + public Integer getResidualValue() { + return residualValue; + } + + public void setResidualValue(Integer residualValue) { + this.residualValue = residualValue; + } + + public BookDepreciationDetail priorAccumDepreciationAmount(Integer priorAccumDepreciationAmount) { + this.priorAccumDepreciationAmount = priorAccumDepreciationAmount; + return this; + } + + /** + * All depreciation prior to the current financial year. + * @return priorAccumDepreciationAmount + **/ + @ApiModelProperty(example = "0", value = "All depreciation prior to the current financial year.") + public Integer getPriorAccumDepreciationAmount() { + return priorAccumDepreciationAmount; + } + + public void setPriorAccumDepreciationAmount(Integer priorAccumDepreciationAmount) { + this.priorAccumDepreciationAmount = priorAccumDepreciationAmount; + } + + public BookDepreciationDetail currentAccumDepreciationAmount(Integer currentAccumDepreciationAmount) { + this.currentAccumDepreciationAmount = currentAccumDepreciationAmount; + return this; + } + + /** + * All depreciation occurring in the current financial year. + * @return currentAccumDepreciationAmount + **/ + @ApiModelProperty(example = "0", value = "All depreciation occurring in the current financial year.") + public Integer getCurrentAccumDepreciationAmount() { + return currentAccumDepreciationAmount; + } + + public void setCurrentAccumDepreciationAmount(Integer currentAccumDepreciationAmount) { + this.currentAccumDepreciationAmount = currentAccumDepreciationAmount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BookDepreciationDetail bookDepreciationDetail = (BookDepreciationDetail) o; + return Objects.equals(this.currentCapitalGain, bookDepreciationDetail.currentCapitalGain) && + Objects.equals(this.currentGainLoss, bookDepreciationDetail.currentGainLoss) && + Objects.equals(this.depreciationStartDate, bookDepreciationDetail.depreciationStartDate) && + Objects.equals(this.costLimit, bookDepreciationDetail.costLimit) && + Objects.equals(this.residualValue, bookDepreciationDetail.residualValue) && + Objects.equals(this.priorAccumDepreciationAmount, bookDepreciationDetail.priorAccumDepreciationAmount) && + Objects.equals(this.currentAccumDepreciationAmount, bookDepreciationDetail.currentAccumDepreciationAmount); + } + + @Override + public int hashCode() { + return Objects.hash(currentCapitalGain, currentGainLoss, depreciationStartDate, costLimit, residualValue, priorAccumDepreciationAmount, currentAccumDepreciationAmount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BookDepreciationDetail {\n"); + sb.append(" currentCapitalGain: ").append(toIndentedString(currentCapitalGain)).append("\n"); + sb.append(" currentGainLoss: ").append(toIndentedString(currentGainLoss)).append("\n"); + sb.append(" depreciationStartDate: ").append(toIndentedString(depreciationStartDate)).append("\n"); + sb.append(" costLimit: ").append(toIndentedString(costLimit)).append("\n"); + sb.append(" residualValue: ").append(toIndentedString(residualValue)).append("\n"); + sb.append(" priorAccumDepreciationAmount: ").append(toIndentedString(priorAccumDepreciationAmount)).append("\n"); + sb.append(" currentAccumDepreciationAmount: ").append(toIndentedString(currentAccumDepreciationAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/assets/BookDepreciationSetting.java b/src/main/java/com/xero/models/assets/BookDepreciationSetting.java new file mode 100644 index 00000000..12f6b1d4 --- /dev/null +++ b/src/main/java/com/xero/models/assets/BookDepreciationSetting.java @@ -0,0 +1,299 @@ +/* + * Xero Assets API + * This the Xero Assets API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.assets; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * BookDepreciationSetting + */ + +public class BookDepreciationSetting { + /** + * The method of depreciation applied to this asset. See Depreciation Methods + */ + public enum DepreciationMethodEnum { + NODEPRECIATION("NoDepreciation"), + + STRAIGHTLINE("StraightLine"), + + DIMINISHINGVALUE100("DiminishingValue100"), + + DIMINISHINGVALUE150("DiminishingValue150"), + + DIMINISHINGVALUE200("DiminishingValue200"), + + FULLDEPRECIATION("FullDepreciation"); + + private String value; + + DepreciationMethodEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static DepreciationMethodEnum fromValue(String value) { + for (DepreciationMethodEnum b : DepreciationMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("depreciationMethod") + private DepreciationMethodEnum depreciationMethod; + + /** + * The method of averaging applied to this asset. See Averaging Methods + */ + public enum AveragingMethodEnum { + FULLMONTH("FullMonth"), + + ACTUALDAYS("ActualDays"); + + private String value; + + AveragingMethodEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static AveragingMethodEnum fromValue(String value) { + for (AveragingMethodEnum b : AveragingMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("averagingMethod") + private AveragingMethodEnum averagingMethod; + + @JsonProperty("depreciationRate") + private Float depreciationRate; + + @JsonProperty("effectiveLifeYears") + private Integer effectiveLifeYears; + + /** + * See Depreciation Calculation Methods + */ + public enum DepreciationCalculationMethodEnum { + RATE("Rate"), + + LIFE("Life"), + + NONE("None"); + + private String value; + + DepreciationCalculationMethodEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static DepreciationCalculationMethodEnum fromValue(String value) { + for (DepreciationCalculationMethodEnum b : DepreciationCalculationMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("depreciationCalculationMethod") + private DepreciationCalculationMethodEnum depreciationCalculationMethod; + + public BookDepreciationSetting depreciationMethod(DepreciationMethodEnum depreciationMethod) { + this.depreciationMethod = depreciationMethod; + return this; + } + + /** + * The method of depreciation applied to this asset. See Depreciation Methods + * @return depreciationMethod + **/ + @ApiModelProperty(example = "StraightLine", value = "The method of depreciation applied to this asset. See Depreciation Methods") + public DepreciationMethodEnum getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(DepreciationMethodEnum depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public BookDepreciationSetting averagingMethod(AveragingMethodEnum averagingMethod) { + this.averagingMethod = averagingMethod; + return this; + } + + /** + * The method of averaging applied to this asset. See Averaging Methods + * @return averagingMethod + **/ + @ApiModelProperty(example = "ActualDays", value = "The method of averaging applied to this asset. See Averaging Methods") + public AveragingMethodEnum getAveragingMethod() { + return averagingMethod; + } + + public void setAveragingMethod(AveragingMethodEnum averagingMethod) { + this.averagingMethod = averagingMethod; + } + + public BookDepreciationSetting depreciationRate(Float depreciationRate) { + this.depreciationRate = depreciationRate; + return this; + } + + /** + * The rate of depreciation (e.g. 0.05) + * @return depreciationRate + **/ + @ApiModelProperty(example = "0.05", value = "The rate of depreciation (e.g. 0.05)") + public Float getDepreciationRate() { + return depreciationRate; + } + + public void setDepreciationRate(Float depreciationRate) { + this.depreciationRate = depreciationRate; + } + + public BookDepreciationSetting effectiveLifeYears(Integer effectiveLifeYears) { + this.effectiveLifeYears = effectiveLifeYears; + return this; + } + + /** + * Effective life of the asset in years (e.g. 5) + * @return effectiveLifeYears + **/ + @ApiModelProperty(example = "5", value = "Effective life of the asset in years (e.g. 5)") + public Integer getEffectiveLifeYears() { + return effectiveLifeYears; + } + + public void setEffectiveLifeYears(Integer effectiveLifeYears) { + this.effectiveLifeYears = effectiveLifeYears; + } + + public BookDepreciationSetting depreciationCalculationMethod(DepreciationCalculationMethodEnum depreciationCalculationMethod) { + this.depreciationCalculationMethod = depreciationCalculationMethod; + return this; + } + + /** + * See Depreciation Calculation Methods + * @return depreciationCalculationMethod + **/ + @ApiModelProperty(example = "None", value = "See Depreciation Calculation Methods") + public DepreciationCalculationMethodEnum getDepreciationCalculationMethod() { + return depreciationCalculationMethod; + } + + public void setDepreciationCalculationMethod(DepreciationCalculationMethodEnum depreciationCalculationMethod) { + this.depreciationCalculationMethod = depreciationCalculationMethod; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BookDepreciationSetting bookDepreciationSetting = (BookDepreciationSetting) o; + return Objects.equals(this.depreciationMethod, bookDepreciationSetting.depreciationMethod) && + Objects.equals(this.averagingMethod, bookDepreciationSetting.averagingMethod) && + Objects.equals(this.depreciationRate, bookDepreciationSetting.depreciationRate) && + Objects.equals(this.effectiveLifeYears, bookDepreciationSetting.effectiveLifeYears) && + Objects.equals(this.depreciationCalculationMethod, bookDepreciationSetting.depreciationCalculationMethod); + } + + @Override + public int hashCode() { + return Objects.hash(depreciationMethod, averagingMethod, depreciationRate, effectiveLifeYears, depreciationCalculationMethod); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BookDepreciationSetting {\n"); + sb.append(" depreciationMethod: ").append(toIndentedString(depreciationMethod)).append("\n"); + sb.append(" averagingMethod: ").append(toIndentedString(averagingMethod)).append("\n"); + sb.append(" depreciationRate: ").append(toIndentedString(depreciationRate)).append("\n"); + sb.append(" effectiveLifeYears: ").append(toIndentedString(effectiveLifeYears)).append("\n"); + sb.append(" depreciationCalculationMethod: ").append(toIndentedString(depreciationCalculationMethod)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/assets/Pagination.java b/src/main/java/com/xero/models/assets/Pagination.java new file mode 100644 index 00000000..03092f8d --- /dev/null +++ b/src/main/java/com/xero/models/assets/Pagination.java @@ -0,0 +1,161 @@ +/* + * Xero Assets API + * This the Xero Assets API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.assets; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Pagination + */ + +public class Pagination { + @JsonProperty("page") + private Integer page; + + @JsonProperty("pageSize") + private Integer pageSize; + + @JsonProperty("pageCount") + private Integer pageCount; + + @JsonProperty("itemCount") + private Integer itemCount; + + public Pagination page(Integer page) { + this.page = page; + return this; + } + + /** + * Get page + * @return page + **/ + @ApiModelProperty(example = "1", value = "") + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public Pagination pageSize(Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Get pageSize + * @return pageSize + **/ + @ApiModelProperty(example = "10", value = "") + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public Pagination pageCount(Integer pageCount) { + this.pageCount = pageCount; + return this; + } + + /** + * Get pageCount + * @return pageCount + **/ + @ApiModelProperty(example = "1", value = "") + public Integer getPageCount() { + return pageCount; + } + + public void setPageCount(Integer pageCount) { + this.pageCount = pageCount; + } + + public Pagination itemCount(Integer itemCount) { + this.itemCount = itemCount; + return this; + } + + /** + * Get itemCount + * @return itemCount + **/ + @ApiModelProperty(example = "2", value = "") + public Integer getItemCount() { + return itemCount; + } + + public void setItemCount(Integer itemCount) { + this.itemCount = itemCount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pagination pagination = (Pagination) o; + return Objects.equals(this.page, pagination.page) && + Objects.equals(this.pageSize, pagination.pageSize) && + Objects.equals(this.pageCount, pagination.pageCount) && + Objects.equals(this.itemCount, pagination.itemCount); + } + + @Override + public int hashCode() { + return Objects.hash(page, pageSize, pageCount, itemCount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pagination {\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" pageCount: ").append(toIndentedString(pageCount)).append("\n"); + sb.append(" itemCount: ").append(toIndentedString(itemCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/assets/Setting.java b/src/main/java/com/xero/models/assets/Setting.java new file mode 100644 index 00000000..19fd07c0 --- /dev/null +++ b/src/main/java/com/xero/models/assets/Setting.java @@ -0,0 +1,255 @@ +/* + * Xero Assets API + * This the Xero Assets API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.assets; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; +import org.threeten.bp.LocalDate; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Setting + */ + +public class Setting { + @JsonProperty("assetNumberPrefix") + private String assetNumberPrefix; + + @JsonProperty("assetNumberSequence") + private String assetNumberSequence; + + @JsonProperty("assetStartDate") + private LocalDate assetStartDate; + + @JsonProperty("lastDepreciationDate") + private LocalDate lastDepreciationDate; + + @JsonProperty("defaultGainOnDisposalAccountId") + private UUID defaultGainOnDisposalAccountId; + + @JsonProperty("defaultLossOnDisposalAccountId") + private UUID defaultLossOnDisposalAccountId; + + @JsonProperty("defaultCapitalGainOnDisposalAccountId") + private UUID defaultCapitalGainOnDisposalAccountId; + + @JsonProperty("optInForTax") + private Boolean optInForTax; + + public Setting assetNumberPrefix(String assetNumberPrefix) { + this.assetNumberPrefix = assetNumberPrefix; + return this; + } + + /** + * The prefix used for fixed asset numbers (“FA-” by default) + * @return assetNumberPrefix + **/ + @ApiModelProperty(example = "FA-", value = "The prefix used for fixed asset numbers (“FA-” by default)") + public String getAssetNumberPrefix() { + return assetNumberPrefix; + } + + public void setAssetNumberPrefix(String assetNumberPrefix) { + this.assetNumberPrefix = assetNumberPrefix; + } + + public Setting assetNumberSequence(String assetNumberSequence) { + this.assetNumberSequence = assetNumberSequence; + return this; + } + + /** + * The next available sequence number + * @return assetNumberSequence + **/ + @ApiModelProperty(example = "0022", value = "The next available sequence number") + public String getAssetNumberSequence() { + return assetNumberSequence; + } + + public void setAssetNumberSequence(String assetNumberSequence) { + this.assetNumberSequence = assetNumberSequence; + } + + public Setting assetStartDate(LocalDate assetStartDate) { + this.assetStartDate = assetStartDate; + return this; + } + + /** + * The date depreciation calculations started on registered fixed assets in Xero + * @return assetStartDate + **/ + @ApiModelProperty(value = "The date depreciation calculations started on registered fixed assets in Xero") + public LocalDate getAssetStartDate() { + return assetStartDate; + } + + public void setAssetStartDate(LocalDate assetStartDate) { + this.assetStartDate = assetStartDate; + } + + public Setting lastDepreciationDate(LocalDate lastDepreciationDate) { + this.lastDepreciationDate = lastDepreciationDate; + return this; + } + + /** + * The last depreciation date + * @return lastDepreciationDate + **/ + @ApiModelProperty(value = "The last depreciation date") + public LocalDate getLastDepreciationDate() { + return lastDepreciationDate; + } + + public void setLastDepreciationDate(LocalDate lastDepreciationDate) { + this.lastDepreciationDate = lastDepreciationDate; + } + + public Setting defaultGainOnDisposalAccountId(UUID defaultGainOnDisposalAccountId) { + this.defaultGainOnDisposalAccountId = defaultGainOnDisposalAccountId; + return this; + } + + /** + * Default account that gains are posted to + * @return defaultGainOnDisposalAccountId + **/ + @ApiModelProperty(example = "346ddb97-739a-4274-b43b-66aa3218d17c", value = "Default account that gains are posted to") + public UUID getDefaultGainOnDisposalAccountId() { + return defaultGainOnDisposalAccountId; + } + + public void setDefaultGainOnDisposalAccountId(UUID defaultGainOnDisposalAccountId) { + this.defaultGainOnDisposalAccountId = defaultGainOnDisposalAccountId; + } + + public Setting defaultLossOnDisposalAccountId(UUID defaultLossOnDisposalAccountId) { + this.defaultLossOnDisposalAccountId = defaultLossOnDisposalAccountId; + return this; + } + + /** + * Default account that losses are posted to + * @return defaultLossOnDisposalAccountId + **/ + @ApiModelProperty(example = "1b798541-24e2-4855-9309-c023a0b576f3", value = "Default account that losses are posted to") + public UUID getDefaultLossOnDisposalAccountId() { + return defaultLossOnDisposalAccountId; + } + + public void setDefaultLossOnDisposalAccountId(UUID defaultLossOnDisposalAccountId) { + this.defaultLossOnDisposalAccountId = defaultLossOnDisposalAccountId; + } + + public Setting defaultCapitalGainOnDisposalAccountId(UUID defaultCapitalGainOnDisposalAccountId) { + this.defaultCapitalGainOnDisposalAccountId = defaultCapitalGainOnDisposalAccountId; + return this; + } + + /** + * Default account that capital gains are posted to + * @return defaultCapitalGainOnDisposalAccountId + **/ + @ApiModelProperty(example = "6d6a0bdb-e118-45d8-a023-2ad617ec1cb7", value = "Default account that capital gains are posted to") + public UUID getDefaultCapitalGainOnDisposalAccountId() { + return defaultCapitalGainOnDisposalAccountId; + } + + public void setDefaultCapitalGainOnDisposalAccountId(UUID defaultCapitalGainOnDisposalAccountId) { + this.defaultCapitalGainOnDisposalAccountId = defaultCapitalGainOnDisposalAccountId; + } + + public Setting optInForTax(Boolean optInForTax) { + this.optInForTax = optInForTax; + return this; + } + + /** + * opt in for tax calculation + * @return optInForTax + **/ + @ApiModelProperty(example = "false", value = "opt in for tax calculation") + public Boolean getOptInForTax() { + return optInForTax; + } + + public void setOptInForTax(Boolean optInForTax) { + this.optInForTax = optInForTax; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Setting setting = (Setting) o; + return Objects.equals(this.assetNumberPrefix, setting.assetNumberPrefix) && + Objects.equals(this.assetNumberSequence, setting.assetNumberSequence) && + Objects.equals(this.assetStartDate, setting.assetStartDate) && + Objects.equals(this.lastDepreciationDate, setting.lastDepreciationDate) && + Objects.equals(this.defaultGainOnDisposalAccountId, setting.defaultGainOnDisposalAccountId) && + Objects.equals(this.defaultLossOnDisposalAccountId, setting.defaultLossOnDisposalAccountId) && + Objects.equals(this.defaultCapitalGainOnDisposalAccountId, setting.defaultCapitalGainOnDisposalAccountId) && + Objects.equals(this.optInForTax, setting.optInForTax); + } + + @Override + public int hashCode() { + return Objects.hash(assetNumberPrefix, assetNumberSequence, assetStartDate, lastDepreciationDate, defaultGainOnDisposalAccountId, defaultLossOnDisposalAccountId, defaultCapitalGainOnDisposalAccountId, optInForTax); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Setting {\n"); + sb.append(" assetNumberPrefix: ").append(toIndentedString(assetNumberPrefix)).append("\n"); + sb.append(" assetNumberSequence: ").append(toIndentedString(assetNumberSequence)).append("\n"); + sb.append(" assetStartDate: ").append(toIndentedString(assetStartDate)).append("\n"); + sb.append(" lastDepreciationDate: ").append(toIndentedString(lastDepreciationDate)).append("\n"); + sb.append(" defaultGainOnDisposalAccountId: ").append(toIndentedString(defaultGainOnDisposalAccountId)).append("\n"); + sb.append(" defaultLossOnDisposalAccountId: ").append(toIndentedString(defaultLossOnDisposalAccountId)).append("\n"); + sb.append(" defaultCapitalGainOnDisposalAccountId: ").append(toIndentedString(defaultCapitalGainOnDisposalAccountId)).append("\n"); + sb.append(" optInForTax: ").append(toIndentedString(optInForTax)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + From bd65eacd0b8361ac3125ed5f0391e881587de243 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Wed, 3 Jul 2019 12:34:09 -0700 Subject: [PATCH 18/76] bank feeds and files API --- .../com/xero/api/client/BankFeedsApi.java | 485 ++++++++ .../java/com/xero/api/client/FilesApi.java | 1074 +++++++++++++++++ .../bankfeeds/CreditDebitIndicator.java | 57 + .../com/xero/models/bankfeeds/EndBalance.java | 116 ++ .../java/com/xero/models/bankfeeds/Error.java | 209 ++++ .../xero/models/bankfeeds/FeedConnection.java | 370 ++++++ .../models/bankfeeds/FeedConnections.java | 127 ++ .../com/xero/models/bankfeeds/Pagination.java | 161 +++ .../xero/models/bankfeeds/StartBalance.java | 116 ++ .../com/xero/models/bankfeeds/Statement.java | 359 ++++++ .../xero/models/bankfeeds/StatementLine.java | 255 ++++ .../com/xero/models/bankfeeds/Statements.java | 127 ++ .../com/xero/models/files/Association.java | 168 +++ .../com/xero/models/files/FileObject.java | 264 ++++ .../xero/models/files/FileResponse204.java | 93 ++ .../java/com/xero/models/files/Files.java | 176 +++ .../java/com/xero/models/files/Folder.java | 190 +++ .../java/com/xero/models/files/Folders.java | 104 ++ .../com/xero/models/files/InlineObject.java | 165 +++ .../com/xero/models/files/ObjectGroup.java | 76 ++ .../com/xero/models/files/ObjectType.java | 120 ++ src/main/java/com/xero/models/files/User.java | 282 +++++ 22 files changed, 5094 insertions(+) create mode 100644 src/main/java/com/xero/api/client/BankFeedsApi.java create mode 100644 src/main/java/com/xero/api/client/FilesApi.java create mode 100644 src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java create mode 100644 src/main/java/com/xero/models/bankfeeds/EndBalance.java create mode 100644 src/main/java/com/xero/models/bankfeeds/Error.java create mode 100644 src/main/java/com/xero/models/bankfeeds/FeedConnection.java create mode 100644 src/main/java/com/xero/models/bankfeeds/FeedConnections.java create mode 100644 src/main/java/com/xero/models/bankfeeds/Pagination.java create mode 100644 src/main/java/com/xero/models/bankfeeds/StartBalance.java create mode 100644 src/main/java/com/xero/models/bankfeeds/Statement.java create mode 100644 src/main/java/com/xero/models/bankfeeds/StatementLine.java create mode 100644 src/main/java/com/xero/models/bankfeeds/Statements.java create mode 100644 src/main/java/com/xero/models/files/Association.java create mode 100644 src/main/java/com/xero/models/files/FileObject.java create mode 100644 src/main/java/com/xero/models/files/FileResponse204.java create mode 100644 src/main/java/com/xero/models/files/Files.java create mode 100644 src/main/java/com/xero/models/files/Folder.java create mode 100644 src/main/java/com/xero/models/files/Folders.java create mode 100644 src/main/java/com/xero/models/files/InlineObject.java create mode 100644 src/main/java/com/xero/models/files/ObjectGroup.java create mode 100644 src/main/java/com/xero/models/files/ObjectType.java create mode 100644 src/main/java/com/xero/models/files/User.java diff --git a/src/main/java/com/xero/api/client/BankFeedsApi.java b/src/main/java/com/xero/api/client/BankFeedsApi.java new file mode 100644 index 00000000..6c3a1596 --- /dev/null +++ b/src/main/java/com/xero/api/client/BankFeedsApi.java @@ -0,0 +1,485 @@ +package com.xero.api.client; + +import com.xero.api.ApiClient; + +import com.xero.models.bankfeeds.Error; +import com.xero.models.bankfeeds.FeedConnection; +import com.xero.models.bankfeeds.FeedConnections; +import com.xero.models.bankfeeds.Statement; +import com.xero.models.bankfeeds.Statements; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.GenericUrl; +import com.google.api.client.http.HttpContent; +import com.google.api.client.http.HttpMethods; +import com.google.api.client.http.HttpHeaders; +import com.google.api.client.http.HttpResponse; +import com.google.api.client.http.FileContent; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.file.Files; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; + +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + + +public class BankFeedsApi { + private ApiClient apiClient; + private String xeroTenantId; + private String userAgent = "Default"; + private String version = "3.0.0-beta-7"; + + public BankFeedsApi() { + this(new ApiClient()); + } + + public BankFeedsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public String getXeroTenantId() { + return xeroTenantId; + } + + public void setXeroTenantId(String xeroTenantId) { + this.xeroTenantId = xeroTenantId; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public String getUserAgent() { + return this.userAgent + "[Xero-Java-" + this.version + "]"; + } + + private static String convertStreamToString(InputStream is) { + + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + StringBuilder sb = new StringBuilder(); + + String line = null; + try { + while ((line = reader.readLine()) != null) { + sb.append(line + "\n"); + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return sb.toString(); + } + + + /** + * create one or more new feed connection + * By passing in the appropriate body, you can create one or more new feed connections in the system + *

201 - feed connection created + *

400 - invalid input, object invalid + * @param feedConnections Feed Connection(s) to add + * @return FeedConnections + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public FeedConnections createFeedConnections(FeedConnections feedConnections) throws IOException { + HttpResponse response = createFeedConnectionsForHttpResponse(feedConnections); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createFeedConnectionsForHttpResponse( FeedConnections feedConnections) throws IOException { + // verify the required parameter 'feedConnections' is set + if (feedConnections == null) { + throw new IllegalArgumentException("Missing the required parameter 'feedConnections' when calling createFeedConnections"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/FeedConnections"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(feedConnections); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + *

202 - Success + *

400 - Statement failed validation + *

403 - Invalid application or feed connection + *

409 - Duplicate statement received + *

413 - Statement exceeds size limit + *

422 - Unprocessable Entity + *

500 - Intermittent Xero Error + * @param statements Feed Connection(s) to add + * @return Statements + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Statements createStatements(Statements statements) throws IOException { + HttpResponse response = createStatementsForHttpResponse(statements); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createStatementsForHttpResponse( Statements statements) throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Statements"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(statements); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * delete an exsiting feed connection + * By passing in the appropriate body, you can create a new feed connections in the system + *

202 - create results matching body content + *

400 - bad input parameter + * @param feedConnections Feed Connections to delete + * @return FeedConnections + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public FeedConnections deleteFeedConnections(FeedConnections feedConnections) throws IOException { + HttpResponse response = deleteFeedConnectionsForHttpResponse(feedConnections); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse deleteFeedConnectionsForHttpResponse( FeedConnections feedConnections) throws IOException { + // verify the required parameter 'feedConnections' is set + if (feedConnections == null) { + throw new IllegalArgumentException("Missing the required parameter 'feedConnections' when calling deleteFeedConnections"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/FeedConnections/DeleteRequests"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(feedConnections); + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * get single feed connection by id + * By passing in a FeedConnection Id options, you can search for available feed connections in the system + *

200 - search results matching criteria + *

400 - bad input parameter + * @param id feed connection id for single object + * @return FeedConnection + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public FeedConnection getFeedConnection(String id) throws IOException { + HttpResponse response = getFeedConnectionForHttpResponse(id); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getFeedConnectionForHttpResponse( String id) throws IOException { + // verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling getFeedConnection"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/FeedConnections/{id}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("id", id); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches feed connections + * By passing in the appropriate options, you can search for available feed connections in the system + *

201 - search results matching criteria + *

400 - bad input parameter + * @param page Page number which specifies the set of records to retrieve. By default the number of the records per set is 10. Example - https://api.xero.com/bankfeeds.xro/1.0/FeedConnections?page=1 to get the second set of the records. When page value is not a number or a negative number, by default, the first set of records is returned. + * @param pageSize Page size which specifies how many records per page will be returned (default 10). Example - https://api.xero.com/bankfeeds.xro/1.0/FeedConnections?pageSize=100 to specify page size of 100. + * @return FeedConnections + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public FeedConnections getFeedConnections(Integer page, Integer pageSize) throws IOException { + HttpResponse response = getFeedConnectionsForHttpResponse(page, pageSize); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getFeedConnectionsForHttpResponse( Integer page, Integer pageSize) throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/FeedConnections"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (page != null) { + String key = "page"; + Object value = page; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (pageSize != null) { + String key = "pageSize"; + Object value = pageSize; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + *

200 - search results matching id for single statement + *

404 - Statement not found + * @param statementId The statementId parameter + * @return Statement + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Statement getStatement(String statementId) throws IOException { + HttpResponse response = getStatementForHttpResponse(statementId); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getStatementForHttpResponse( String statementId) throws IOException { + // verify the required parameter 'statementId' is set + if (statementId == null) { + throw new IllegalArgumentException("Missing the required parameter 'statementId' when calling getStatement"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Statements/{statementId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("statementId", statementId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + *

200 - search results matching criteria + *

400 - bad input parameter + * @param page The page parameter + * @param pageSize The pageSize parameter + * @param xeroApplicationId The xeroApplicationId parameter + * @param xeroTenantId The xeroTenantId parameter + * @param xeroUserId The xeroUserId parameter + * @return Statements + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Statements getStatements(Integer page, Integer pageSize, String xeroApplicationId, String xeroTenantId, String xeroUserId) throws IOException { + HttpResponse response = getStatementsForHttpResponse(page, pageSize, xeroApplicationId, xeroTenantId, xeroUserId); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getStatementsForHttpResponse( Integer page, Integer pageSize, String xeroApplicationId, String xeroTenantId, String xeroUserId) throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Statements"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (page != null) { + String key = "page"; + Object value = page; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (pageSize != null) { + String key = "pageSize"; + Object value = pageSize; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + + 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(); + } + + } +} diff --git a/src/main/java/com/xero/api/client/FilesApi.java b/src/main/java/com/xero/api/client/FilesApi.java new file mode 100644 index 00000000..5c0f16db --- /dev/null +++ b/src/main/java/com/xero/api/client/FilesApi.java @@ -0,0 +1,1074 @@ +package com.xero.api.client; + +import com.xero.api.ApiClient; + +import com.xero.models.files.Association; +import java.io.File; +import com.xero.models.files.FileObject; +import com.xero.models.files.FileResponse204; +import com.xero.models.files.Files; +import com.xero.models.files.Folder; +import java.util.UUID; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.GenericUrl; +import com.google.api.client.http.HttpContent; +import com.google.api.client.http.HttpMethods; +import com.google.api.client.http.HttpHeaders; +import com.google.api.client.http.HttpResponse; +import com.google.api.client.http.FileContent; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.file.Files; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; + +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + + +public class FilesApi { + private ApiClient apiClient; + private String xeroTenantId; + private String userAgent = "Default"; + private String version = "3.0.0-beta-7"; + + public FilesApi() { + this(new ApiClient()); + } + + public FilesApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public String getXeroTenantId() { + return xeroTenantId; + } + + public void setXeroTenantId(String xeroTenantId) { + this.xeroTenantId = xeroTenantId; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public String getUserAgent() { + return this.userAgent + "[Xero-Java-" + this.version + "]"; + } + + private static String convertStreamToString(InputStream is) { + + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + StringBuilder sb = new StringBuilder(); + + String line = null; + try { + while ((line = reader.readLine()) != null) { + sb.append(line + "\n"); + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return sb.toString(); + } + + + /** + * create a new association + * By passing in the appropriate options, you can create a new folder + *

200 - A successful request + *

400 - bad input parameter - TODO + * @param fileId File id for single object + * @param association The association parameter + * @return Association + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Association createFileAssociation(UUID fileId, Association association) throws IOException { + HttpResponse response = createFileAssociationForHttpResponse(fileId, association); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createFileAssociationForHttpResponse(UUID fileId, Association association) throws IOException { + // verify the required parameter 'fileId' is set + if (fileId == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileId' when calling createFileAssociation"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Files/{FileId}/Associations"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("FileId", fileId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + content = apiClient.new JacksonJsonHttpContent(association); + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * create a new folder + * By passing in the appropriate properties, you can create a new folder + *

200 - search results matching criteria + *

400 - bad input parameter - TODO + * @param folder The folder parameter + * @return Folder + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Folder createFolder(Folder folder) throws IOException { + HttpResponse response = createFolderForHttpResponse(folder); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createFolderForHttpResponse(Folder folder) throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Folders"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + content = apiClient.new JacksonJsonHttpContent(folder); + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * delete a file + * Delete a specific file + *

204 - A successful request returns 204 empty response - populate with status property in SDK + * @param fileId File id for single object + * @return FileResponse204 + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public FileResponse204 deleteFile(UUID fileId) throws IOException { + HttpResponse response = deleteFileForHttpResponse(fileId); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse deleteFileForHttpResponse(UUID fileId) throws IOException { + // verify the required parameter 'fileId' is set + if (fileId == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileId' when calling deleteFile"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Files/{FileId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("FileId", fileId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * create a new association + * By passing in the appropriate options, you can create a new folder + *

204 - A successful request + *

400 - bad input parameter - TODO + * @param fileId File id for single object + * @param objectId Object id for single object + * @return FileResponse204 + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public FileResponse204 deleteFileAssociation(UUID fileId, UUID objectId) throws IOException { + HttpResponse response = deleteFileAssociationForHttpResponse(fileId, objectId); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse deleteFileAssociationForHttpResponse(UUID fileId, UUID objectId) throws IOException { + // verify the required parameter 'fileId' is set + if (fileId == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileId' when calling deleteFileAssociation"); + }// verify the required parameter 'objectId' is set + if (objectId == null) { + throw new IllegalArgumentException("Missing the required parameter 'objectId' when calling deleteFileAssociation"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Files/{FileId}/Associations/{ObjectId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("FileId", fileId); + uriVariables.put("ObjectId", objectId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * delete a folder + * By passing in the appropriate ID, you can delete a folder + *

204 - A successful request + *

400 - bad input parameter - TODO + * @param folderId Folder id for single object + * @return FileResponse204 + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public FileResponse204 deleteFolder(UUID folderId) throws IOException { + HttpResponse response = deleteFolderForHttpResponse(folderId); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse deleteFolderForHttpResponse(UUID folderId) throws IOException { + // verify the required parameter 'folderId' is set + if (folderId == null) { + throw new IllegalArgumentException("Missing the required parameter 'folderId' when calling deleteFolder"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Folders/{FolderId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("FolderId", folderId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches files + * By passing in the appropriate options, + *

200 - search results matching criteria + * @param objectId Object id for single object + * @return List<Association> + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public List getAssociationsByObject(UUID objectId) throws IOException { + HttpResponse response = getAssociationsByObjectForHttpResponse(objectId); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference>() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getAssociationsByObjectForHttpResponse(UUID objectId) throws IOException { + // verify the required parameter 'objectId' is set + if (objectId == null) { + throw new IllegalArgumentException("Missing the required parameter 'objectId' when calling getAssociationsByObject"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Associations/{ObjectId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ObjectId", objectId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches for file by unique id + *

200 - search results matching criteria + * @param fileId File id for single object + * @return FileObject + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public FileObject getFile(UUID fileId) throws IOException { + HttpResponse response = getFileForHttpResponse(fileId); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getFileForHttpResponse(UUID fileId) throws IOException { + // verify the required parameter 'fileId' is set + if (fileId == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileId' when calling getFile"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Files/{FileId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("FileId", fileId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches files + * By passing in the appropriate options, + *

200 - search results matching criteria + * @param fileId File id for single object + * @return List<Association> + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public List getFileAssociations(UUID fileId) throws IOException { + HttpResponse response = getFileAssociationsForHttpResponse(fileId); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference>() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getFileAssociationsForHttpResponse(UUID fileId) throws IOException { + // verify the required parameter 'fileId' is set + if (fileId == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileId' when calling getFileAssociations"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Files/{FileId}/Associations"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("FileId", fileId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches files to retrieve the data + * By passing in the appropriate options, retrieve data for specific file + *

200 - returns the byte array of the specific file based on id + * @param fileId File id for single object + * @return File + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ByteArrayInputStream getFileContent(UUID fileId) throws IOException { + HttpResponse response = getFileContentForHttpResponse(fileId); + InputStream is = response.getContent(); + return convertInputToByteArray(is); + + } + + public HttpResponse getFileContentForHttpResponse(UUID fileId) throws IOException { + // verify the required parameter 'fileId' is set + if (fileId == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileId' when calling getFileContent"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Files/{FileId}/Content"; + + // Hacky path manipulation to support different return types from same endpoint + String path = "/Files/{FileId}/Content"; + String type = "/pdf"; + if(path.toLowerCase().contains(type.toLowerCase())) { + correctPath = path.replace("/pdf",""); + headers.setAccept("application/pdf"); + } + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("FileId", fileId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches files + *

200 - search results matching criteria + *

400 - bad input parameter - TODO + * @param pagesize pass an optional page size value + * @param page number of records to skip for pagination + * @param sort values to sort by + * @return Files + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Files getFiles(Integer pagesize, Integer page, String sort) throws IOException { + HttpResponse response = getFilesForHttpResponse(pagesize, page, sort); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getFilesForHttpResponse(Integer pagesize, Integer page, String sort) throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Files"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (pagesize != null) { + String key = "pagesize"; + Object value = pagesize; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches specific folder by id + * By passing in the appropriate ID, you can search for specific folder + *

200 - search results matching criteria + *

400 - bad input parameter - TODO + * @param folderId Folder id for single object + * @return Folder + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Folder getFolder(UUID folderId) throws IOException { + HttpResponse response = getFolderForHttpResponse(folderId); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getFolderForHttpResponse(UUID folderId) throws IOException { + // verify the required parameter 'folderId' is set + if (folderId == null) { + throw new IllegalArgumentException("Missing the required parameter 'folderId' when calling getFolder"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Folders/{FolderId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("FolderId", folderId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches folder + * By passing in the appropriate options, you can search for available folders + *

200 - search results matching criteria + *

400 - bad input parameter - TODO + * @param sort values to sort by + * @return List<Folder> + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public List getFolders(String sort) throws IOException { + HttpResponse response = getFoldersForHttpResponse(sort); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference>() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getFoldersForHttpResponse(String sort) throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Folders"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (sort != null) { + String key = "sort"; + Object value = sort; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * searches inbox folder + * Search for the user inbox + *

200 - search results matching criteria + *

400 - bad input parameter - TODO + * @return Folder + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Folder getInbox() throws IOException { + HttpResponse response = getInboxForHttpResponse(); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse getInboxForHttpResponse() throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Inbox"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * Update a file + * Update properties on a single file + *

200 - A successful request + * @param fileId File id for single object + * @param fileObject The fileObject parameter + * @return FileObject + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public FileObject updateFile(UUID fileId, FileObject fileObject) throws IOException { + HttpResponse response = updateFileForHttpResponse(fileId, fileObject); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateFileForHttpResponse(UUID fileId, FileObject fileObject) throws IOException { + // verify the required parameter 'fileId' is set + if (fileId == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileId' when calling updateFile"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Files/{FileId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("FileId", fileId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + content = apiClient.new JacksonJsonHttpContent(fileObject); + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * update folder + * By passing in the appropriate ID and properties, you can update a folder + *

200 - return the updated object + *

400 - bad input parameter - TODO + * @param folderId Folder id for single object + * @param folder The folder parameter + * @return Folder + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Folder updateFolder(UUID folderId, Folder folder) throws IOException { + HttpResponse response = updateFolderForHttpResponse(folderId, folder); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateFolderForHttpResponse(UUID folderId, Folder folder) throws IOException { + // verify the required parameter 'folderId' is set + if (folderId == null) { + throw new IllegalArgumentException("Missing the required parameter 'folderId' when calling updateFolder"); + }// verify the required parameter 'folder' is set + if (folder == null) { + throw new IllegalArgumentException("Missing the required parameter 'folder' when calling updateFolder"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Folders/{FolderId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("FolderId", folderId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + content = apiClient.new JacksonJsonHttpContent(folder); + + + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + + + /** + * upload an File + *

200 - A successful request + *

400 - invalid input, object invalid - TODO + *

409 - an existing item already exists - TODO + * @param folderId pass an optional folder id to save file to specific folder + * @param body The body parameter + * @param name exact name of the file you are uploading + * @param filename The filename parameter + * @param mimeType The mimeType parameter + * @return FileObject + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public FileObject uploadFile(UUID folderId, byte[] body, String name, String filename, String mimeType) throws IOException { + HttpResponse response = uploadFileForHttpResponse(folderId, body, name, filename, mimeType); + //InputStream instream = response.getContent(); + //String result = convertStreamToString(instream); + //System.out.println("RESPONSE: " + result); + //instream.close(); + TypeReference typeRef = new TypeReference() {}; + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse uploadFileForHttpResponse(UUID folderId, byte[] body, String name, String filename, String mimeType) throws IOException { + + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", this.xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Files"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (folderId != null) { + String key = "folderId"; + Object value = folderId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + //HttpContent content = new FileContent(mimeType, body); + HttpContent content = null; + + + + + + + + + + UUID uuid = UUID.randomUUID(); + String boundary = uuid.toString(); + + byte[] head = new String("\r\n--" + boundary + "\r\nContent-Disposition: form-data; name=" + name + ";FileName=" + filename + " \r\nContent-Type: " + mimeType + "\r\n\r\n").getBytes(); + byte[] trailer = new String("\r\n--" + boundary + "--\r\n").getBytes(); + + String contentType = "multipart/form-data; boundary=" + boundary; + + byte[] destination = new byte[head.length + body.length + trailer.length]; + System.arraycopy(head, 0, destination, 0, head.length); + System.arraycopy(body, 0, destination, head.length, body.length); + System.arraycopy(trailer, 0, destination, head.length + body.length, trailer.length); + + content = new ByteArrayContent(mimeType, destination); + + + + + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + + + + 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(); + } + + } +} diff --git a/src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java b/src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java new file mode 100644 index 00000000..ab2c92c6 --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java @@ -0,0 +1,57 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets CreditDebitIndicator + */ +public enum CreditDebitIndicator { + + CREDIT("CREDIT"), + + DEBIT("DEBIT"); + + private String value; + + CreditDebitIndicator(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static CreditDebitIndicator fromValue(String value) { + for (CreditDebitIndicator b : CreditDebitIndicator.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/bankfeeds/EndBalance.java b/src/main/java/com/xero/models/bankfeeds/EndBalance.java new file mode 100644 index 00000000..f1ae5746 --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/EndBalance.java @@ -0,0 +1,116 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.bankfeeds.CreditDebitIndicator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * EndBalance + */ + +public class EndBalance { + @JsonProperty("amount") + private String amount; + + @JsonProperty("creditDebitIndicator") + private CreditDebitIndicator creditDebitIndicator; + + public EndBalance amount(String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @ApiModelProperty(example = "10.1340", value = "") + public String getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = amount; + } + + public EndBalance creditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { + this.creditDebitIndicator = creditDebitIndicator; + return this; + } + + /** + * Get creditDebitIndicator + * @return creditDebitIndicator + **/ + @ApiModelProperty(value = "") + public CreditDebitIndicator getCreditDebitIndicator() { + return creditDebitIndicator; + } + + public void setCreditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { + this.creditDebitIndicator = creditDebitIndicator; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EndBalance endBalance = (EndBalance) o; + return Objects.equals(this.amount, endBalance.amount) && + Objects.equals(this.creditDebitIndicator, endBalance.creditDebitIndicator); + } + + @Override + public int hashCode() { + return Objects.hash(amount, creditDebitIndicator); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EndBalance {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" creditDebitIndicator: ").append(toIndentedString(creditDebitIndicator)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/bankfeeds/Error.java b/src/main/java/com/xero/models/bankfeeds/Error.java new file mode 100644 index 00000000..f80bd313 --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/Error.java @@ -0,0 +1,209 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * On error, the API consumer will receive an HTTP response with a HTTP Status Code of 4xx or 5xx and a Content-Type of application/problem+json. + */ +@ApiModel(description = "On error, the API consumer will receive an HTTP response with a HTTP Status Code of 4xx or 5xx and a Content-Type of application/problem+json.") + +public class Error { + @JsonProperty("title") + private String title; + + @JsonProperty("status") + private Integer status; + + @JsonProperty("detail") + private String detail; + + /** + * Gets or Sets type + */ + public enum TypeEnum { + INVALID_REQUEST("invalid-request"), + + INVALID_APPLICATION("invalid-application"), + + INVALID_FEED_CONNECTION("invalid-feed-connection"), + + DUPLICATE_STATEMENT("duplicate-statement"), + + INVALID_END_BALANCE("invalid-end-balance"), + + INVALID_START_AND_END_DATE("invalid-start-and-end-date"), + + INVALID_START_DATE("invalid-start-date"), + + INTERNAL_ERROR("internal-error"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("type") + private TypeEnum type; + + public Error title(String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + **/ + @ApiModelProperty(example = "Invalid Application", value = "") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Error status(Integer status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(example = "403", value = "") + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Error detail(String detail) { + this.detail = detail; + return this; + } + + /** + * Get detail + * @return detail + **/ + @ApiModelProperty(example = "The application has not been configured to use these API endpoints.", value = "") + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + public Error type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(example = "invalid-application", value = "") + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.title, error.title) && + Objects.equals(this.status, error.status) && + Objects.equals(this.detail, error.detail) && + Objects.equals(this.type, error.type); + } + + @Override + public int hashCode() { + return Objects.hash(title, status, detail, type); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/bankfeeds/FeedConnection.java b/src/main/java/com/xero/models/bankfeeds/FeedConnection.java new file mode 100644 index 00000000..f2e172dd --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/FeedConnection.java @@ -0,0 +1,370 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.bankfeeds.Error; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * FeedConnection + */ + +public class FeedConnection { + @JsonProperty("id") + private String id; + + @JsonProperty("accountToken") + private String accountToken; + + @JsonProperty("accountNumber") + private String accountNumber; + + @JsonProperty("accountName") + private String accountName; + + @JsonProperty("accountId") + private String accountId; + + /** + * Gets or Sets accountType + */ + public enum AccountTypeEnum { + BANK("BANK"), + + CREDITCARD("CREDITCARD"); + + private String value; + + AccountTypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static AccountTypeEnum fromValue(String value) { + for (AccountTypeEnum b : AccountTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("accountType") + private AccountTypeEnum accountType; + + @JsonProperty("currency") + private String currency; + + @JsonProperty("country") + private String country; + + /** + * Gets or Sets status + */ + public enum StatusEnum { + PENDING("PENDING"), + + REJECTED("REJECTED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("status") + private StatusEnum status; + + @JsonProperty("error") + private Error error = null; + + public FeedConnection id(String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(example = "0d3cf8d-95dc-4466-8dc0-47e6d1197e28", required = true, value = "") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public FeedConnection accountToken(String accountToken) { + this.accountToken = accountToken; + return this; + } + + /** + * Get accountToken + * @return accountToken + **/ + @ApiModelProperty(example = "10000123", value = "") + public String getAccountToken() { + return accountToken; + } + + public void setAccountToken(String accountToken) { + this.accountToken = accountToken; + } + + public FeedConnection accountNumber(String accountNumber) { + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + **/ + @ApiModelProperty(example = "3809087654321500", value = "") + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public FeedConnection accountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get accountName + * @return accountName + **/ + @ApiModelProperty(example = "Joe's Savings Account", value = "") + public String getAccountName() { + return accountName; + } + + public void setAccountName(String accountName) { + this.accountName = accountName; + } + + public FeedConnection accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @ApiModelProperty(example = "079a88ea-276d-41fb-a1f1-366ef3e22921", value = "") + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public FeedConnection accountType(AccountTypeEnum accountType) { + this.accountType = accountType; + return this; + } + + /** + * Get accountType + * @return accountType + **/ + @ApiModelProperty(example = "BANK", value = "") + public AccountTypeEnum getAccountType() { + return accountType; + } + + public void setAccountType(AccountTypeEnum accountType) { + this.accountType = accountType; + } + + public FeedConnection currency(String currency) { + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @ApiModelProperty(example = "AUD", value = "") + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public FeedConnection country(String country) { + this.country = country; + return this; + } + + /** + * Get country + * @return country + **/ + @ApiModelProperty(example = "GB", value = "") + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public FeedConnection status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(example = "REJECTED", value = "") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public FeedConnection error(Error error) { + this.error = error; + return this; + } + + /** + * Get error + * @return error + **/ + @ApiModelProperty(value = "") + public Error getError() { + return error; + } + + public void setError(Error error) { + this.error = error; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeedConnection feedConnection = (FeedConnection) o; + return Objects.equals(this.id, feedConnection.id) && + Objects.equals(this.accountToken, feedConnection.accountToken) && + Objects.equals(this.accountNumber, feedConnection.accountNumber) && + Objects.equals(this.accountName, feedConnection.accountName) && + Objects.equals(this.accountId, feedConnection.accountId) && + Objects.equals(this.accountType, feedConnection.accountType) && + Objects.equals(this.currency, feedConnection.currency) && + Objects.equals(this.country, feedConnection.country) && + Objects.equals(this.status, feedConnection.status) && + Objects.equals(this.error, feedConnection.error); + } + + @Override + public int hashCode() { + return Objects.hash(id, accountToken, accountNumber, accountName, accountId, accountType, currency, country, status, error); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeedConnection {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" accountToken: ").append(toIndentedString(accountToken)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" accountName: ").append(toIndentedString(accountName)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" country: ").append(toIndentedString(country)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/bankfeeds/FeedConnections.java b/src/main/java/com/xero/models/bankfeeds/FeedConnections.java new file mode 100644 index 00000000..8267a4df --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/FeedConnections.java @@ -0,0 +1,127 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.bankfeeds.FeedConnection; +import com.xero.models.bankfeeds.Pagination; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * FeedConnections + */ + +public class FeedConnections { + @JsonProperty("pagination") + private Pagination pagination = null; + + @JsonProperty("items") + private List items = new ArrayList(); + + public FeedConnections pagination(Pagination pagination) { + this.pagination = pagination; + return this; + } + + /** + * Get pagination + * @return pagination + **/ + @ApiModelProperty(value = "") + public Pagination getPagination() { + return pagination; + } + + public void setPagination(Pagination pagination) { + this.pagination = pagination; + } + + public FeedConnections items(List items) { + this.items = items; + return this; + } + + public FeedConnections addItemsItem(FeedConnection itemsItem) { + if (this.items == null) { + this.items = new ArrayList(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Get items + * @return items + **/ + @ApiModelProperty(value = "") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeedConnections feedConnections = (FeedConnections) o; + return Objects.equals(this.pagination, feedConnections.pagination) && + Objects.equals(this.items, feedConnections.items); + } + + @Override + public int hashCode() { + return Objects.hash(pagination, items); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeedConnections {\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/bankfeeds/Pagination.java b/src/main/java/com/xero/models/bankfeeds/Pagination.java new file mode 100644 index 00000000..b45ff526 --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/Pagination.java @@ -0,0 +1,161 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Pagination + */ + +public class Pagination { + @JsonProperty("page") + private Integer page; + + @JsonProperty("pageSize") + private Integer pageSize; + + @JsonProperty("pageCount") + private Integer pageCount; + + @JsonProperty("itemCount") + private Integer itemCount; + + public Pagination page(Integer page) { + this.page = page; + return this; + } + + /** + * Get page + * @return page + **/ + @ApiModelProperty(example = "1", value = "") + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public Pagination pageSize(Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Get pageSize + * @return pageSize + **/ + @ApiModelProperty(example = "10", value = "") + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public Pagination pageCount(Integer pageCount) { + this.pageCount = pageCount; + return this; + } + + /** + * Get pageCount + * @return pageCount + **/ + @ApiModelProperty(example = "1", value = "") + public Integer getPageCount() { + return pageCount; + } + + public void setPageCount(Integer pageCount) { + this.pageCount = pageCount; + } + + public Pagination itemCount(Integer itemCount) { + this.itemCount = itemCount; + return this; + } + + /** + * Get itemCount + * @return itemCount + **/ + @ApiModelProperty(example = "2", value = "") + public Integer getItemCount() { + return itemCount; + } + + public void setItemCount(Integer itemCount) { + this.itemCount = itemCount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pagination pagination = (Pagination) o; + return Objects.equals(this.page, pagination.page) && + Objects.equals(this.pageSize, pagination.pageSize) && + Objects.equals(this.pageCount, pagination.pageCount) && + Objects.equals(this.itemCount, pagination.itemCount); + } + + @Override + public int hashCode() { + return Objects.hash(page, pageSize, pageCount, itemCount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pagination {\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" pageCount: ").append(toIndentedString(pageCount)).append("\n"); + sb.append(" itemCount: ").append(toIndentedString(itemCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/bankfeeds/StartBalance.java b/src/main/java/com/xero/models/bankfeeds/StartBalance.java new file mode 100644 index 00000000..f6b1c0a2 --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/StartBalance.java @@ -0,0 +1,116 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.bankfeeds.CreditDebitIndicator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * StartBalance + */ + +public class StartBalance { + @JsonProperty("amount") + private String amount; + + @JsonProperty("creditDebitIndicator") + private CreditDebitIndicator creditDebitIndicator; + + public StartBalance amount(String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @ApiModelProperty(example = "9.0000", value = "") + public String getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = amount; + } + + public StartBalance creditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { + this.creditDebitIndicator = creditDebitIndicator; + return this; + } + + /** + * Get creditDebitIndicator + * @return creditDebitIndicator + **/ + @ApiModelProperty(value = "") + public CreditDebitIndicator getCreditDebitIndicator() { + return creditDebitIndicator; + } + + public void setCreditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { + this.creditDebitIndicator = creditDebitIndicator; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StartBalance startBalance = (StartBalance) o; + return Objects.equals(this.amount, startBalance.amount) && + Objects.equals(this.creditDebitIndicator, startBalance.creditDebitIndicator); + } + + @Override + public int hashCode() { + return Objects.hash(amount, creditDebitIndicator); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StartBalance {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" creditDebitIndicator: ").append(toIndentedString(creditDebitIndicator)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/bankfeeds/Statement.java b/src/main/java/com/xero/models/bankfeeds/Statement.java new file mode 100644 index 00000000..624d8e4b --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/Statement.java @@ -0,0 +1,359 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.bankfeeds.EndBalance; +import com.xero.models.bankfeeds.Error; +import com.xero.models.bankfeeds.StartBalance; +import com.xero.models.bankfeeds.StatementLine; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.threeten.bp.LocalDate; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Statement + */ + +public class Statement { + @JsonProperty("id") + private String id; + + @JsonProperty("feedConnectionId") + private String feedConnectionId; + + /** + * Gets or Sets status + */ + public enum StatusEnum { + PENDING("PENDING"), + + REJECTED("REJECTED"), + + DELIVERED("DELIVERED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("status") + private StatusEnum status; + + @JsonProperty("startDate") + private LocalDate startDate; + + @JsonProperty("endDate") + private LocalDate endDate; + + @JsonProperty("startBalance") + private StartBalance startBalance = null; + + @JsonProperty("endBalance") + private EndBalance endBalance = null; + + @JsonProperty("statementLines") + private List statementLines = new ArrayList(); + + @JsonProperty("errors") + private List errors = new ArrayList(); + + @JsonProperty("statementLineCount") + private Integer statementLineCount; + + public Statement id(String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(example = "ba4f3127-5e46-427d-80ea-dea2fcd26afe", required = true, value = "") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Statement feedConnectionId(String feedConnectionId) { + this.feedConnectionId = feedConnectionId; + return this; + } + + /** + * Get feedConnectionId + * @return feedConnectionId + **/ + @ApiModelProperty(example = "87cb0dc8-fa32-409c-b622-19f8de8dcc83", value = "") + public String getFeedConnectionId() { + return feedConnectionId; + } + + public void setFeedConnectionId(String feedConnectionId) { + this.feedConnectionId = feedConnectionId; + } + + public Statement status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(example = "PENDING", value = "") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Statement startDate(LocalDate startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get startDate + * @return startDate + **/ + @ApiModelProperty(value = "") + public LocalDate getStartDate() { + return startDate; + } + + public void setStartDate(LocalDate startDate) { + this.startDate = startDate; + } + + public Statement endDate(LocalDate endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get endDate + * @return endDate + **/ + @ApiModelProperty(value = "") + public LocalDate getEndDate() { + return endDate; + } + + public void setEndDate(LocalDate endDate) { + this.endDate = endDate; + } + + public Statement startBalance(StartBalance startBalance) { + this.startBalance = startBalance; + return this; + } + + /** + * Get startBalance + * @return startBalance + **/ + @ApiModelProperty(value = "") + public StartBalance getStartBalance() { + return startBalance; + } + + public void setStartBalance(StartBalance startBalance) { + this.startBalance = startBalance; + } + + public Statement endBalance(EndBalance endBalance) { + this.endBalance = endBalance; + return this; + } + + /** + * Get endBalance + * @return endBalance + **/ + @ApiModelProperty(value = "") + public EndBalance getEndBalance() { + return endBalance; + } + + public void setEndBalance(EndBalance endBalance) { + this.endBalance = endBalance; + } + + public Statement statementLines(List statementLines) { + this.statementLines = statementLines; + return this; + } + + public Statement addStatementLinesItem(StatementLine statementLinesItem) { + if (this.statementLines == null) { + this.statementLines = new ArrayList(); + } + this.statementLines.add(statementLinesItem); + return this; + } + + /** + * Get statementLines + * @return statementLines + **/ + @ApiModelProperty(value = "") + public List getStatementLines() { + return statementLines; + } + + public void setStatementLines(List statementLines) { + this.statementLines = statementLines; + } + + public Statement errors(List errors) { + this.errors = errors; + return this; + } + + public Statement addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + **/ + @ApiModelProperty(value = "") + public List getErrors() { + return errors; + } + + public void setErrors(List errors) { + this.errors = errors; + } + + public Statement statementLineCount(Integer statementLineCount) { + this.statementLineCount = statementLineCount; + return this; + } + + /** + * Get statementLineCount + * @return statementLineCount + **/ + @ApiModelProperty(example = "1", value = "") + public Integer getStatementLineCount() { + return statementLineCount; + } + + public void setStatementLineCount(Integer statementLineCount) { + this.statementLineCount = statementLineCount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Statement statement = (Statement) o; + return Objects.equals(this.id, statement.id) && + Objects.equals(this.feedConnectionId, statement.feedConnectionId) && + Objects.equals(this.status, statement.status) && + Objects.equals(this.startDate, statement.startDate) && + Objects.equals(this.endDate, statement.endDate) && + Objects.equals(this.startBalance, statement.startBalance) && + Objects.equals(this.endBalance, statement.endBalance) && + Objects.equals(this.statementLines, statement.statementLines) && + Objects.equals(this.errors, statement.errors) && + Objects.equals(this.statementLineCount, statement.statementLineCount); + } + + @Override + public int hashCode() { + return Objects.hash(id, feedConnectionId, status, startDate, endDate, startBalance, endBalance, statementLines, errors, statementLineCount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Statement {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" feedConnectionId: ").append(toIndentedString(feedConnectionId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" startBalance: ").append(toIndentedString(startBalance)).append("\n"); + sb.append(" endBalance: ").append(toIndentedString(endBalance)).append("\n"); + sb.append(" statementLines: ").append(toIndentedString(statementLines)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" statementLineCount: ").append(toIndentedString(statementLineCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/bankfeeds/StatementLine.java b/src/main/java/com/xero/models/bankfeeds/StatementLine.java new file mode 100644 index 00000000..01c58100 --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/StatementLine.java @@ -0,0 +1,255 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.bankfeeds.CreditDebitIndicator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.threeten.bp.LocalDate; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * StatementLine + */ + +public class StatementLine { + @JsonProperty("postedDate") + private LocalDate postedDate; + + @JsonProperty("description") + private String description; + + @JsonProperty("amount") + private String amount; + + @JsonProperty("creditDebitIndicator") + private CreditDebitIndicator creditDebitIndicator; + + @JsonProperty("transactionId") + private String transactionId; + + @JsonProperty("payeeName") + private String payeeName; + + @JsonProperty("reference") + private String reference; + + @JsonProperty("chequeNumber") + private String chequeNumber; + + public StatementLine postedDate(LocalDate postedDate) { + this.postedDate = postedDate; + return this; + } + + /** + * Get postedDate + * @return postedDate + **/ + @ApiModelProperty(value = "") + public LocalDate getPostedDate() { + return postedDate; + } + + public void setPostedDate(LocalDate postedDate) { + this.postedDate = postedDate; + } + + public StatementLine description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @ApiModelProperty(example = "Description for statement line 2", value = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public StatementLine amount(String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @ApiModelProperty(example = "5.00", value = "") + public String getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = amount; + } + + public StatementLine creditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { + this.creditDebitIndicator = creditDebitIndicator; + return this; + } + + /** + * Get creditDebitIndicator + * @return creditDebitIndicator + **/ + @ApiModelProperty(value = "") + public CreditDebitIndicator getCreditDebitIndicator() { + return creditDebitIndicator; + } + + public void setCreditDebitIndicator(CreditDebitIndicator creditDebitIndicator) { + this.creditDebitIndicator = creditDebitIndicator; + } + + public StatementLine transactionId(String transactionId) { + this.transactionId = transactionId; + return this; + } + + /** + * Get transactionId + * @return transactionId + **/ + @ApiModelProperty(example = "transaction-id-2", value = "") + public String getTransactionId() { + return transactionId; + } + + public void setTransactionId(String transactionId) { + this.transactionId = transactionId; + } + + public StatementLine payeeName(String payeeName) { + this.payeeName = payeeName; + return this; + } + + /** + * Get payeeName + * @return payeeName + **/ + @ApiModelProperty(example = "Payee name for statement line 2", value = "") + public String getPayeeName() { + return payeeName; + } + + public void setPayeeName(String payeeName) { + this.payeeName = payeeName; + } + + public StatementLine reference(String reference) { + this.reference = reference; + return this; + } + + /** + * Get reference + * @return reference + **/ + @ApiModelProperty(example = "Reference for statement line 2", value = "") + public String getReference() { + return reference; + } + + public void setReference(String reference) { + this.reference = reference; + } + + public StatementLine chequeNumber(String chequeNumber) { + this.chequeNumber = chequeNumber; + return this; + } + + /** + * Get chequeNumber + * @return chequeNumber + **/ + @ApiModelProperty(example = "021", value = "") + public String getChequeNumber() { + return chequeNumber; + } + + public void setChequeNumber(String chequeNumber) { + this.chequeNumber = chequeNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StatementLine statementLine = (StatementLine) o; + return Objects.equals(this.postedDate, statementLine.postedDate) && + Objects.equals(this.description, statementLine.description) && + Objects.equals(this.amount, statementLine.amount) && + Objects.equals(this.creditDebitIndicator, statementLine.creditDebitIndicator) && + Objects.equals(this.transactionId, statementLine.transactionId) && + Objects.equals(this.payeeName, statementLine.payeeName) && + Objects.equals(this.reference, statementLine.reference) && + Objects.equals(this.chequeNumber, statementLine.chequeNumber); + } + + @Override + public int hashCode() { + return Objects.hash(postedDate, description, amount, creditDebitIndicator, transactionId, payeeName, reference, chequeNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatementLine {\n"); + sb.append(" postedDate: ").append(toIndentedString(postedDate)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" creditDebitIndicator: ").append(toIndentedString(creditDebitIndicator)).append("\n"); + sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\n"); + sb.append(" payeeName: ").append(toIndentedString(payeeName)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" chequeNumber: ").append(toIndentedString(chequeNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/bankfeeds/Statements.java b/src/main/java/com/xero/models/bankfeeds/Statements.java new file mode 100644 index 00000000..372b6c58 --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/Statements.java @@ -0,0 +1,127 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.bankfeeds.Pagination; +import com.xero.models.bankfeeds.Statement; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Statements + */ + +public class Statements { + @JsonProperty("pagination") + private Pagination pagination = null; + + @JsonProperty("items") + private List items = new ArrayList(); + + public Statements pagination(Pagination pagination) { + this.pagination = pagination; + return this; + } + + /** + * Get pagination + * @return pagination + **/ + @ApiModelProperty(value = "") + public Pagination getPagination() { + return pagination; + } + + public void setPagination(Pagination pagination) { + this.pagination = pagination; + } + + public Statements items(List items) { + this.items = items; + return this; + } + + public Statements addItemsItem(Statement itemsItem) { + if (this.items == null) { + this.items = new ArrayList(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Get items + * @return items + **/ + @ApiModelProperty(value = "") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Statements statements = (Statements) o; + return Objects.equals(this.pagination, statements.pagination) && + Objects.equals(this.items, statements.items); + } + + @Override + public int hashCode() { + return Objects.hash(pagination, items); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Statements {\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/files/Association.java b/src/main/java/com/xero/models/files/Association.java new file mode 100644 index 00000000..7dc1ccdd --- /dev/null +++ b/src/main/java/com/xero/models/files/Association.java @@ -0,0 +1,168 @@ +/* + * Xero Files API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.files; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.files.ObjectGroup; +import com.xero.models.files.ObjectType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Association + */ + +public class Association { + + @JsonProperty("FileId") + private UUID fileId; + + + @JsonProperty("ObjectId") + private UUID objectId; + + + @JsonProperty("ObjectGroup") + private ObjectGroup objectGroup; + + + @JsonProperty("ObjectType") + private ObjectType objectType; + + public Association fileId(UUID fileId) { + this.fileId = fileId; + return this; + } + + /** + * The unique identifier of the file + * @return fileId + **/ + @ApiModelProperty(value = "The unique identifier of the file") + public UUID getFileId() { + return fileId; + } + + public void setFileId(UUID fileId) { + this.fileId = fileId; + } + + public Association objectId(UUID objectId) { + this.objectId = objectId; + return this; + } + + /** + * The identifier of the object that the file is being associated with (e.g. InvoiceID, BankTransactionID, ContactID) + * @return objectId + **/ + @ApiModelProperty(value = "The identifier of the object that the file is being associated with (e.g. InvoiceID, BankTransactionID, ContactID)") + public UUID getObjectId() { + return objectId; + } + + public void setObjectId(UUID objectId) { + this.objectId = objectId; + } + + public Association objectGroup(ObjectGroup objectGroup) { + this.objectGroup = objectGroup; + return this; + } + + /** + * Get objectGroup + * @return objectGroup + **/ + @ApiModelProperty(value = "") + public ObjectGroup getObjectGroup() { + return objectGroup; + } + + public void setObjectGroup(ObjectGroup objectGroup) { + this.objectGroup = objectGroup; + } + + public Association objectType(ObjectType objectType) { + this.objectType = objectType; + return this; + } + + /** + * Get objectType + * @return objectType + **/ + @ApiModelProperty(value = "") + public ObjectType getObjectType() { + return objectType; + } + + public void setObjectType(ObjectType objectType) { + this.objectType = objectType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Association association = (Association) o; + return Objects.equals(this.fileId, association.fileId) && + Objects.equals(this.objectId, association.objectId) && + Objects.equals(this.objectGroup, association.objectGroup) && + Objects.equals(this.objectType, association.objectType); + } + + @Override + public int hashCode() { + return Objects.hash(fileId, objectId, objectGroup, objectType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Association {\n"); + sb.append(" fileId: ").append(toIndentedString(fileId)).append("\n"); + sb.append(" objectId: ").append(toIndentedString(objectId)).append("\n"); + sb.append(" objectGroup: ").append(toIndentedString(objectGroup)).append("\n"); + sb.append(" objectType: ").append(toIndentedString(objectType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/files/FileObject.java b/src/main/java/com/xero/models/files/FileObject.java new file mode 100644 index 00000000..e1081830 --- /dev/null +++ b/src/main/java/com/xero/models/files/FileObject.java @@ -0,0 +1,264 @@ +/* + * Xero Files API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.files; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.files.User; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * FileObject + */ + +public class FileObject { + + @JsonProperty("Name") + private String name; + + + @JsonProperty("MimeType") + private String mimeType; + + + @JsonProperty("Size") + private Integer size; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("CreatedDateUTC") + private OffsetDateTime createdDateUTC; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + + @JsonProperty("User") + private User user = null; + + + @JsonProperty("Id") + private UUID id; + + + @JsonProperty("FolderId") + private UUID folderId; + + public FileObject name(String name) { + this.name = name; + return this; + } + + /** + * TODO + * @return name + **/ + @ApiModelProperty(example = "File2.jpg", value = "TODO") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public FileObject mimeType(String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * TODO + * @return mimeType + **/ + @ApiModelProperty(example = "image/jpeg", value = "TODO") + public String getMimeType() { + return mimeType; + } + + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + + public FileObject size(Integer size) { + this.size = size; + return this; + } + + /** + * TODO + * @return size + **/ + @ApiModelProperty(example = "3615", value = "TODO") + public Integer getSize() { + return size; + } + + public void setSize(Integer size) { + this.size = size; + } + + public FileObject createdDateUTC(OffsetDateTime createdDateUTC) { + this.createdDateUTC = createdDateUTC; + return this; + } + + /** + * TODO + * @return createdDateUTC + **/ + @ApiModelProperty(value = "TODO") + public OffsetDateTime getCreatedDateUTC() { + return createdDateUTC; + } + + public void setCreatedDateUTC(OffsetDateTime createdDateUTC) { + this.createdDateUTC = createdDateUTC; + } + + public FileObject updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * TODO + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "TODO") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + + public FileObject user(User user) { + this.user = user; + return this; + } + + /** + * Get user + * @return user + **/ + @ApiModelProperty(value = "") + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public FileObject id(UUID id) { + this.id = id; + return this; + } + + /** + * TODO + * @return id + **/ + @ApiModelProperty(example = "d290f1ee-6c54-4b01-90e6-d701748f0851", value = "TODO") + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public FileObject folderId(UUID folderId) { + this.folderId = folderId; + return this; + } + + /** + * TODO + * @return folderId + **/ + @ApiModelProperty(example = "0f8ccf21-7267-4268-9167-a1e2c40c84c8", value = "TODO") + public UUID getFolderId() { + return folderId; + } + + public void setFolderId(UUID folderId) { + this.folderId = folderId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileObject fileObject = (FileObject) o; + return Objects.equals(this.name, fileObject.name) && + Objects.equals(this.mimeType, fileObject.mimeType) && + Objects.equals(this.size, fileObject.size) && + Objects.equals(this.createdDateUTC, fileObject.createdDateUTC) && + Objects.equals(this.updatedDateUTC, fileObject.updatedDateUTC) && + Objects.equals(this.user, fileObject.user) && + Objects.equals(this.id, fileObject.id) && + Objects.equals(this.folderId, fileObject.folderId); + } + + @Override + public int hashCode() { + return Objects.hash(name, mimeType, size, createdDateUTC, updatedDateUTC, user, id, folderId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileObject {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" createdDateUTC: ").append(toIndentedString(createdDateUTC)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" folderId: ").append(toIndentedString(folderId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/files/FileResponse204.java b/src/main/java/com/xero/models/files/FileResponse204.java new file mode 100644 index 00000000..d5e28e94 --- /dev/null +++ b/src/main/java/com/xero/models/files/FileResponse204.java @@ -0,0 +1,93 @@ +/* + * Xero Files API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.files; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * FileResponse204 + */ + +public class FileResponse204 { + + @JsonProperty("Status") + private String status; + + public FileResponse204 status(String status) { + this.status = status; + return this; + } + + /** + * Status response for 204 no content + * @return status + **/ + @ApiModelProperty(value = "Status response for 204 no content") + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileResponse204 fileResponse204 = (FileResponse204) o; + return Objects.equals(this.status, fileResponse204.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileResponse204 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/files/Files.java b/src/main/java/com/xero/models/files/Files.java new file mode 100644 index 00000000..f35946f4 --- /dev/null +++ b/src/main/java/com/xero/models/files/Files.java @@ -0,0 +1,176 @@ +/* + * Xero Files API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.files; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.files.FileObject; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Files + */ + +public class Files { + + @JsonProperty("TotalCount") + private Integer totalCount; + + + @JsonProperty("Page") + private Integer page; + + + @JsonProperty("PerPage") + private Integer perPage; + + + @JsonProperty("Items") + private List items = new ArrayList(); + + public Files totalCount(Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Get totalCount + * @return totalCount + **/ + @ApiModelProperty(example = "2", value = "") + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + public Files page(Integer page) { + this.page = page; + return this; + } + + /** + * Get page + * @return page + **/ + @ApiModelProperty(example = "1", value = "") + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public Files perPage(Integer perPage) { + this.perPage = perPage; + return this; + } + + /** + * Get perPage + * @return perPage + **/ + @ApiModelProperty(example = "50", value = "") + public Integer getPerPage() { + return perPage; + } + + public void setPerPage(Integer perPage) { + this.perPage = perPage; + } + + public Files items(List items) { + this.items = items; + return this; + } + + public Files addItemsItem(FileObject itemsItem) { + if (this.items == null) { + this.items = new ArrayList(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Get items + * @return items + **/ + @ApiModelProperty(value = "") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Files files = (Files) o; + return Objects.equals(this.totalCount, files.totalCount) && + Objects.equals(this.page, files.page) && + Objects.equals(this.perPage, files.perPage) && + Objects.equals(this.items, files.items); + } + + @Override + public int hashCode() { + return Objects.hash(totalCount, page, perPage, items); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Files {\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" perPage: ").append(toIndentedString(perPage)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/files/Folder.java b/src/main/java/com/xero/models/files/Folder.java new file mode 100644 index 00000000..73ee7c9c --- /dev/null +++ b/src/main/java/com/xero/models/files/Folder.java @@ -0,0 +1,190 @@ +/* + * Xero Files API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.files; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Folder + */ + +public class Folder { + + @JsonProperty("Name") + private String name; + + + @JsonProperty("FileCount") + private Integer fileCount; + + + @JsonProperty("Email") + private String email; + + + @JsonProperty("IsInbox") + private Boolean isInbox; + + + @JsonProperty("Id") + private UUID id; + + public Folder name(String name) { + this.name = name; + return this; + } + + /** + * The name of the folder + * @return name + **/ + @ApiModelProperty(example = "assets", value = "The name of the folder") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Folder fileCount(Integer fileCount) { + this.fileCount = fileCount; + return this; + } + + /** + * The number of files in the folder + * @return fileCount + **/ + @ApiModelProperty(example = "5", value = "The number of files in the folder") + public Integer getFileCount() { + return fileCount; + } + + public void setFileCount(Integer fileCount) { + this.fileCount = fileCount; + } + + public Folder email(String email) { + this.email = email; + return this; + } + + /** + * The email address used to email files to the inbox. Only the inbox will have this element. + * @return email + **/ + @ApiModelProperty(example = "foo@bar.com", value = "The email address used to email files to the inbox. Only the inbox will have this element.") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Folder isInbox(Boolean isInbox) { + this.isInbox = isInbox; + return this; + } + + /** + * to indicate if the folder is the Inbox. The Inbox cannot be renamed or deleted. + * @return isInbox + **/ + @ApiModelProperty(example = "true", value = "to indicate if the folder is the Inbox. The Inbox cannot be renamed or deleted.") + public Boolean getIsInbox() { + return isInbox; + } + + public void setIsInbox(Boolean isInbox) { + this.isInbox = isInbox; + } + + public Folder id(UUID id) { + this.id = id; + return this; + } + + /** + * Xero unique identifier for a folder Files + * @return id + **/ + @ApiModelProperty(example = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c", value = "Xero unique identifier for a folder Files") + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Folder folder = (Folder) o; + return Objects.equals(this.name, folder.name) && + Objects.equals(this.fileCount, folder.fileCount) && + Objects.equals(this.email, folder.email) && + Objects.equals(this.isInbox, folder.isInbox) && + Objects.equals(this.id, folder.id); + } + + @Override + public int hashCode() { + return Objects.hash(name, fileCount, email, isInbox, id); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Folder {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" fileCount: ").append(toIndentedString(fileCount)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" isInbox: ").append(toIndentedString(isInbox)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/files/Folders.java b/src/main/java/com/xero/models/files/Folders.java new file mode 100644 index 00000000..cee48445 --- /dev/null +++ b/src/main/java/com/xero/models/files/Folders.java @@ -0,0 +1,104 @@ +/* + * Xero Files API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.files; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.files.Folder; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Folders + */ + +public class Folders { + + @JsonProperty("Folders") + private List folders = new ArrayList(); + + public Folders folders(List folders) { + this.folders = folders; + return this; + } + + public Folders addFoldersItem(Folder foldersItem) { + if (this.folders == null) { + this.folders = new ArrayList(); + } + this.folders.add(foldersItem); + return this; + } + + /** + * Get folders + * @return folders + **/ + @ApiModelProperty(value = "") + public List getFolders() { + return folders; + } + + public void setFolders(List folders) { + this.folders = folders; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Folders folders = (Folders) o; + return Objects.equals(this.folders, folders.folders); + } + + @Override + public int hashCode() { + return Objects.hash(folders); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Folders {\n"); + sb.append(" folders: ").append(toIndentedString(folders)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/files/InlineObject.java b/src/main/java/com/xero/models/files/InlineObject.java new file mode 100644 index 00000000..ef83ee0d --- /dev/null +++ b/src/main/java/com/xero/models/files/InlineObject.java @@ -0,0 +1,165 @@ +/* + * Xero Files API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.files; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * InlineObject + */ + +public class InlineObject { + + @JsonProperty("body") + private byte[] body; + + + @JsonProperty("name") + private String name; + + + @JsonProperty("filename") + private String filename; + + + @JsonProperty("mimeType") + private String mimeType; + + public InlineObject body(byte[] body) { + this.body = body; + return this; + } + + /** + * Get body + * @return body + **/ + @ApiModelProperty(value = "") + public byte[] getBody() { + return body; + } + + public void setBody(byte[] body) { + this.body = body; + } + + public InlineObject name(String name) { + this.name = name; + return this; + } + + /** + * exact name of the file you are uploading + * @return name + **/ + @ApiModelProperty(value = "exact name of the file you are uploading") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public InlineObject filename(String filename) { + this.filename = filename; + return this; + } + + /** + * Get filename + * @return filename + **/ + @ApiModelProperty(value = "") + public String getFilename() { + return filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + public InlineObject mimeType(String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * @return mimeType + **/ + @ApiModelProperty(value = "") + public String getMimeType() { + return mimeType; + } + + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject inlineObject = (InlineObject) o; + return Arrays.equals(this.body, inlineObject.body) && + Objects.equals(this.name, inlineObject.name) && + Objects.equals(this.filename, inlineObject.filename) && + Objects.equals(this.mimeType, inlineObject.mimeType); + } + + @Override + public int hashCode() { + return Objects.hash(Arrays.hashCode(body), name, filename, mimeType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" filename: ").append(toIndentedString(filename)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/files/ObjectGroup.java b/src/main/java/com/xero/models/files/ObjectGroup.java new file mode 100644 index 00000000..dbb44635 --- /dev/null +++ b/src/main/java/com/xero/models/files/ObjectGroup.java @@ -0,0 +1,76 @@ +/* + * Xero Files API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.files; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * The Object Group that the object is in. These roughly correlate to the endpoints that can be used to retrieve the object via the core accounting API. + */ +public enum ObjectGroup { + + ACCOUNT("Account"), + + BANKTRANSACTION("BankTransaction"), + + CONTACT("Contact"), + + CREDITNOTE("CreditNote"), + + INVOICE("Invoice"), + + ITEM("Item"), + + MANUALJOURNAL("ManualJournal"), + + OVERPAYMENT("Overpayment"), + + PAYMENT("Payment"), + + PREPAYMENT("Prepayment"), + + RECEIPT("Receipt"); + + private String value; + + ObjectGroup(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ObjectGroup fromValue(String value) { + for (ObjectGroup b : ObjectGroup.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/files/ObjectType.java b/src/main/java/com/xero/models/files/ObjectType.java new file mode 100644 index 00000000..fbc655b0 --- /dev/null +++ b/src/main/java/com/xero/models/files/ObjectType.java @@ -0,0 +1,120 @@ +/* + * Xero Files API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.files; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * The Object Type + */ +public enum ObjectType { + + ACCOUNT("ACCOUNT"), + + ACCPAY("ACCPAY"), + + ACCPAYCREDIT("ACCPAYCREDIT"), + + ACCPAYPAYMENT("ACCPAYPAYMENT"), + + ACCREC("ACCREC"), + + ACCRECCREDIT("ACCRECCREDIT"), + + ACCRECPAYMENT("ACCRECPAYMENT"), + + ADJUSTMENT("ADJUSTMENT"), + + APCREDITPAYMENT("APCREDITPAYMENT"), + + APOVERPAYMENT("APOVERPAYMENT"), + + APOVERPAYMENTPAYMENT("APOVERPAYMENTPAYMENT"), + + APOVERPAYMENTSOURCEPAYMENT("APOVERPAYMENTSOURCEPAYMENT"), + + APPREPAYMENT("APPREPAYMENT"), + + APPREPAYMENTPAYMENT("APPREPAYMENTPAYMENT"), + + APPREPAYMENTSOURCEPAYMENT("APPREPAYMENTSOURCEPAYMENT"), + + ARCREDITPAYMENT("ARCREDITPAYMENT"), + + AROVERPAYMENT("AROVERPAYMENT"), + + AROVERPAYMENTPAYMENT("AROVERPAYMENTPAYMENT"), + + AROVERPAYMENTSOURCEPAYMENT("AROVERPAYMENTSOURCEPAYMENT"), + + ARPREPAYMENT("ARPREPAYMENT"), + + ARPREPAYMENTPAYMENT("ARPREPAYMENTPAYMENT"), + + ARPREPAYMENTSOURCEPAYMENT("ARPREPAYMENTSOURCEPAYMENT"), + + CASHPAID("CASHPAID"), + + CASHREC("CASHREC"), + + CONTACT("CONTACT"), + + EXPPAYMENT("EXPPAYMENT"), + + FIXEDASSET("FIXEDASSET"), + + MANUALJOURNAL("MANUALJOURNAL"), + + PAYRUN("PAYRUN"), + + PRICELISTITEM("PRICELISTITEM"), + + PURCHASEORDER("PURCHASEORDER"), + + RECEIPT("RECEIPT"), + + TRANSFER("TRANSFER"); + + private String value; + + ObjectType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ObjectType fromValue(String value) { + for (ObjectType b : ObjectType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/files/User.java b/src/main/java/com/xero/models/files/User.java new file mode 100644 index 00000000..79110dd3 --- /dev/null +++ b/src/main/java/com/xero/models/files/User.java @@ -0,0 +1,282 @@ +/* + * Xero Files API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.files; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * User + */ + +public class User { + + @JsonProperty("UserID") + private UUID userID; + + + @JsonProperty("EmailAddress") + private String emailAddress; + + + @JsonProperty("FirstName") + private String firstName; + + + @JsonProperty("LastName") + private String lastName; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + + @JsonProperty("IsSubscriber") + private Boolean isSubscriber; + + /** + * Boolean to indicate if user is the subscriber + */ + public enum OrganisationRoleEnum { + READONLY("READONLY"), + + INVOICEONLY("INVOICEONLY"), + + STANDARD("STANDARD"), + + FINANCIALADVISER("FINANCIALADVISER"), + + MANAGEDCLIENT("MANAGEDCLIENT"), + + CASHBOOKCLIENT("CASHBOOKCLIENT"); + + private String value; + + OrganisationRoleEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OrganisationRoleEnum fromValue(String value) { + for (OrganisationRoleEnum b : OrganisationRoleEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + + @JsonProperty("OrganisationRole") + private OrganisationRoleEnum organisationRole; + + public User userID(UUID userID) { + this.userID = userID; + return this; + } + + /** + * Xero identifier + * @return userID + **/ + @ApiModelProperty(example = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c", value = "Xero identifier") + public UUID getUserID() { + return userID; + } + + public void setUserID(UUID userID) { + this.userID = userID; + } + + public User emailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Email address of user + * @return emailAddress + **/ + @ApiModelProperty(example = "john.smith@mail.com", value = "Email address of user") + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * First name of user + * @return firstName + **/ + @ApiModelProperty(example = "John", required = true, value = "First name of user") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Last name of user + * @return lastName + **/ + @ApiModelProperty(example = "Smith", required = true, value = "Last name of user") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * Last name of user + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Last name of user") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + + public User isSubscriber(Boolean isSubscriber) { + this.isSubscriber = isSubscriber; + return this; + } + + /** + * Boolean to indicate if user is the subscriber + * @return isSubscriber + **/ + @ApiModelProperty(example = "true", value = "Boolean to indicate if user is the subscriber") + public Boolean getIsSubscriber() { + return isSubscriber; + } + + public void setIsSubscriber(Boolean isSubscriber) { + this.isSubscriber = isSubscriber; + } + + public User organisationRole(OrganisationRoleEnum organisationRole) { + this.organisationRole = organisationRole; + return this; + } + + /** + * Boolean to indicate if user is the subscriber + * @return organisationRole + **/ + @ApiModelProperty(example = "STANDARD", value = "Boolean to indicate if user is the subscriber") + public OrganisationRoleEnum getOrganisationRole() { + return organisationRole; + } + + public void setOrganisationRole(OrganisationRoleEnum organisationRole) { + this.organisationRole = organisationRole; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.userID, user.userID) && + Objects.equals(this.emailAddress, user.emailAddress) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.updatedDateUTC, user.updatedDateUTC) && + Objects.equals(this.isSubscriber, user.isSubscriber) && + Objects.equals(this.organisationRole, user.organisationRole); + } + + @Override + public int hashCode() { + return Objects.hash(userID, emailAddress, firstName, lastName, updatedDateUTC, isSubscriber, organisationRole); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + sb.append(" userID: ").append(toIndentedString(userID)).append("\n"); + sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append(" isSubscriber: ").append(toIndentedString(isSubscriber)).append("\n"); + sb.append(" organisationRole: ").append(toIndentedString(organisationRole)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + From f5dedfb4ba699462ba2c9d4c3090ace4aac56e37 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 30 Jul 2019 10:42:54 -0700 Subject: [PATCH 19/76] set the new credentials returned from a successful refresh --- src/main/java/com/xero/example/RefreshCredential.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/xero/example/RefreshCredential.java b/src/main/java/com/xero/example/RefreshCredential.java index bb68ffa4..311b9815 100644 --- a/src/main/java/com/xero/example/RefreshCredential.java +++ b/src/main/java/com/xero/example/RefreshCredential.java @@ -36,6 +36,8 @@ public static Builder createRefreshCredential(HttpServletResponse resp, String c @Override public void onTokenResponse(Credential credential, TokenResponse tokenResponse) throws IOException { System.out.println("Token Refresh success"); + credential.setFromTokenResponse(tokenResponse); + // implement your own storage of new tokens TokenStorage store = new TokenStorage(); store.saveItem(response, "access_token", tokenResponse.getAccessToken()); store.saveItem(response, "refresh_token", tokenResponse.getRefreshToken()); From 82999e5f49e6915db2be01b02d6bc512f84091d6 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 30 Jul 2019 12:41:57 -0700 Subject: [PATCH 20/76] Update version of jackson-databind --- pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 80868ab9..2a407ae5 100644 --- a/pom.xml +++ b/pom.xml @@ -294,10 +294,9 @@ 4.12 4.5.3 2.27 - 2.9.9 + 2.9.9.1 2.6.4 1.0.0 - 9.7.0 2.1.0 2.9.9 From e4955653b548a963b465d63a51a9eab58f5bd65b Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 30 Jul 2019 16:12:13 -0700 Subject: [PATCH 21/76] updating for 3.x --- README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a15d7b2b..de0c79c8 100644 --- a/README.md +++ b/README.md @@ -3,18 +3,21 @@ [![Maven Central](https://img.shields.io/maven-central/v/com.github.xeroapi/xero-java.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.xeroapi%22%20AND%20a:%22xero-java%22) +The release of version 3.x of Xero Java SDK only supports oAuth2 authentication and the following API sets. +* accounting +* fixed asset +* bank feeds -This is the official Java SDK for Xero's API. It supports accounting, fixed asset and bank feed API endpoints. All third party libraries dependencies managed with Maven. +Coming soon +* files +* payroll +* projects +* xero hq +All third party libraries dependencies managed with Maven. -## Migrating from version 1.0 to 2.0 of SDK -We've made some big changes to our Java SDK with version 2.0. All code examples in this README are for version 2.0. We've archived [code samples for version 1.0 here](https://github.com/XeroAPI/Xero-Java/tree/master/example). - -2.0 implements requests and responses for accounting API endpoints using JSON only. Don't worry we won't be removing any of the existing methods for XML, but will mark them as deprecated in favor of JSON. - -Our XSD schema files will also be deprecated in favor of [OpenAPI spec 3.0 files now available on Github](https://github.com/XeroAPI/Xero-OpenAPI). - -Lastly, our trusty XeroClient class that holds methods for interacting with each endpoint will be deprecated in favor of clients for each major API group at Xero. See below. +## Looking for version 2.x of the SDK with oAuth 1.0a support? +Codebase, samples and setup instructions located in [oauth1 branch](https://github.com/XeroAPI/Xero-Java/tree/master/example). ### Initializing Client From 52c5ae8638ea820c5525db70eeaecd8a44e1ce47 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 30 Jul 2019 16:22:56 -0700 Subject: [PATCH 22/76] new setup instructions --- README.md | 69 +++++++++++-------------------------------------------- 1 file changed, 13 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index de0c79c8..43d46eb8 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![Maven Central](https://img.shields.io/maven-central/v/com.github.xeroapi/xero-java.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.xeroapi%22%20AND%20a:%22xero-java%22) +## Current release of SDK with oAuth 2 support The release of version 3.x of Xero Java SDK only supports oAuth2 authentication and the following API sets. * accounting * fixed asset @@ -17,69 +18,25 @@ Coming soon All third party libraries dependencies managed with Maven. ## Looking for version 2.x of the SDK with oAuth 1.0a support? -Codebase, samples and setup instructions located in [oauth1 branch](https://github.com/XeroAPI/Xero-Java/tree/master/example). +Codebase, samples and setup instructions located in [oauth1 branch](https://github.com/XeroAPI/Xero-Java/tree/oauth1). -### Initializing Client - -1.0 Client (deprecated) -```java -XeroClient client = new XeroClient(); -client.setOAuthToken(accessToken.getToken(), accessToken.getTokenSecret()); -``` - -2.0 Client -```java -// Accounting API endpoints -ApiClient apiClientForAccounting = new ApiClient(config.getApiUrl(),null,null,null); -AccountingApi accountingApi = new AccountingApi(apiClientForAccounting); -accountingApi.setOAuthToken(token, tokenSecret); - -// BankFeeds API endpoints (for approved Partners) -ApiClient apiClientForBankFeeds = new ApiClient(config.getBankFeedsUrl(),null,null,null); -BankFeedsApi bankFeedsApi = new BankFeedsApi(apiClientForBankFeeds); -bankFeedsApi.setOAuthToken(token, tokenSecret); - -// Files API endpoints -ApiClient apiClientForFiles = new ApiClient(config.getFilesUrl(),null,null,null); -FilesApi filesApi = new FilesApi(apiClientForFiles); -filesApi.setOAuthToken(token, tokenSecret); - -// Fixed Assets API endpoints -ApiClient apiClientForAssets = new ApiClient(config.getAssetsUrl(),null,null,null); -AssetApi assetApi = new AssetApi(apiClientForAssets); -assetApi.setOAuthToken(token, tokenSecret); -``` - -### Making API calls will change as well. - -1.0 Example GET -```java -List organisations = client.getOrganisations(); -System.out.println("Org Name : " + organisations.get(0).getName()); -``` - -2.0 Example GET -```java -Organisations organisations = accountingApi.getOrganisations(); -System.out.println("Org Name : " + organisations.getOrganisations().get(0).getName()); -``` - -### Models are moving - -1.0 models where imported from com.xero.model.* - -2.0 models are separated into major API groups under *com.xero.models* -i.e. com.xero.models.accounting.* +## Getting Started +### Create a Xero App +Follow these steps to create your Xero app -## Getting Started +* Create a free Xero user account (if you don't have one) +* Login to [developer.xero.com/myapps](https://developer.xero.com/myapps) +* Click "New App" button +* Foo +* Bar +* Copy your client id and secret for use later +* Set your callback uri (i.e. http://localhost:3000/callback) -### Xero App Type -Start by deciding which type of Xero app you'll be building [Private](http://developer.xero.com/documentation/auth-and-limits/private-applications/), [Public](http://developer.xero.com/documentation/auth-and-limits/public-applications/), or [Partner](http://developer.xero.com/documentation/auth-and-limits/partner-applications/). Go to [http://app.xero.com](http://app.xero.com) and login with your Xero user account to create a Private or Public app (Public apps can be upgraded to Partner). ### Add Xero-Java Dependency -Add the dependency to your pom.xml. Gradle, sbt and other build tools can be found on [maven central](https://search.maven.org/search?q=g:com.github.xeroapi). +Add the Xero Java SDK dependency to project via maven, gradle, sbt or other build tools can be found on [maven central](https://search.maven.org/search?q=g:com.github.xeroapi). ### Default Configuration The SDK uses a config.json file to manage API keys along with other configuration values. The SDK will look for a file *config.json* in a source folder called *resources*. From e641012fcb09a2be81e9409e2e38ca3087e62b7c Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Wed, 31 Jul 2019 13:15:14 -0700 Subject: [PATCH 23/76] Update example to accept xero-tenant-id param --- README.md | 16 +- .../com/xero/api/client/AccountingApi.java | 2700 +++++++++++------ .../xero/example/AuthenticatedResource.java | 488 ++- .../java/com/xero/example/Authorization.java | 1 + src/main/java/com/xero/example/Callback.java | 4 +- .../com/xero/models/accounting/Account.java | 2 + 6 files changed, 1987 insertions(+), 1224 deletions(-) diff --git a/README.md b/README.md index 43d46eb8..bc56a486 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Maven Central](https://img.shields.io/maven-central/v/com.github.xeroapi/xero-java.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.xeroapi%22%20AND%20a:%22xero-java%22) ## Current release of SDK with oAuth 2 support -The release of version 3.x of Xero Java SDK only supports oAuth2 authentication and the following API sets. +Version 3.x of Xero Java SDK only supports oAuth2 authentication and the following API sets. * accounting * fixed asset * bank feeds @@ -28,16 +28,24 @@ Follow these steps to create your Xero app * Create a free Xero user account (if you don't have one) * Login to [developer.xero.com/myapps](https://developer.xero.com/myapps) * Click "New App" button -* Foo -* Bar +* additional steps ... todo * Copy your client id and secret for use later * Set your callback uri (i.e. http://localhost:3000/callback) - ### Add Xero-Java Dependency Add the Xero Java SDK dependency to project via maven, gradle, sbt or other build tools can be found on [maven central](https://search.maven.org/search?q=g:com.github.xeroapi). +```xml + + com.github.xeroapi + xero-java + 3.X.X + +``` + + + ### Default Configuration The SDK uses a config.json file to manage API keys along with other configuration values. The SDK will look for a file *config.json* in a source folder called *resources*. diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index da064f6d..f5c420ff 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -117,23 +117,27 @@ public String getUserAgent() { * Allows you to create a new chart of accounts *

200 - Success - created new Account and return response of type Accounts array with new Account *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant * @param account Request of type Account * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts createAccount(Account account) throws IOException { - HttpResponse response = createAccountForHttpResponse(account); + public Accounts createAccount(String xeroTenantId, Account account) throws IOException { + HttpResponse response = createAccountForHttpResponse(xeroTenantId, account); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createAccountForHttpResponse( Account account) throws IOException { - // verify the required parameter 'account' is set + public HttpResponse createAccountForHttpResponse( String xeroTenantId, Account account) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccount"); + }// verify the required parameter 'account' is set if (account == null) { throw new IllegalArgumentException("Missing the required parameter 'account' when calling createAccount"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -160,20 +164,24 @@ public HttpResponse createAccountForHttpResponse( Account account) throws IOExce * Allows you to create Attachment on Account *

200 - Success - return response of type Attachments array of Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param fileName Name of the attachment * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createAccountAttachmentByFileName(UUID accountID, String fileName, File body) throws IOException { - HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(accountID, fileName, body); + public Attachments createAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { + HttpResponse response = createAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createAccountAttachmentByFileNameForHttpResponse( UUID accountID, String fileName, File body) throws IOException { - // verify the required parameter 'accountID' is set + public HttpResponse createAccountAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling createAccountAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -184,7 +192,7 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( UUID accou throw new IllegalArgumentException("Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -219,24 +227,28 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( UUID accou * Allows you to create a spend or receive money transaction *

200 - Success - return response of type BankTransactions array with new BankTransaction *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactions The bankTransactions parameter * @param summarizeErrors response format that shows validation errors for each bank transaction * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions createBankTransaction(BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { - HttpResponse response = createBankTransactionForHttpResponse(bankTransactions, summarizeErrors); + public BankTransactions createBankTransaction(String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + HttpResponse response = createBankTransactionForHttpResponse(xeroTenantId, bankTransactions, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransactionForHttpResponse( BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'bankTransactions' is set + public HttpResponse createBankTransactionForHttpResponse( String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); + }// verify the required parameter 'bankTransactions' is set if (bankTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -274,20 +286,24 @@ public HttpResponse createBankTransactionForHttpResponse( BankTransactions bankT * Allows you to createa an Attachment on BankTransaction by Filename *

200 - Success - return response of Attachments array of Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param fileName The name of the file being attached * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransactionAttachmentByFileName(UUID bankTransactionID, String fileName, File body) throws IOException { - HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(bankTransactionID, fileName, body); + public Attachments createBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { + HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( UUID bankTransactionID, String fileName, File body) throws IOException { - // verify the required parameter 'bankTransactionID' is set + public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -298,7 +314,7 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( UU throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransactionAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -333,19 +349,23 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( UU * Allows you to create history record for a bank transactions *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBankTransactionHistoryRecord(UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(bankTransactionID, historyRecords); + public HistoryRecords createBankTransactionHistoryRecord(String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBankTransactionHistoryRecordForHttpResponse(xeroTenantId, bankTransactionID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransactionHistoryRecordForHttpResponse( UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'bankTransactionID' is set + public HttpResponse createBankTransactionHistoryRecordForHttpResponse( String xeroTenantId, UUID bankTransactionID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactionHistoryRecord"); + }// verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling createBankTransactionHistoryRecord"); }// verify the required parameter 'historyRecords' is set @@ -353,7 +373,7 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse( UUID bank throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransactionHistoryRecord"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -385,23 +405,27 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse( UUID bank * Allows you to create a bank transfers *

200 - Success - return response of BankTransfers array of one BankTransfer *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransfers The bankTransfers parameter * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers createBankTransfer(BankTransfers bankTransfers) throws IOException { - HttpResponse response = createBankTransferForHttpResponse(bankTransfers); + public BankTransfers createBankTransfer(String xeroTenantId, BankTransfers bankTransfers) throws IOException { + HttpResponse response = createBankTransferForHttpResponse(xeroTenantId, bankTransfers); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransferForHttpResponse( BankTransfers bankTransfers) throws IOException { - // verify the required parameter 'bankTransfers' is set + public HttpResponse createBankTransferForHttpResponse( String xeroTenantId, BankTransfers bankTransfers) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransfer"); + }// verify the required parameter 'bankTransfers' is set if (bankTransfers == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransfers' when calling createBankTransfer"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -427,20 +451,24 @@ public HttpResponse createBankTransferForHttpResponse( BankTransfers bankTransfe /** *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param fileName The name of the file being attached to a Bank Transfer * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createBankTransferAttachmentByFileName(UUID bankTransferID, String fileName, File body) throws IOException { - HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(bankTransferID, fileName, body); + public Attachments createBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { + HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( UUID bankTransferID, String fileName, File body) throws IOException { - // verify the required parameter 'bankTransferID' is set + public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -451,7 +479,7 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( UUID throw new IllegalArgumentException("Missing the required parameter 'body' when calling createBankTransferAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -485,19 +513,23 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( UUID /** *

200 - Success - return response HistoryRecords array with the newly created HistoryRecord for a Bank Transfer *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBankTransferHistoryRecord(UUID bankTransferID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createBankTransferHistoryRecordForHttpResponse(bankTransferID, historyRecords); + public HistoryRecords createBankTransferHistoryRecord(String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBankTransferHistoryRecordForHttpResponse(xeroTenantId, bankTransferID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBankTransferHistoryRecordForHttpResponse( UUID bankTransferID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'bankTransferID' is set + public HttpResponse createBankTransferHistoryRecordForHttpResponse( String xeroTenantId, UUID bankTransferID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransferHistoryRecord"); + }// verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling createBankTransferHistoryRecord"); }// verify the required parameter 'historyRecords' is set @@ -505,7 +537,7 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse( UUID bankTra throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBankTransferHistoryRecord"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -537,23 +569,27 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse( UUID bankTra * Create one or many BatchPayments for invoices *

200 - Success - return response of type BatchPayments array of BatchPayment objects *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param batchPayments Request of type BatchPayments containing a Payments array with one or more Payment objects * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public BatchPayments createBatchPayment(BatchPayments batchPayments) throws IOException { - HttpResponse response = createBatchPaymentForHttpResponse(batchPayments); + public BatchPayments createBatchPayment(String xeroTenantId, BatchPayments batchPayments) throws IOException { + HttpResponse response = createBatchPaymentForHttpResponse(xeroTenantId, batchPayments); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBatchPaymentForHttpResponse( BatchPayments batchPayments) throws IOException { - // verify the required parameter 'batchPayments' is set + public HttpResponse createBatchPaymentForHttpResponse( String xeroTenantId, BatchPayments batchPayments) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPayment"); + }// verify the required parameter 'batchPayments' is set if (batchPayments == null) { throw new IllegalArgumentException("Missing the required parameter 'batchPayments' when calling createBatchPayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -580,19 +616,23 @@ public HttpResponse createBatchPaymentForHttpResponse( BatchPayments batchPaymen * Allows you to create a history record for a Batch Payment *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param batchPaymentID Unique identifier for BatchPayment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createBatchPaymentHistoryRecord(UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(batchPaymentID, historyRecords); + public HistoryRecords createBatchPaymentHistoryRecord(String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createBatchPaymentHistoryRecordForHttpResponse(xeroTenantId, batchPaymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'batchPaymentID' is set + public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( String xeroTenantId, UUID batchPaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBatchPaymentHistoryRecord"); + }// verify the required parameter 'batchPaymentID' is set if (batchPaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling createBatchPaymentHistoryRecord"); }// verify the required parameter 'historyRecords' is set @@ -600,7 +640,7 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( UUID batchPa throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createBatchPaymentHistoryRecord"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -632,19 +672,23 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( UUID batchPa * Allow for the creation of new custom payment service for specified Branding Theme *

200 - Success - return response of type PaymentServices array with newly created PaymentService *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param brandingThemeID Unique identifier for a Branding Theme * @param paymentService The paymentService parameter * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices createBrandingThemePaymentServices(UUID brandingThemeID, PaymentService paymentService) throws IOException { - HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(brandingThemeID, paymentService); + public PaymentServices createBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { + HttpResponse response = createBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID, paymentService); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createBrandingThemePaymentServicesForHttpResponse( UUID brandingThemeID, PaymentService paymentService) throws IOException { - // verify the required parameter 'brandingThemeID' is set + public HttpResponse createBrandingThemePaymentServicesForHttpResponse( String xeroTenantId, UUID brandingThemeID, PaymentService paymentService) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set if (brandingThemeID == null) { throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling createBrandingThemePaymentServices"); }// verify the required parameter 'paymentService' is set @@ -652,7 +696,7 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse( UUID bran throw new IllegalArgumentException("Missing the required parameter 'paymentService' when calling createBrandingThemePaymentServices"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -683,23 +727,27 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse( UUID bran /** *

200 - Success - return response of type Contacts array with newly created Contact *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant * @param contact The contact parameter * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts createContact(Contact contact) throws IOException { - HttpResponse response = createContactForHttpResponse(contact); + public Contacts createContact(String xeroTenantId, Contact contact) throws IOException { + HttpResponse response = createContactForHttpResponse(xeroTenantId, contact); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createContactForHttpResponse( Contact contact) throws IOException { - // verify the required parameter 'contact' is set + public HttpResponse createContactForHttpResponse( String xeroTenantId, Contact contact) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContact"); + }// verify the required parameter 'contact' is set if (contact == null) { throw new IllegalArgumentException("Missing the required parameter 'contact' when calling createContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -725,20 +773,24 @@ public HttpResponse createContactForHttpResponse( Contact contact) throws IOExce /** *

200 - Success - return response of type Attachments array with an newly created Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param fileName Name for the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createContactAttachmentByFileName(UUID contactID, String fileName, File body) throws IOException { - HttpResponse response = createContactAttachmentByFileNameForHttpResponse(contactID, fileName, body); + public Attachments createContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { + HttpResponse response = createContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createContactAttachmentByFileNameForHttpResponse( UUID contactID, String fileName, File body) throws IOException { - // verify the required parameter 'contactID' is set + public HttpResponse createContactAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -749,7 +801,7 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( UUID conta throw new IllegalArgumentException("Missing the required parameter 'body' when calling createContactAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -784,23 +836,27 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( UUID conta * Allows you to create a contact group *

200 - Success - return response of type Contact Groups array of newly created Contact Group *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant * @param contactGroups an array of contact groups with names specified * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups createContactGroup(ContactGroups contactGroups) throws IOException { - HttpResponse response = createContactGroupForHttpResponse(contactGroups); + public ContactGroups createContactGroup(String xeroTenantId, ContactGroups contactGroups) throws IOException { + HttpResponse response = createContactGroupForHttpResponse(xeroTenantId, contactGroups); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createContactGroupForHttpResponse( ContactGroups contactGroups) throws IOException { - // verify the required parameter 'contactGroups' is set + public HttpResponse createContactGroupForHttpResponse( String xeroTenantId, ContactGroups contactGroups) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroup"); + }// verify the required parameter 'contactGroups' is set if (contactGroups == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling createContactGroup"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -827,19 +883,23 @@ public HttpResponse createContactGroupForHttpResponse( ContactGroups contactGrou * Allows you to add Contacts to a Contract Group *

200 - Success - return response of type Contacts array of added Contacts *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group * @param contacts an array of contacts with ContactID to be added to ContactGroup * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts createContactGroupContacts(UUID contactGroupID, Contacts contacts) throws IOException { - HttpResponse response = createContactGroupContactsForHttpResponse(contactGroupID, contacts); + public Contacts createContactGroupContacts(String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { + HttpResponse response = createContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID, contacts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createContactGroupContactsForHttpResponse( UUID contactGroupID, Contacts contacts) throws IOException { - // verify the required parameter 'contactGroupID' is set + public HttpResponse createContactGroupContactsForHttpResponse( String xeroTenantId, UUID contactGroupID, Contacts contacts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling createContactGroupContacts"); }// verify the required parameter 'contacts' is set @@ -847,7 +907,7 @@ public HttpResponse createContactGroupContactsForHttpResponse( UUID contactGroup throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContactGroupContacts"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -879,19 +939,23 @@ public HttpResponse createContactGroupContactsForHttpResponse( UUID contactGroup * Allows you to retrieve a history records of an Contact *

200 - Success - return response of type History Records array of newly created History Record for a specific Contact *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createContactHistory(UUID contactID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createContactHistoryForHttpResponse(contactID, historyRecords); + public HistoryRecords createContactHistory(String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createContactHistoryForHttpResponse(xeroTenantId, contactID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createContactHistoryForHttpResponse( UUID contactID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'contactID' is set + public HttpResponse createContactHistoryForHttpResponse( String xeroTenantId, UUID contactID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContactHistory"); + }// verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling createContactHistory"); }// verify the required parameter 'historyRecords' is set @@ -899,7 +963,7 @@ public HttpResponse createContactHistoryForHttpResponse( UUID contactID, Histor throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createContactHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -931,24 +995,28 @@ public HttpResponse createContactHistoryForHttpResponse( UUID contactID, Histor * Allows you to create a credit note *

200 - Success - return response of type Credit Notes array of newly created CreditNote *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param creditNotes an array of Credit Notes with a single CreditNote object. * @param summarizeErrors shows validation errors for each credit note * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes createCreditNote(CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { - HttpResponse response = createCreditNoteForHttpResponse(creditNotes, summarizeErrors); + public CreditNotes createCreditNote(String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + HttpResponse response = createCreditNoteForHttpResponse(xeroTenantId, creditNotes, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createCreditNoteForHttpResponse( CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'creditNotes' is set + public HttpResponse createCreditNoteForHttpResponse( String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); + }// verify the required parameter 'creditNotes' is set if (creditNotes == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -986,19 +1054,23 @@ public HttpResponse createCreditNoteForHttpResponse( CreditNotes creditNotes, B * Allows you to create Allocation on CreditNote *

200 - Success - return response of type Allocations array with newly created Allocation for specific Credit Note *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param allocations an array of Allocations with single Allocation object defined. * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createCreditNoteAllocation(UUID creditNoteID, Allocations allocations) throws IOException { - HttpResponse response = createCreditNoteAllocationForHttpResponse(creditNoteID, allocations); + public Allocations createCreditNoteAllocation(String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { + HttpResponse response = createCreditNoteAllocationForHttpResponse(xeroTenantId, creditNoteID, allocations); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createCreditNoteAllocationForHttpResponse( UUID creditNoteID, Allocations allocations) throws IOException { - // verify the required parameter 'creditNoteID' is set + public HttpResponse createCreditNoteAllocationForHttpResponse( String xeroTenantId, UUID creditNoteID, Allocations allocations) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAllocation"); + }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAllocation"); }// verify the required parameter 'allocations' is set @@ -1006,7 +1078,7 @@ public HttpResponse createCreditNoteAllocationForHttpResponse( UUID creditNoteID throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createCreditNoteAllocation"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1038,20 +1110,24 @@ public HttpResponse createCreditNoteAllocationForHttpResponse( UUID creditNoteID * Allows you to create Attachments on CreditNote by file name *

200 - Success - return response of type Attachments array with newly created Attachment for specific Credit Note *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param fileName Name of the file you are attaching to Credit Note * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createCreditNoteAttachmentByFileName(UUID creditNoteID, String fileName, File body) throws IOException { - HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(creditNoteID, fileName, body); + public Attachments createCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { + HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( UUID creditNoteID, String fileName, File body) throws IOException { - // verify the required parameter 'creditNoteID' is set + public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -1062,7 +1138,7 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( UUID cr throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1097,19 +1173,23 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( UUID cr * Allows you to retrieve a history records of an CreditNote *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Credit Note *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createCreditNoteHistory(UUID creditNoteID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createCreditNoteHistoryForHttpResponse(creditNoteID, historyRecords); + public HistoryRecords createCreditNoteHistory(String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createCreditNoteHistoryForHttpResponse( UUID creditNoteID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'creditNoteID' is set + public HttpResponse createCreditNoteHistoryForHttpResponse( String xeroTenantId, UUID creditNoteID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); }// verify the required parameter 'historyRecords' is set @@ -1117,7 +1197,7 @@ public HttpResponse createCreditNoteHistoryForHttpResponse( UUID creditNoteID, throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1147,23 +1227,27 @@ public HttpResponse createCreditNoteHistoryForHttpResponse( UUID creditNoteID, /** *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency + * @param xeroTenantId Xero identifier for Tenant * @param currencies The currencies parameter * @return Currencies * @throws IOException if an error occurs while attempting to invoke the API **/ - public Currencies createCurrency(Currencies currencies) throws IOException { - HttpResponse response = createCurrencyForHttpResponse(currencies); + public Currencies createCurrency(String xeroTenantId, Currencies currencies) throws IOException { + HttpResponse response = createCurrencyForHttpResponse(xeroTenantId, currencies); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createCurrencyForHttpResponse( Currencies currencies) throws IOException { - // verify the required parameter 'currencies' is set + public HttpResponse createCurrencyForHttpResponse( String xeroTenantId, Currencies currencies) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); + }// verify the required parameter 'currencies' is set if (currencies == null) { throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1190,23 +1274,27 @@ public HttpResponse createCurrencyForHttpResponse( Currencies currencies) throws * Allows you to create new employees used in Xero payrun *

200 - Success - return response of type Employees array with new Employee *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param employees The employees parameter * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees createEmployee(Employees employees) throws IOException { - HttpResponse response = createEmployeeForHttpResponse(employees); + public Employees createEmployee(String xeroTenantId, Employees employees) throws IOException { + HttpResponse response = createEmployeeForHttpResponse(xeroTenantId, employees); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createEmployeeForHttpResponse( Employees employees) throws IOException { - // verify the required parameter 'employees' is set + public HttpResponse createEmployeeForHttpResponse( String xeroTenantId, Employees employees) 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 'employees' is set if (employees == null) { throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployee"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1233,24 +1321,28 @@ public HttpResponse createEmployeeForHttpResponse( Employees employees) throws I * Allows you to retrieve expense claims *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param expenseClaims The expenseClaims parameter * @param summarizeErrors shows validation errors for each expense claim * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims createExpenseClaim(ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { - HttpResponse response = createExpenseClaimForHttpResponse(expenseClaims, summarizeErrors); + public ExpenseClaims createExpenseClaim(String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + HttpResponse response = createExpenseClaimForHttpResponse(xeroTenantId, expenseClaims, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createExpenseClaimForHttpResponse( ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'expenseClaims' is set + public HttpResponse createExpenseClaimForHttpResponse( String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); + }// verify the required parameter 'expenseClaims' is set if (expenseClaims == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1287,19 +1379,23 @@ public HttpResponse createExpenseClaimForHttpResponse( ExpenseClaims expenseClai /** * Allows you to create a history records of an ExpenseClaim *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims + * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createExpenseClaimHistory(UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createExpenseClaimHistoryForHttpResponse(expenseClaimID, historyRecords); + public HistoryRecords createExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createExpenseClaimHistoryForHttpResponse( UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'expenseClaimID' is set + public HttpResponse createExpenseClaimHistoryForHttpResponse( String xeroTenantId, UUID expenseClaimID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling createExpenseClaimHistory"); }// verify the required parameter 'historyRecords' is set @@ -1307,7 +1403,7 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse( UUID expenseClaimI throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createExpenseClaimHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1339,24 +1435,28 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse( UUID expenseClaimI * Allows you to create any sales invoices or purchase bills *

200 - Success - return response of type Invoices array with newly created Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoices The invoices parameter * @param summarizeErrors shows validation errors for each invoice * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices createInvoice(Invoices invoices, Boolean summarizeErrors) throws IOException { - HttpResponse response = createInvoiceForHttpResponse(invoices, summarizeErrors); + public Invoices createInvoice(String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + HttpResponse response = createInvoiceForHttpResponse(xeroTenantId, invoices, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createInvoiceForHttpResponse( Invoices invoices, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'invoices' is set + public HttpResponse createInvoiceForHttpResponse( String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); + }// verify the required parameter 'invoices' is set if (invoices == null) { throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1394,20 +1494,24 @@ public HttpResponse createInvoiceForHttpResponse( Invoices invoices, Boolean su * Allows you to create an Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of type Attachments array with newly created Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param fileName Name of the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createInvoiceAttachmentByFileName(UUID invoiceID, String fileName, File body) throws IOException { - HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(invoiceID, fileName, body); + public Attachments createInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { + HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( UUID invoiceID, String fileName, File body) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -1418,7 +1522,7 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( UUID invoi throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1453,19 +1557,23 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( UUID invoi * Allows you to retrieve a history records of an invoice *

200 - Success - return response of type HistoryRecords array with newly created HistoryRecord for specific Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createInvoiceHistory(UUID invoiceID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createInvoiceHistoryForHttpResponse(invoiceID, historyRecords); + public HistoryRecords createInvoiceHistory(String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createInvoiceHistoryForHttpResponse( UUID invoiceID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse createInvoiceHistoryForHttpResponse( String xeroTenantId, UUID invoiceID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); }// verify the required parameter 'historyRecords' is set @@ -1473,7 +1581,7 @@ public HttpResponse createInvoiceHistoryForHttpResponse( UUID invoiceID, Histor throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1505,23 +1613,27 @@ public HttpResponse createInvoiceHistoryForHttpResponse( UUID invoiceID, Histor * Allows you to create an item *

200 - Success - return response of type Items array with newly created Item *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param items The items parameter * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items createItem(Items items) throws IOException { - HttpResponse response = createItemForHttpResponse(items); + public Items createItem(String xeroTenantId, Items items) throws IOException { + HttpResponse response = createItemForHttpResponse(xeroTenantId, items); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createItemForHttpResponse( Items items) throws IOException { - // verify the required parameter 'items' is set + public HttpResponse createItemForHttpResponse( String xeroTenantId, Items items) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); + }// verify the required parameter 'items' is set if (items == null) { throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1547,19 +1659,23 @@ public HttpResponse createItemForHttpResponse( Items items) throws IOException { /** * Allows you to create a history record for items *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items + * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createItemHistory(UUID itemID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createItemHistoryForHttpResponse(itemID, historyRecords); + public HistoryRecords createItemHistory(String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createItemHistoryForHttpResponse(xeroTenantId, itemID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createItemHistoryForHttpResponse( UUID itemID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'itemID' is set + public HttpResponse createItemHistoryForHttpResponse( String xeroTenantId, UUID itemID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItemHistory"); + }// verify the required parameter 'itemID' is set if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling createItemHistory"); }// verify the required parameter 'historyRecords' is set @@ -1567,7 +1683,7 @@ public HttpResponse createItemHistoryForHttpResponse( UUID itemID, HistoryRecor throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createItemHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1599,23 +1715,27 @@ public HttpResponse createItemHistoryForHttpResponse( UUID itemID, HistoryRecor * Allows you to create linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactions The linkedTransactions parameter * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions createLinkedTransaction(LinkedTransactions linkedTransactions) throws IOException { - HttpResponse response = createLinkedTransactionForHttpResponse(linkedTransactions); + public LinkedTransactions createLinkedTransaction(String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { + HttpResponse response = createLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactions); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createLinkedTransactionForHttpResponse( LinkedTransactions linkedTransactions) throws IOException { - // verify the required parameter 'linkedTransactions' is set + public HttpResponse createLinkedTransactionForHttpResponse( String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); + }// verify the required parameter 'linkedTransactions' is set if (linkedTransactions == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1642,23 +1762,27 @@ public HttpResponse createLinkedTransactionForHttpResponse( LinkedTransactions l * Allows you to create a manual journal *

200 - Success - return response of type ManualJournals array with newly created ManualJournal *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param manualJournals The manualJournals parameter * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals createManualJournal(ManualJournals manualJournals) throws IOException { - HttpResponse response = createManualJournalForHttpResponse(manualJournals); + public ManualJournals createManualJournal(String xeroTenantId, ManualJournals manualJournals) throws IOException { + HttpResponse response = createManualJournalForHttpResponse(xeroTenantId, manualJournals); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createManualJournalForHttpResponse( ManualJournals manualJournals) throws IOException { - // verify the required parameter 'manualJournals' is set + public HttpResponse createManualJournalForHttpResponse( String xeroTenantId, ManualJournals manualJournals) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); + }// verify the required parameter 'manualJournals' is set if (manualJournals == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1685,20 +1809,24 @@ public HttpResponse createManualJournalForHttpResponse( ManualJournals manualJou * Allows you to create a specified Attachment on ManualJournal by file name *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param fileName The name of the file being attached to a ManualJournal * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createManualJournalAttachmentByFileName(UUID manualJournalID, String fileName, File body) throws IOException { - HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(manualJournalID, fileName, body); + public Attachments createManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { + HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( UUID manualJournalID, String fileName, File body) throws IOException { - // verify the required parameter 'manualJournalID' is set + public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -1709,7 +1837,7 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( UUID throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1744,19 +1872,23 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( UUID * Allows you to retrieve Allocations for overpayments *

200 - Success - return response of type Allocations array with all Allocation for Overpayments *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment * @param allocations The allocations parameter * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createOverpaymentAllocation(UUID overpaymentID, Allocations allocations) throws IOException { - HttpResponse response = createOverpaymentAllocationForHttpResponse(overpaymentID, allocations); + public Allocations createOverpaymentAllocation(String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { + HttpResponse response = createOverpaymentAllocationForHttpResponse(xeroTenantId, overpaymentID, allocations); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createOverpaymentAllocationForHttpResponse( UUID overpaymentID, Allocations allocations) throws IOException { - // verify the required parameter 'overpaymentID' is set + public HttpResponse createOverpaymentAllocationForHttpResponse( String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); + }// verify the required parameter 'overpaymentID' is set if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); }// verify the required parameter 'allocations' is set @@ -1764,7 +1896,7 @@ public HttpResponse createOverpaymentAllocationForHttpResponse( UUID overpayment throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1796,19 +1928,23 @@ public HttpResponse createOverpaymentAllocationForHttpResponse( UUID overpayment * Allows you to create history records of an Overpayment *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Overpayments *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Overpayments + * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createOverpaymentHistory(UUID overpaymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createOverpaymentHistoryForHttpResponse(overpaymentID, historyRecords); + public HistoryRecords createOverpaymentHistory(String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createOverpaymentHistoryForHttpResponse( UUID overpaymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'overpaymentID' is set + public HttpResponse createOverpaymentHistoryForHttpResponse( String xeroTenantId, UUID overpaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentHistory"); }// verify the required parameter 'historyRecords' is set @@ -1816,7 +1952,7 @@ public HttpResponse createOverpaymentHistoryForHttpResponse( UUID overpaymentID, throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createOverpaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1848,23 +1984,27 @@ public HttpResponse createOverpaymentHistoryForHttpResponse( UUID overpaymentID, * Allows you to create payments for invoices and credit notes *

200 - Success - return response of type Payments array for newly created Payment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param payments The payments parameter * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments createPayment(Payments payments) throws IOException { - HttpResponse response = createPaymentForHttpResponse(payments); + public Payments createPayment(String xeroTenantId, Payments payments) throws IOException { + HttpResponse response = createPaymentForHttpResponse(xeroTenantId, payments); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPaymentForHttpResponse( Payments payments) throws IOException { - // verify the required parameter 'payments' is set + public HttpResponse createPaymentForHttpResponse( String xeroTenantId, Payments payments) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); + }// verify the required parameter 'payments' is set if (payments == null) { throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1891,19 +2031,23 @@ public HttpResponse createPaymentForHttpResponse( Payments payments) throws IOEx * Allows you to create a history record for a payment *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Payments + * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPaymentHistory(UUID paymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createPaymentHistoryForHttpResponse(paymentID, historyRecords); + public HistoryRecords createPaymentHistory(String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPaymentHistoryForHttpResponse(xeroTenantId, paymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPaymentHistoryForHttpResponse( UUID paymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'paymentID' is set + public HttpResponse createPaymentHistoryForHttpResponse( String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); + }// verify the required parameter 'paymentID' is set if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); }// verify the required parameter 'historyRecords' is set @@ -1911,7 +2055,7 @@ public HttpResponse createPaymentHistoryForHttpResponse( UUID paymentID, Histor throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1943,23 +2087,27 @@ public HttpResponse createPaymentHistoryForHttpResponse( UUID paymentID, Histor * Allows you to create payment services *

200 - Success - return response of type PaymentServices array for newly created PaymentService *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param paymentServices The paymentServices parameter * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices createPaymentService(PaymentServices paymentServices) throws IOException { - HttpResponse response = createPaymentServiceForHttpResponse(paymentServices); + public PaymentServices createPaymentService(String xeroTenantId, PaymentServices paymentServices) throws IOException { + HttpResponse response = createPaymentServiceForHttpResponse(xeroTenantId, paymentServices); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPaymentServiceForHttpResponse( PaymentServices paymentServices) throws IOException { - // verify the required parameter 'paymentServices' is set + public HttpResponse createPaymentServiceForHttpResponse( String xeroTenantId, PaymentServices paymentServices) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); + }// verify the required parameter 'paymentServices' is set if (paymentServices == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -1986,19 +2134,23 @@ public HttpResponse createPaymentServiceForHttpResponse( PaymentServices payment * Allows you to create an Allocation for prepayments *

200 - Success - return response of type Allocations array of Allocation for all Prepayment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID The prepaymentID parameter * @param allocations The allocations parameter * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createPrepaymentAllocation(UUID prepaymentID, Allocations allocations) throws IOException { - HttpResponse response = createPrepaymentAllocationForHttpResponse(prepaymentID, allocations); + public Allocations createPrepaymentAllocation(String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { + HttpResponse response = createPrepaymentAllocationForHttpResponse(xeroTenantId, prepaymentID, allocations); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPrepaymentAllocationForHttpResponse( UUID prepaymentID, Allocations allocations) throws IOException { - // verify the required parameter 'prepaymentID' is set + public HttpResponse createPrepaymentAllocationForHttpResponse( String xeroTenantId, UUID prepaymentID, Allocations allocations) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentAllocation"); + }// verify the required parameter 'prepaymentID' is set if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentAllocation"); }// verify the required parameter 'allocations' is set @@ -2006,7 +2158,7 @@ public HttpResponse createPrepaymentAllocationForHttpResponse( UUID prepaymentID throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createPrepaymentAllocation"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2038,19 +2190,23 @@ public HttpResponse createPrepaymentAllocationForHttpResponse( UUID prepaymentID * Allows you to create a history record for an Prepayment *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PrePayment *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Expense Claims + * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID Unique identifier for a PrePayment * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPrepaymentHistory(UUID prepaymentID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createPrepaymentHistoryForHttpResponse(prepaymentID, historyRecords); + public HistoryRecords createPrepaymentHistory(String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPrepaymentHistoryForHttpResponse( UUID prepaymentID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'prepaymentID' is set + public HttpResponse createPrepaymentHistoryForHttpResponse( String xeroTenantId, UUID prepaymentID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling createPrepaymentHistory"); }// verify the required parameter 'historyRecords' is set @@ -2058,7 +2214,7 @@ public HttpResponse createPrepaymentHistoryForHttpResponse( UUID prepaymentID, throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPrepaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2090,24 +2246,28 @@ public HttpResponse createPrepaymentHistoryForHttpResponse( UUID prepaymentID, * Allows you to create purchase orders *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrders The purchaseOrders parameter * @param summarizeErrors shows validation errors for each purchase order. * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders createPurchaseOrder(PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { - HttpResponse response = createPurchaseOrderForHttpResponse(purchaseOrders, summarizeErrors); + public PurchaseOrders createPurchaseOrder(String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + HttpResponse response = createPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrders, summarizeErrors); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPurchaseOrderForHttpResponse( PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { - // verify the required parameter 'purchaseOrders' is set + public HttpResponse createPurchaseOrderForHttpResponse( String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); + }// verify the required parameter 'purchaseOrders' is set if (purchaseOrders == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2145,19 +2305,23 @@ public HttpResponse createPurchaseOrderForHttpResponse( PurchaseOrders purchaseO * Allows you to create HistoryRecord for purchase orders *

200 - Success - return response of type HistoryRecords array for newly created HistoryRecord for PurchaseOrder *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPurchaseOrderHistory(UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createPurchaseOrderHistoryForHttpResponse(purchaseOrderID, historyRecords); + public HistoryRecords createPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createPurchaseOrderHistoryForHttpResponse( UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'purchaseOrderID' is set + public HttpResponse createPurchaseOrderHistoryForHttpResponse( String xeroTenantId, UUID purchaseOrderID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling createPurchaseOrderHistory"); }// verify the required parameter 'historyRecords' is set @@ -2165,7 +2329,7 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse( UUID purchaseOrde throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPurchaseOrderHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2197,23 +2361,27 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse( UUID purchaseOrde * Allows you to create draft expense claim receipts for any user *

200 - Success - return response of type Receipts array for newly created Receipt *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param receipts The receipts parameter * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts createReceipt(Receipts receipts) throws IOException { - HttpResponse response = createReceiptForHttpResponse(receipts); + public Receipts createReceipt(String xeroTenantId, Receipts receipts) throws IOException { + HttpResponse response = createReceiptForHttpResponse(xeroTenantId, receipts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createReceiptForHttpResponse( Receipts receipts) throws IOException { - // verify the required parameter 'receipts' is set + public HttpResponse createReceiptForHttpResponse( String xeroTenantId, Receipts receipts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceipt"); + }// verify the required parameter 'receipts' is set if (receipts == null) { throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling createReceipt"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2240,20 +2408,24 @@ public HttpResponse createReceiptForHttpResponse( Receipts receipts) throws IOEx * Allows you to create Attachment on expense claim receipts by file name *

200 - Success - return response of type Attachments array with newly created Attachment for a specified Receipt *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param fileName The name of the file being attached to the Receipt * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createReceiptAttachmentByFileName(UUID receiptID, String fileName, File body) throws IOException { - HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(receiptID, fileName, body); + public Attachments createReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { + HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( UUID receiptID, String fileName, File body) throws IOException { - // verify the required parameter 'receiptID' is set + public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -2264,7 +2436,7 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( UUID recei throw new IllegalArgumentException("Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2299,19 +2471,23 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( UUID recei * Allows you to retrieve a history records of an Receipt *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts *

400 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Receipts + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createReceiptHistory(UUID receiptID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createReceiptHistoryForHttpResponse(receiptID, historyRecords); + public HistoryRecords createReceiptHistory(String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createReceiptHistoryForHttpResponse(xeroTenantId, receiptID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createReceiptHistoryForHttpResponse( UUID receiptID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'receiptID' is set + public HttpResponse createReceiptHistoryForHttpResponse( String xeroTenantId, UUID receiptID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); + }// verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling createReceiptHistory"); }// verify the required parameter 'historyRecords' is set @@ -2319,7 +2495,7 @@ public HttpResponse createReceiptHistoryForHttpResponse( UUID receiptID, Histor throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createReceiptHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2351,20 +2527,24 @@ public HttpResponse createReceiptHistoryForHttpResponse( UUID receiptID, Histor * Allows you to create attachment on repeating invoices by file name *

200 - Success - return response of type Attachments array with updated Attachment for a specified Repeating Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param fileName The name of the file being attached to a Repeating Invoice * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createRepeatingInvoiceAttachmentByFileName(UUID repeatingInvoiceID, String fileName, File body) throws IOException { - HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(repeatingInvoiceID, fileName, body); + public Attachments createRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { + HttpResponse response = createRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( UUID repeatingInvoiceID, String fileName, File body) throws IOException { - // verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -2375,7 +2555,7 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( U throw new IllegalArgumentException("Missing the required parameter 'body' when calling createRepeatingInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2410,19 +2590,23 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( U * Allows you to create history for a repeating invoice *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Repeating Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param historyRecords The historyRecords parameter * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createRepeatingInvoiceHistory(UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { - HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(repeatingInvoiceID, historyRecords); + public HistoryRecords createRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { + HttpResponse response = createRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID, historyRecords); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { - // verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, HistoryRecords historyRecords) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling createRepeatingInvoiceHistory"); }// verify the required parameter 'historyRecords' is set @@ -2430,7 +2614,7 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( UUID repeating throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createRepeatingInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2462,23 +2646,27 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( UUID repeating * Allows you to create Tax Rates *

200 - Success - return response of type TaxRates array newly created TaxRate *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param taxRates The taxRates parameter * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates createTaxRate(TaxRates taxRates) throws IOException { - HttpResponse response = createTaxRateForHttpResponse(taxRates); + public TaxRates createTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { + HttpResponse response = createTaxRateForHttpResponse(xeroTenantId, taxRates); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createTaxRateForHttpResponse( TaxRates taxRates) throws IOException { - // verify the required parameter 'taxRates' is set + public HttpResponse createTaxRateForHttpResponse( String xeroTenantId, TaxRates taxRates) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); + }// verify the required parameter 'taxRates' is set if (taxRates == null) { throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2505,23 +2693,27 @@ public HttpResponse createTaxRateForHttpResponse( TaxRates taxRates) throws IOEx * Allows you to create tracking categories *

200 - Success - return response of type TrackingCategories array of newly created TrackingCategory *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategory The trackingCategory parameter * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories createTrackingCategory(TrackingCategory trackingCategory) throws IOException { - HttpResponse response = createTrackingCategoryForHttpResponse(trackingCategory); + public TrackingCategories createTrackingCategory(String xeroTenantId, TrackingCategory trackingCategory) throws IOException { + HttpResponse response = createTrackingCategoryForHttpResponse(xeroTenantId, trackingCategory); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createTrackingCategoryForHttpResponse( TrackingCategory trackingCategory) throws IOException { - // verify the required parameter 'trackingCategory' is set + public HttpResponse createTrackingCategoryForHttpResponse( String xeroTenantId, TrackingCategory trackingCategory) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingCategory"); + }// verify the required parameter 'trackingCategory' is set if (trackingCategory == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling createTrackingCategory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2548,19 +2740,23 @@ public HttpResponse createTrackingCategoryForHttpResponse( TrackingCategory trac * Allows you to create options for a specified tracking category *

200 - Success - return response of type TrackingOptions array of options for a specified category *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @param trackingOption The trackingOption parameter * @return TrackingOptions * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingOptions createTrackingOptions(UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { - HttpResponse response = createTrackingOptionsForHttpResponse(trackingCategoryID, trackingOption); + public TrackingOptions createTrackingOptions(String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { + HttpResponse response = createTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOption); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createTrackingOptionsForHttpResponse( UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { - // verify the required parameter 'trackingCategoryID' is set + public HttpResponse createTrackingOptionsForHttpResponse( String xeroTenantId, UUID trackingCategoryID, TrackingOption trackingOption) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling createTrackingOptions"); }// verify the required parameter 'trackingOption' is set @@ -2568,7 +2764,7 @@ public HttpResponse createTrackingOptionsForHttpResponse( UUID trackingCategoryI throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling createTrackingOptions"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2600,23 +2796,27 @@ public HttpResponse createTrackingOptionsForHttpResponse( UUID trackingCategoryI * Allows you to delete a chart of accounts *

200 - Success - delete existing Account and return response of type Accounts array with deleted Account *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for retrieving single object * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts deleteAccount(UUID accountID) throws IOException { - HttpResponse response = deleteAccountForHttpResponse(accountID); + public Accounts deleteAccount(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = deleteAccountForHttpResponse(xeroTenantId, accountID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteAccountForHttpResponse( UUID accountID) throws IOException { - // verify the required parameter 'accountID' is set + public HttpResponse deleteAccountForHttpResponse( String xeroTenantId, UUID accountID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteAccount"); + }// verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling deleteAccount"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2646,16 +2846,20 @@ public HttpResponse deleteAccountForHttpResponse( UUID accountID) throws IOExcep * Allows you to delete a specific Contact from a Contract Group *

204 - Success - return response 204 no content *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group * @param contactID Unique identifier for a Contact * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteContactGroupContact(UUID contactGroupID, UUID contactID) throws IOException { - deleteContactGroupContactForHttpResponse(contactGroupID, contactID); + public void deleteContactGroupContact(String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { + deleteContactGroupContactForHttpResponse(xeroTenantId, contactGroupID, contactID); } - public HttpResponse deleteContactGroupContactForHttpResponse( UUID contactGroupID, UUID contactID) throws IOException { - // verify the required parameter 'contactGroupID' is set + public HttpResponse deleteContactGroupContactForHttpResponse( String xeroTenantId, UUID contactGroupID, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContact"); + }// verify the required parameter 'contactGroupID' is set if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContact"); }// verify the required parameter 'contactID' is set @@ -2663,7 +2867,7 @@ public HttpResponse deleteContactGroupContactForHttpResponse( UUID contactGroupI throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling deleteContactGroupContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2693,20 +2897,24 @@ public HttpResponse deleteContactGroupContactForHttpResponse( UUID contactGroupI /** * Allows you to delete all Contacts from a Contract Group *

200 - Success - return response 204 no content + * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteContactGroupContacts(UUID contactGroupID) throws IOException { - deleteContactGroupContactsForHttpResponse(contactGroupID); + public void deleteContactGroupContacts(String xeroTenantId, UUID contactGroupID) throws IOException { + deleteContactGroupContactsForHttpResponse(xeroTenantId, contactGroupID); } - public HttpResponse deleteContactGroupContactsForHttpResponse( UUID contactGroupID) throws IOException { - // verify the required parameter 'contactGroupID' is set + public HttpResponse deleteContactGroupContactsForHttpResponse( String xeroTenantId, UUID contactGroupID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteContactGroupContacts"); + }// verify the required parameter 'contactGroupID' is set if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling deleteContactGroupContacts"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2736,20 +2944,24 @@ public HttpResponse deleteContactGroupContactsForHttpResponse( UUID contactGroup * Allows you to delete a specified item *

204 - Success - return response 204 no content *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteItem(UUID itemID) throws IOException { - deleteItemForHttpResponse(itemID); + public void deleteItem(String xeroTenantId, UUID itemID) throws IOException { + deleteItemForHttpResponse(xeroTenantId, itemID); } - public HttpResponse deleteItemForHttpResponse( UUID itemID) throws IOException { - // verify the required parameter 'itemID' is set + public HttpResponse deleteItemForHttpResponse( String xeroTenantId, UUID itemID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteItem"); + }// verify the required parameter 'itemID' is set if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling deleteItem"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2779,20 +2991,24 @@ public HttpResponse deleteItemForHttpResponse( UUID itemID) throws IOException { * Allows you to delete a specified linked transactions (billable expenses) *

204 - Success - return response 204 no content *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactionID Unique identifier for a LinkedTransaction * @throws IOException if an error occurs while attempting to invoke the API **/ - public void deleteLinkedTransaction(UUID linkedTransactionID) throws IOException { - deleteLinkedTransactionForHttpResponse(linkedTransactionID); + public void deleteLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { + deleteLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); } - public HttpResponse deleteLinkedTransactionForHttpResponse( UUID linkedTransactionID) throws IOException { - // verify the required parameter 'linkedTransactionID' is set + public HttpResponse deleteLinkedTransactionForHttpResponse( String xeroTenantId, UUID linkedTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set if (linkedTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling deleteLinkedTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2822,19 +3038,23 @@ public HttpResponse deleteLinkedTransactionForHttpResponse( UUID linkedTransacti * Allows you to update a specified payment for invoices and credit notes *

200 - Success - return response of type Payments array for updated Payment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment * @param payments The payments parameter * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments deletePayment(UUID paymentID, Payments payments) throws IOException { - HttpResponse response = deletePaymentForHttpResponse(paymentID, payments); + public Payments deletePayment(String xeroTenantId, UUID paymentID, Payments payments) throws IOException { + HttpResponse response = deletePaymentForHttpResponse(xeroTenantId, paymentID, payments); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deletePaymentForHttpResponse( UUID paymentID, Payments payments) throws IOException { - // verify the required parameter 'paymentID' is set + public HttpResponse deletePaymentForHttpResponse( String xeroTenantId, UUID paymentID, Payments payments) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment"); + }// verify the required parameter 'paymentID' is set if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment"); }// verify the required parameter 'payments' is set @@ -2842,7 +3062,7 @@ public HttpResponse deletePaymentForHttpResponse( UUID paymentID, Payments paym throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2874,23 +3094,27 @@ public HttpResponse deletePaymentForHttpResponse( UUID paymentID, Payments paym * Allows you to delete tracking categories *

200 - Success - return response of type TrackingCategories array of deleted TrackingCategory *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories deleteTrackingCategory(UUID trackingCategoryID) throws IOException { - HttpResponse response = deleteTrackingCategoryForHttpResponse(trackingCategoryID); + public TrackingCategories deleteTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { + HttpResponse response = deleteTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteTrackingCategoryForHttpResponse( UUID trackingCategoryID) throws IOException { - // verify the required parameter 'trackingCategoryID' is set + public HttpResponse deleteTrackingCategoryForHttpResponse( String xeroTenantId, UUID trackingCategoryID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingCategory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2920,19 +3144,23 @@ public HttpResponse deleteTrackingCategoryForHttpResponse( UUID trackingCategory * Allows you to delete a specified option for a specified tracking category *

200 - Success - return response of type TrackingOptions array of remaining options for a specified category *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @param trackingOptionID Unique identifier for a Tracking Option * @return TrackingOptions * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingOptions deleteTrackingOptions(UUID trackingCategoryID, UUID trackingOptionID) throws IOException { - HttpResponse response = deleteTrackingOptionsForHttpResponse(trackingCategoryID, trackingOptionID); + public TrackingOptions deleteTrackingOptions(String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { + HttpResponse response = deleteTrackingOptionsForHttpResponse(xeroTenantId, trackingCategoryID, trackingOptionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteTrackingOptionsForHttpResponse( UUID trackingCategoryID, UUID trackingOptionID) throws IOException { - // verify the required parameter 'trackingCategoryID' is set + public HttpResponse deleteTrackingOptionsForHttpResponse( String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling deleteTrackingOptions"); }// verify the required parameter 'trackingOptionID' is set @@ -2940,7 +3168,7 @@ public HttpResponse deleteTrackingOptionsForHttpResponse( UUID trackingCategoryI throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling deleteTrackingOptions"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -2971,16 +3199,20 @@ public HttpResponse deleteTrackingOptionsForHttpResponse( UUID trackingCategoryI * Allows you to email a copy of invoice to related Contact *

204 - Success - return response 204 no content *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param requestEmpty The requestEmpty parameter * @throws IOException if an error occurs while attempting to invoke the API **/ - public void emailInvoice(UUID invoiceID, RequestEmpty requestEmpty) throws IOException { - emailInvoiceForHttpResponse(invoiceID, requestEmpty); + public void emailInvoice(String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { + emailInvoiceForHttpResponse(xeroTenantId, invoiceID, requestEmpty); } - public HttpResponse emailInvoiceForHttpResponse( UUID invoiceID, RequestEmpty requestEmpty) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse emailInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID, RequestEmpty requestEmpty) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling emailInvoice"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling emailInvoice"); }// verify the required parameter 'requestEmpty' is set @@ -2988,7 +3220,7 @@ public HttpResponse emailInvoiceForHttpResponse( UUID invoiceID, RequestEmpty r throw new IllegalArgumentException("Missing the required parameter 'requestEmpty' when calling emailInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3019,23 +3251,27 @@ public HttpResponse emailInvoiceForHttpResponse( UUID invoiceID, RequestEmpty r /** * Allows you to retrieve a single chart of accounts *

200 - Success - return response of type Accounts array with one Account + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for retrieving single object * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccount(UUID accountID) throws IOException { - HttpResponse response = getAccountForHttpResponse(accountID); + public Accounts getAccount(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = getAccountForHttpResponse(xeroTenantId, accountID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getAccountForHttpResponse( UUID accountID) throws IOException { - // verify the required parameter 'accountID' is set + public HttpResponse getAccountForHttpResponse( String xeroTenantId, UUID accountID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccount"); + }// verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccount"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3064,21 +3300,25 @@ public HttpResponse getAccountForHttpResponse( UUID accountID) throws IOExceptio /** * Allows you to retrieve Attachment on Account by Filename *

200 - Success - return response of attachment for Account as binary data + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param fileName Name of the attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getAccountAttachmentByFileName(UUID accountID, String fileName, String contentType) throws IOException { - HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(accountID, fileName, contentType); + public ByteArrayInputStream getAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { + HttpResponse response = getAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getAccountAttachmentByFileNameForHttpResponse( UUID accountID, String fileName, String contentType) throws IOException { - // verify the required parameter 'accountID' is set + public HttpResponse getAccountAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID accountID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -3089,7 +3329,7 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse( UUID accountI throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3126,21 +3366,25 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse( UUID accountI /** * Allows you to retrieve specific Attachment on Account *

200 - Success - return response of attachment for Account as binary data + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param attachmentID Unique identifier for Attachment object * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getAccountAttachmentById(UUID accountID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getAccountAttachmentByIdForHttpResponse(accountID, attachmentID, contentType); + public ByteArrayInputStream getAccountAttachmentById(String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getAccountAttachmentByIdForHttpResponse(xeroTenantId, accountID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getAccountAttachmentByIdForHttpResponse( UUID accountID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'accountID' is set + public HttpResponse getAccountAttachmentByIdForHttpResponse( String xeroTenantId, UUID accountID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachmentById"); + }// verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -3151,7 +3395,7 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse( UUID accountID, UU throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getAccountAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3188,23 +3432,27 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse( UUID accountID, UU /** * Allows you to retrieve Attachments for accounts *

200 - Success - return response of type Attachments array of Attachment + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getAccountAttachments(UUID accountID) throws IOException { - HttpResponse response = getAccountAttachmentsForHttpResponse(accountID); + public Attachments getAccountAttachments(String xeroTenantId, UUID accountID) throws IOException { + HttpResponse response = getAccountAttachmentsForHttpResponse(xeroTenantId, accountID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getAccountAttachmentsForHttpResponse( UUID accountID) throws IOException { - // verify the required parameter 'accountID' is set + public HttpResponse getAccountAttachmentsForHttpResponse( String xeroTenantId, UUID accountID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccountAttachments"); + }// verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling getAccountAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3233,22 +3481,26 @@ public HttpResponse getAccountAttachmentsForHttpResponse( UUID accountID) throws /** * Allows you to retrieve the full chart of accounts *

200 - Success - return response of type Accounts array with 0 to n Account + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts getAccounts(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getAccountsForHttpResponse(ifModifiedSince, where, order); + public Accounts getAccounts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getAccountsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getAccountsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - + public HttpResponse getAccountsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAccounts"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3293,23 +3545,27 @@ public HttpResponse getAccountsForHttpResponse( OffsetDateTime ifModifiedSince, /** * Allows you to retrieve a single spend or receive money transaction *

200 - Success - return response of type BankTransactions array with a specific BankTransaction + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions getBankTransaction(UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionForHttpResponse(bankTransactionID); + public BankTransactions getBankTransaction(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionForHttpResponse(xeroTenantId, bankTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionForHttpResponse( UUID bankTransactionID) throws IOException { - // verify the required parameter 'bankTransactionID' is set + public HttpResponse getBankTransactionForHttpResponse( String xeroTenantId, UUID bankTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3338,21 +3594,25 @@ public HttpResponse getBankTransactionForHttpResponse( UUID bankTransactionID) t /** * Allows you to retrieve Attachments on BankTransaction by Filename *

200 - Success - return response of attachment for BankTransaction as binary data + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param fileName The name of the file being attached * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransactionAttachmentByFileName(UUID bankTransactionID, String fileName, String contentType) throws IOException { - HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(bankTransactionID, fileName, contentType); + public ByteArrayInputStream getBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { + HttpResponse response = getBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( UUID bankTransactionID, String fileName, String contentType) throws IOException { - // verify the required parameter 'bankTransactionID' is set + public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransactionID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -3363,7 +3623,7 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( UUID throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3400,21 +3660,25 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( UUID /** * Allows you to retrieve Attachments on a specific BankTransaction *

200 - Success - return response of attachment for BankTransaction as binary data + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param attachmentID Xero generated unique identifier for an attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransactionAttachmentById(UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(bankTransactionID, attachmentID, contentType); + public ByteArrayInputStream getBankTransactionAttachmentById(String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getBankTransactionAttachmentByIdForHttpResponse(xeroTenantId, bankTransactionID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'bankTransactionID' is set + public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( String xeroTenantId, UUID bankTransactionID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachmentById"); + }// verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -3425,7 +3689,7 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( UUID bankTr throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransactionAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3462,23 +3726,27 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( UUID bankTr /** * Allows you to retrieve any attachments to bank transactions *

200 - Success - return response of type Attachments array with 0 to n Attachment + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransactionAttachments(UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionAttachmentsForHttpResponse(bankTransactionID); + public Attachments getBankTransactionAttachments(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionAttachmentsForHttpResponse(xeroTenantId, bankTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionAttachmentsForHttpResponse( UUID bankTransactionID) throws IOException { - // verify the required parameter 'bankTransactionID' is set + public HttpResponse getBankTransactionAttachmentsForHttpResponse( String xeroTenantId, UUID bankTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionAttachments"); + }// verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3507,6 +3775,7 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse( UUID bankTrans /** * Allows you to retrieve any spend or receive money transactions *

200 - Success - return response of type BankTransactions array with 0 to n BankTransaction + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -3515,16 +3784,19 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse( UUID bankTrans * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions getBankTransactions(OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getBankTransactionsForHttpResponse(ifModifiedSince, where, order, page, unitdp); + public BankTransactions getBankTransactions(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getBankTransactionsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - + public HttpResponse getBankTransactionsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactions"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3589,23 +3861,27 @@ public HttpResponse getBankTransactionsForHttpResponse( OffsetDateTime ifModifie /** * Allows you to retrieve history from a bank transactions *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransactionsHistory(UUID bankTransactionID) throws IOException { - HttpResponse response = getBankTransactionsHistoryForHttpResponse(bankTransactionID); + public HistoryRecords getBankTransactionsHistory(String xeroTenantId, UUID bankTransactionID) throws IOException { + HttpResponse response = getBankTransactionsHistoryForHttpResponse(xeroTenantId, bankTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransactionsHistoryForHttpResponse( UUID bankTransactionID) throws IOException { - // verify the required parameter 'bankTransactionID' is set + public HttpResponse getBankTransactionsHistoryForHttpResponse( String xeroTenantId, UUID bankTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransactionsHistory"); + }// verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling getBankTransactionsHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3634,23 +3910,27 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse( UUID bankTransact /** * Allows you to retrieve any bank transfers *

200 - Success - return response of BankTransfers array with one BankTransfer + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfer(UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferForHttpResponse(bankTransferID); + public BankTransfers getBankTransfer(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferForHttpResponse(xeroTenantId, bankTransferID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransferForHttpResponse( UUID bankTransferID) throws IOException { - // verify the required parameter 'bankTransferID' is set + public HttpResponse getBankTransferForHttpResponse( String xeroTenantId, UUID bankTransferID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfer"); + }// verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransfer"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3679,21 +3959,25 @@ public HttpResponse getBankTransferForHttpResponse( UUID bankTransferID) throws /** * Allows you to retrieve Attachments on BankTransfer by file name *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param fileName The name of the file being attached to a Bank Transfer * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransferAttachmentByFileName(UUID bankTransferID, String fileName, String contentType) throws IOException { - HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(bankTransferID, fileName, contentType); + public ByteArrayInputStream getBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { + HttpResponse response = getBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( UUID bankTransferID, String fileName, String contentType) throws IOException { - // verify the required parameter 'bankTransferID' is set + public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransferID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -3704,7 +3988,7 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( UUID ban throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3741,21 +4025,25 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( UUID ban /** * Allows you to retrieve Attachments on BankTransfer *

200 - Success - return response of binary data from the Attachment to a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param attachmentID Xero generated unique identifier for an Attachment to a bank transfer * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getBankTransferAttachmentById(UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(bankTransferID, attachmentID, contentType); + public ByteArrayInputStream getBankTransferAttachmentById(String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getBankTransferAttachmentByIdForHttpResponse(xeroTenantId, bankTransferID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getBankTransferAttachmentByIdForHttpResponse( UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'bankTransferID' is set + public HttpResponse getBankTransferAttachmentByIdForHttpResponse( String xeroTenantId, UUID bankTransferID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachmentById"); + }// verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -3766,7 +4054,7 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse( UUID bankTrans throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getBankTransferAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3803,23 +4091,27 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse( UUID bankTrans /** * Allows you to retrieve Attachments from bank transfers *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getBankTransferAttachments(UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferAttachmentsForHttpResponse(bankTransferID); + public Attachments getBankTransferAttachments(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferAttachmentsForHttpResponse(xeroTenantId, bankTransferID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransferAttachmentsForHttpResponse( UUID bankTransferID) throws IOException { - // verify the required parameter 'bankTransferID' is set + public HttpResponse getBankTransferAttachmentsForHttpResponse( String xeroTenantId, UUID bankTransferID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferAttachments"); + }// verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3848,23 +4140,27 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse( UUID bankTransfer /** * Allows you to retrieve history from a bank transfers *

200 - Success - return response of HistoryRecords array of 0 to N HistoryRecord for a Bank Transfer + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBankTransferHistory(UUID bankTransferID) throws IOException { - HttpResponse response = getBankTransferHistoryForHttpResponse(bankTransferID); + public HistoryRecords getBankTransferHistory(String xeroTenantId, UUID bankTransferID) throws IOException { + HttpResponse response = getBankTransferHistoryForHttpResponse(xeroTenantId, bankTransferID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransferHistoryForHttpResponse( UUID bankTransferID) throws IOException { - // verify the required parameter 'bankTransferID' is set + public HttpResponse getBankTransferHistoryForHttpResponse( String xeroTenantId, UUID bankTransferID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransferHistory"); + }// verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling getBankTransferHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3893,22 +4189,26 @@ public HttpResponse getBankTransferHistoryForHttpResponse( UUID bankTransferID) /** * Allows you to retrieve all bank transfers *

200 - Success - return response of BankTransfers array of 0 to N BankTransfer + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return BankTransfers * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransfers getBankTransfers(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getBankTransfersForHttpResponse(ifModifiedSince, where, order); + public BankTransfers getBankTransfers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getBankTransfersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBankTransfersForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - + public HttpResponse getBankTransfersForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBankTransfers"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3953,23 +4253,27 @@ public HttpResponse getBankTransfersForHttpResponse( OffsetDateTime ifModifiedSi /** * Allows you to retrieve history from a Batch Payment *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + * @param xeroTenantId Xero identifier for Tenant * @param batchPaymentID Unique identifier for BatchPayment * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getBatchPaymentHistory(UUID batchPaymentID) throws IOException { - HttpResponse response = getBatchPaymentHistoryForHttpResponse(batchPaymentID); + public HistoryRecords getBatchPaymentHistory(String xeroTenantId, UUID batchPaymentID) throws IOException { + HttpResponse response = getBatchPaymentHistoryForHttpResponse(xeroTenantId, batchPaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBatchPaymentHistoryForHttpResponse( UUID batchPaymentID) throws IOException { - // verify the required parameter 'batchPaymentID' is set + public HttpResponse getBatchPaymentHistoryForHttpResponse( String xeroTenantId, UUID batchPaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPaymentHistory"); + }// verify the required parameter 'batchPaymentID' is set if (batchPaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'batchPaymentID' when calling getBatchPaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -3998,22 +4302,26 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse( UUID batchPaymentID) /** * Retrieve either one or many BatchPayments for invoices *

200 - Success - return response of type BatchPayments array of BatchPayment objects + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public BatchPayments getBatchPayments(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getBatchPaymentsForHttpResponse(ifModifiedSince, where, order); + public BatchPayments getBatchPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getBatchPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBatchPaymentsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - + public HttpResponse getBatchPaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBatchPayments"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4058,23 +4366,27 @@ public HttpResponse getBatchPaymentsForHttpResponse( OffsetDateTime ifModifiedSi /** * Allows you to retrieve a specific BrandingThemes *

200 - Success - return response of type BrandingThemes with one BrandingTheme + * @param xeroTenantId Xero identifier for Tenant * @param brandingThemeID Unique identifier for a Branding Theme * @return BrandingThemes * @throws IOException if an error occurs while attempting to invoke the API **/ - public BrandingThemes getBrandingTheme(UUID brandingThemeID) throws IOException { - HttpResponse response = getBrandingThemeForHttpResponse(brandingThemeID); + public BrandingThemes getBrandingTheme(String xeroTenantId, UUID brandingThemeID) throws IOException { + HttpResponse response = getBrandingThemeForHttpResponse(xeroTenantId, brandingThemeID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBrandingThemeForHttpResponse( UUID brandingThemeID) throws IOException { - // verify the required parameter 'brandingThemeID' is set + public HttpResponse getBrandingThemeForHttpResponse( String xeroTenantId, UUID brandingThemeID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingTheme"); + }// verify the required parameter 'brandingThemeID' is set if (brandingThemeID == null) { throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingTheme"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4103,23 +4415,27 @@ public HttpResponse getBrandingThemeForHttpResponse( UUID brandingThemeID) throw /** * Allows you to retrieve the Payment services for a Branding Theme *

200 - Success - return response of type PaymentServices array with 0 to N PaymentService + * @param xeroTenantId Xero identifier for Tenant * @param brandingThemeID Unique identifier for a Branding Theme * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices getBrandingThemePaymentServices(UUID brandingThemeID) throws IOException { - HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(brandingThemeID); + public PaymentServices getBrandingThemePaymentServices(String xeroTenantId, UUID brandingThemeID) throws IOException { + HttpResponse response = getBrandingThemePaymentServicesForHttpResponse(xeroTenantId, brandingThemeID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBrandingThemePaymentServicesForHttpResponse( UUID brandingThemeID) throws IOException { - // verify the required parameter 'brandingThemeID' is set + public HttpResponse getBrandingThemePaymentServicesForHttpResponse( String xeroTenantId, UUID brandingThemeID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemePaymentServices"); + }// verify the required parameter 'brandingThemeID' is set if (brandingThemeID == null) { throw new IllegalArgumentException("Missing the required parameter 'brandingThemeID' when calling getBrandingThemePaymentServices"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4148,19 +4464,23 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse( UUID brandin /** * Allows you to retrieve all the BrandingThemes *

200 - Success - return response of type BrandingThemes + * @param xeroTenantId Xero identifier for Tenant * @return BrandingThemes * @throws IOException if an error occurs while attempting to invoke the API **/ - public BrandingThemes getBrandingThemes() throws IOException { - HttpResponse response = getBrandingThemesForHttpResponse(); + public BrandingThemes getBrandingThemes(String xeroTenantId) throws IOException { + HttpResponse response = getBrandingThemesForHttpResponse(xeroTenantId); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getBrandingThemesForHttpResponse() throws IOException { - + public HttpResponse getBrandingThemesForHttpResponse( String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getBrandingThemes"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4184,23 +4504,27 @@ public HttpResponse getBrandingThemesForHttpResponse() throws IOException { /** * Allows you to retrieve, add and update contacts in a Xero organisation *

200 - Success - return response of type Contacts array with a unique Contact + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContact(UUID contactID) throws IOException { - HttpResponse response = getContactForHttpResponse(contactID); + public Contacts getContact(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactForHttpResponse(xeroTenantId, contactID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactForHttpResponse( UUID contactID) throws IOException { - // verify the required parameter 'contactID' is set + public HttpResponse getContactForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContact"); + }// verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4229,21 +4553,25 @@ public HttpResponse getContactForHttpResponse( UUID contactID) throws IOExceptio /** * Allows you to retrieve Attachments on Contacts by file name *

200 - Success - return response of attachment for Contact as binary data + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param fileName Name for the file you are attaching * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getContactAttachmentByFileName(UUID contactID, String fileName, String contentType) throws IOException { - HttpResponse response = getContactAttachmentByFileNameForHttpResponse(contactID, fileName, contentType); + public ByteArrayInputStream getContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { + HttpResponse response = getContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getContactAttachmentByFileNameForHttpResponse( UUID contactID, String fileName, String contentType) throws IOException { - // verify the required parameter 'contactID' is set + public HttpResponse getContactAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID contactID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -4254,7 +4582,7 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse( UUID contactI throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4291,21 +4619,25 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse( UUID contactI /** * Allows you to retrieve Attachments on Contacts *

200 - Success - return response of attachment for Contact as binary data + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getContactAttachmentById(UUID contactID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getContactAttachmentByIdForHttpResponse(contactID, attachmentID, contentType); + public ByteArrayInputStream getContactAttachmentById(String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getContactAttachmentByIdForHttpResponse(xeroTenantId, contactID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getContactAttachmentByIdForHttpResponse( UUID contactID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'contactID' is set + public HttpResponse getContactAttachmentByIdForHttpResponse( String xeroTenantId, UUID contactID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachmentById"); + }// verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -4316,7 +4648,7 @@ public HttpResponse getContactAttachmentByIdForHttpResponse( UUID contactID, UU throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getContactAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4353,23 +4685,27 @@ public HttpResponse getContactAttachmentByIdForHttpResponse( UUID contactID, UU /** * Allows you to retrieve, add and update contacts in a Xero organisation *

200 - Success - return response of type Attachments array with 0 to N Attachment + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getContactAttachments(UUID contactID) throws IOException { - HttpResponse response = getContactAttachmentsForHttpResponse(contactID); + public Attachments getContactAttachments(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactAttachmentsForHttpResponse(xeroTenantId, contactID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactAttachmentsForHttpResponse( UUID contactID) throws IOException { - // verify the required parameter 'contactID' is set + public HttpResponse getContactAttachmentsForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactAttachments"); + }// verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4398,23 +4734,27 @@ public HttpResponse getContactAttachmentsForHttpResponse( UUID contactID) throws /** * Allows you to retrieve CISSettings for a contact in a Xero organisation *

200 - Success - return response of type CISSettings for a specific Contact + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @return CISSettings * @throws IOException if an error occurs while attempting to invoke the API **/ - public CISSettings getContactCISSettings(UUID contactID) throws IOException { - HttpResponse response = getContactCISSettingsForHttpResponse(contactID); + public CISSettings getContactCISSettings(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactCISSettingsForHttpResponse(xeroTenantId, contactID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactCISSettingsForHttpResponse( UUID contactID) throws IOException { - // verify the required parameter 'contactID' is set + public HttpResponse getContactCISSettingsForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactCISSettings"); + }// verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactCISSettings"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4443,23 +4783,27 @@ public HttpResponse getContactCISSettingsForHttpResponse( UUID contactID) throws /** * Allows you to retrieve a unique Contract Group by ID *

200 - Success - return response of type Contact Groups array with a specific Contact Group + * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroup(UUID contactGroupID) throws IOException { - HttpResponse response = getContactGroupForHttpResponse(contactGroupID); + public ContactGroups getContactGroup(String xeroTenantId, UUID contactGroupID) throws IOException { + HttpResponse response = getContactGroupForHttpResponse(xeroTenantId, contactGroupID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactGroupForHttpResponse( UUID contactGroupID) throws IOException { - // verify the required parameter 'contactGroupID' is set + public HttpResponse getContactGroupForHttpResponse( String xeroTenantId, UUID contactGroupID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroup"); + }// verify the required parameter 'contactGroupID' is set if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling getContactGroup"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4488,21 +4832,25 @@ public HttpResponse getContactGroupForHttpResponse( UUID contactGroupID) throws /** * Allows you to retrieve the ContactID and Name of all the contacts in a contact group *

200 - Success - return response of type Contact Groups array of Contact Group + * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups getContactGroups(String where, String order) throws IOException { - HttpResponse response = getContactGroupsForHttpResponse(where, order); + public ContactGroups getContactGroups(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getContactGroupsForHttpResponse(xeroTenantId, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactGroupsForHttpResponse( String where, String order) throws IOException { - + public HttpResponse getContactGroupsForHttpResponse( String xeroTenantId, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactGroups"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4547,23 +4895,27 @@ public HttpResponse getContactGroupsForHttpResponse( String where, String order /** * Allows you to retrieve a history records of an Contact *

200 - Success - return response of type History Records array of 0 to N History Record for a specific Contact + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getContactHistory(UUID contactID) throws IOException { - HttpResponse response = getContactHistoryForHttpResponse(contactID); + public HistoryRecords getContactHistory(String xeroTenantId, UUID contactID) throws IOException { + HttpResponse response = getContactHistoryForHttpResponse(xeroTenantId, contactID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactHistoryForHttpResponse( UUID contactID) throws IOException { - // verify the required parameter 'contactID' is set + public HttpResponse getContactHistoryForHttpResponse( String xeroTenantId, UUID contactID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContactHistory"); + }// verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling getContactHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4592,6 +4944,7 @@ public HttpResponse getContactHistoryForHttpResponse( UUID contactID) throws IOE /** * Allows you to retrieve, add and update contacts in a Xero organisation *

200 - Success - return response of type Contacts array with 0 to N Contact + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -4601,16 +4954,19 @@ public HttpResponse getContactHistoryForHttpResponse( UUID contactID) throws IOE * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContacts(OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { - HttpResponse response = getContactsForHttpResponse(ifModifiedSince, where, order, ids, page, includeArchived); + public Contacts getContacts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + HttpResponse response = getContactsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, page, includeArchived); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getContactsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { - + public HttpResponse getContactsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4685,23 +5041,27 @@ public HttpResponse getContactsForHttpResponse( OffsetDateTime ifModifiedSince, /** * Allows you to retrieve a specific credit note *

200 - Success - return response of type Credit Notes array with a unique CreditNote + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNote(UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteForHttpResponse(creditNoteID); + public CreditNotes getCreditNote(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteForHttpResponse(xeroTenantId, creditNoteID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNoteForHttpResponse( UUID creditNoteID) throws IOException { - // verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteForHttpResponse( String xeroTenantId, UUID creditNoteID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNote"); + }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNote"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4730,20 +5090,24 @@ public HttpResponse getCreditNoteForHttpResponse( UUID creditNoteID) throws IOEx /** * Allows you to retrieve Credit Note as PDF files *

200 - Success - return response of binary data from the Attachment to a Credit Note + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAsPdf(UUID creditNoteID, String contentType) throws IOException { - HttpResponse response = getCreditNoteAsPdfForHttpResponse(creditNoteID, contentType); + public ByteArrayInputStream getCreditNoteAsPdf(String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { + HttpResponse response = getCreditNoteAsPdfForHttpResponse(xeroTenantId, creditNoteID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getCreditNoteAsPdfForHttpResponse( UUID creditNoteID, String contentType) throws IOException { - // verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteAsPdfForHttpResponse( String xeroTenantId, UUID creditNoteID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAsPdf"); + }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAsPdf"); }// verify the required parameter 'contentType' is set @@ -4751,7 +5115,7 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse( UUID creditNoteID, Strin throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAsPdf"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4787,21 +5151,25 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse( UUID creditNoteID, Strin /** * Allows you to retrieve Attachments on CreditNote by file name *

200 - Success - return response of attachment for Credit Note as binary data + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param fileName Name of the file you are attaching to Credit Note * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAttachmentByFileName(UUID creditNoteID, String fileName, String contentType) throws IOException { - HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(creditNoteID, fileName, contentType); + public ByteArrayInputStream getCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { + HttpResponse response = getCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( UUID creditNoteID, String fileName, String contentType) throws IOException { - // verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID creditNoteID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -4812,7 +5180,7 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( UUID credi throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4849,21 +5217,25 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( UUID credi /** * Allows you to retrieve Attachments on CreditNote *

200 - Success - return response of attachment for Credit Note as binary data + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getCreditNoteAttachmentById(UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(creditNoteID, attachmentID, contentType); + public ByteArrayInputStream getCreditNoteAttachmentById(String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getCreditNoteAttachmentByIdForHttpResponse(xeroTenantId, creditNoteID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( String xeroTenantId, UUID creditNoteID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachmentById"); + }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -4874,7 +5246,7 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( UUID creditNoteI throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getCreditNoteAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4911,23 +5283,27 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( UUID creditNoteI /** * Allows you to retrieve Attachments for credit notes *

200 - Success - return response of type Attachments array with all Attachment for specific Credit Note + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getCreditNoteAttachments(UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteAttachmentsForHttpResponse(creditNoteID); + public Attachments getCreditNoteAttachments(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteAttachmentsForHttpResponse(xeroTenantId, creditNoteID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNoteAttachmentsForHttpResponse( UUID creditNoteID) throws IOException { - // verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteAttachmentsForHttpResponse( String xeroTenantId, UUID creditNoteID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteAttachments"); + }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -4956,23 +5332,27 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse( UUID creditNoteID) /** * Allows you to retrieve a history records of an CreditNote *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Credit Note + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getCreditNoteHistory(UUID creditNoteID) throws IOException { - HttpResponse response = getCreditNoteHistoryForHttpResponse(creditNoteID); + public HistoryRecords getCreditNoteHistory(String xeroTenantId, UUID creditNoteID) throws IOException { + HttpResponse response = getCreditNoteHistoryForHttpResponse(xeroTenantId, creditNoteID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNoteHistoryForHttpResponse( UUID creditNoteID) throws IOException { - // verify the required parameter 'creditNoteID' is set + public HttpResponse getCreditNoteHistoryForHttpResponse( String xeroTenantId, UUID creditNoteID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNoteHistory"); + }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling getCreditNoteHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5001,6 +5381,7 @@ public HttpResponse getCreditNoteHistoryForHttpResponse( UUID creditNoteID) thro /** * Allows you to retrieve any credit notes *

200 - Success - return response of type Credit Notes array of CreditNote + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -5008,16 +5389,19 @@ public HttpResponse getCreditNoteHistoryForHttpResponse( UUID creditNoteID) thro * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes getCreditNotes(OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - HttpResponse response = getCreditNotesForHttpResponse(ifModifiedSince, where, order, page); + public CreditNotes getCreditNotes(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpResponse response = getCreditNotesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCreditNotesForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - + public HttpResponse getCreditNotesForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCreditNotes"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5072,21 +5456,25 @@ public HttpResponse getCreditNotesForHttpResponse( OffsetDateTime ifModifiedSinc /** * Allows you to retrieve currencies for your organisation *

200 - Success - return response of type Currencies array with all Currencies + * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @return Currencies * @throws IOException if an error occurs while attempting to invoke the API **/ - public Currencies getCurrencies(String where, String order) throws IOException { - HttpResponse response = getCurrenciesForHttpResponse(where, order); + public Currencies getCurrencies(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getCurrenciesForHttpResponse(xeroTenantId, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getCurrenciesForHttpResponse( String where, String order) throws IOException { - + public HttpResponse getCurrenciesForHttpResponse( String xeroTenantId, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getCurrencies"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5131,23 +5519,27 @@ public HttpResponse getCurrenciesForHttpResponse( String where, String order) t /** * Allows you to retrieve a specific employee used in Xero payrun *

200 - Success - return response of type Employees array with specified Employee + * @param xeroTenantId Xero identifier for Tenant * @param employeeID Unique identifier for a Employee * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployee(UUID employeeID) throws IOException { - HttpResponse response = getEmployeeForHttpResponse(employeeID); + public Employees getEmployee(String xeroTenantId, UUID employeeID) throws IOException { + HttpResponse response = getEmployeeForHttpResponse(xeroTenantId, employeeID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getEmployeeForHttpResponse( UUID employeeID) throws IOException { - // verify the required parameter 'employeeID' is set + public HttpResponse getEmployeeForHttpResponse( 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"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5176,22 +5568,26 @@ public HttpResponse getEmployeeForHttpResponse( UUID employeeID) throws IOExcept /** * Allows you to retrieve employees used in Xero payrun *

200 - Success - return response of type Employees array with all Employee + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployees(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getEmployeesForHttpResponse(ifModifiedSince, where, order); + public Employees getEmployees(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getEmployeesForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getEmployeesForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - + public HttpResponse getEmployeesForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployees"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5236,23 +5632,27 @@ public HttpResponse getEmployeesForHttpResponse( OffsetDateTime ifModifiedSince, /** * Allows you to retrieve a specified expense claim *

200 - Success - return response of type ExpenseClaims array with specified ExpenseClaim + * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims getExpenseClaim(UUID expenseClaimID) throws IOException { - HttpResponse response = getExpenseClaimForHttpResponse(expenseClaimID); + public ExpenseClaims getExpenseClaim(String xeroTenantId, UUID expenseClaimID) throws IOException { + HttpResponse response = getExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getExpenseClaimForHttpResponse( UUID expenseClaimID) throws IOException { - // verify the required parameter 'expenseClaimID' is set + public HttpResponse getExpenseClaimForHttpResponse( String xeroTenantId, UUID expenseClaimID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaim"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5281,23 +5681,27 @@ public HttpResponse getExpenseClaimForHttpResponse( UUID expenseClaimID) throws /** * Allows you to retrieve a history records of an ExpenseClaim *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific ExpenseClaim + * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getExpenseClaimHistory(UUID expenseClaimID) throws IOException { - HttpResponse response = getExpenseClaimHistoryForHttpResponse(expenseClaimID); + public HistoryRecords getExpenseClaimHistory(String xeroTenantId, UUID expenseClaimID) throws IOException { + HttpResponse response = getExpenseClaimHistoryForHttpResponse(xeroTenantId, expenseClaimID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getExpenseClaimHistoryForHttpResponse( UUID expenseClaimID) throws IOException { - // verify the required parameter 'expenseClaimID' is set + public HttpResponse getExpenseClaimHistoryForHttpResponse( String xeroTenantId, UUID expenseClaimID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaimHistory"); + }// verify the required parameter 'expenseClaimID' is set if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling getExpenseClaimHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5326,22 +5730,26 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse( UUID expenseClaimID) /** * Allows you to retrieve expense claims *

200 - Success - return response of type ExpenseClaims array with all ExpenseClaims + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims getExpenseClaims(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getExpenseClaimsForHttpResponse(ifModifiedSince, where, order); + public ExpenseClaims getExpenseClaims(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getExpenseClaimsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getExpenseClaimsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - + public HttpResponse getExpenseClaimsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getExpenseClaims"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5386,23 +5794,27 @@ public HttpResponse getExpenseClaimsForHttpResponse( OffsetDateTime ifModifiedSi /** * Allows you to retrieve a specified sales invoice or purchase bill *

200 - Success - return response of type Invoices array with specified Invoices + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices getInvoice(UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceForHttpResponse(invoiceID); + public Invoices getInvoice(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceForHttpResponse(xeroTenantId, invoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getInvoiceForHttpResponse( UUID invoiceID) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoice"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5431,20 +5843,24 @@ public HttpResponse getInvoiceForHttpResponse( UUID invoiceID) throws IOExceptio /** * Allows you to retrieve invoices or purchase bills as PDF files *

200 - Success - return response of byte array pdf version of specified Invoices + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getInvoiceAsPdf(UUID invoiceID, String contentType) throws IOException { - HttpResponse response = getInvoiceAsPdfForHttpResponse(invoiceID, contentType); + public ByteArrayInputStream getInvoiceAsPdf(String xeroTenantId, UUID invoiceID, String contentType) throws IOException { + HttpResponse response = getInvoiceAsPdfForHttpResponse(xeroTenantId, invoiceID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getInvoiceAsPdfForHttpResponse( UUID invoiceID, String contentType) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceAsPdfForHttpResponse( String xeroTenantId, UUID invoiceID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAsPdf"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAsPdf"); }// verify the required parameter 'contentType' is set @@ -5452,7 +5868,7 @@ public HttpResponse getInvoiceAsPdfForHttpResponse( UUID invoiceID, String cont throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAsPdf"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5488,21 +5904,25 @@ public HttpResponse getInvoiceAsPdfForHttpResponse( UUID invoiceID, String cont /** * Allows you to retrieve Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of attachment for Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param fileName Name of the file you are attaching * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getInvoiceAttachmentByFileName(UUID invoiceID, String fileName, String contentType) throws IOException { - HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(invoiceID, fileName, contentType); + public ByteArrayInputStream getInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { + HttpResponse response = getInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( UUID invoiceID, String fileName, String contentType) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID invoiceID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -5513,7 +5933,7 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( UUID invoiceI throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5550,21 +5970,25 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( UUID invoiceI /** * Allows you to retrieve a specified Attachment on invoices or purchase bills by it's ID *

200 - Success - return response of attachment for Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param attachmentID Unique identifier for an Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getInvoiceAttachmentById(UUID invoiceID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(invoiceID, attachmentID, contentType); + public ByteArrayInputStream getInvoiceAttachmentById(String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getInvoiceAttachmentByIdForHttpResponse(xeroTenantId, invoiceID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getInvoiceAttachmentByIdForHttpResponse( UUID invoiceID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceAttachmentByIdForHttpResponse( String xeroTenantId, UUID invoiceID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachmentById"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -5575,7 +5999,7 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse( UUID invoiceID, UU throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getInvoiceAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5612,23 +6036,27 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse( UUID invoiceID, UU /** * Allows you to retrieve Attachments on invoices or purchase bills *

200 - Success - return response of type Attachments array of Attachments for specified Invoices + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getInvoiceAttachments(UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceAttachmentsForHttpResponse(invoiceID); + public Attachments getInvoiceAttachments(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceAttachmentsForHttpResponse(xeroTenantId, invoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getInvoiceAttachmentsForHttpResponse( UUID invoiceID) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceAttachmentsForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceAttachments"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5657,23 +6085,27 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse( UUID invoiceID) throws /** * Allows you to retrieve a history records of an invoice *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Invoice + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getInvoiceHistory(UUID invoiceID) throws IOException { - HttpResponse response = getInvoiceHistoryForHttpResponse(invoiceID); + public HistoryRecords getInvoiceHistory(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getInvoiceHistoryForHttpResponse(xeroTenantId, invoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getInvoiceHistoryForHttpResponse( UUID invoiceID) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse getInvoiceHistoryForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceHistory"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5702,19 +6134,23 @@ public HttpResponse getInvoiceHistoryForHttpResponse( UUID invoiceID) throws IOE /** * Allows you to retrieve invoice reminder settings *

200 - Success - return response of Invoice Reminders + * @param xeroTenantId Xero identifier for Tenant * @return InvoiceReminders * @throws IOException if an error occurs while attempting to invoke the API **/ - public InvoiceReminders getInvoiceReminders() throws IOException { - HttpResponse response = getInvoiceRemindersForHttpResponse(); + public InvoiceReminders getInvoiceReminders(String xeroTenantId) throws IOException { + HttpResponse response = getInvoiceRemindersForHttpResponse(xeroTenantId); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getInvoiceRemindersForHttpResponse() throws IOException { - + public HttpResponse getInvoiceRemindersForHttpResponse( String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoiceReminders"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5738,6 +6174,7 @@ public HttpResponse getInvoiceRemindersForHttpResponse() throws IOException { /** * Allows you to retrieve any sales invoices or purchase bills *

200 - Success - return response of type Invoices array with all Invoices + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -5752,16 +6189,19 @@ public HttpResponse getInvoiceRemindersForHttpResponse() throws IOException { * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices getInvoices(OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { - HttpResponse response = getInvoicesForHttpResponse(ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); + public Invoices getInvoices(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + HttpResponse response = getInvoicesForHttpResponse(xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getInvoicesForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { - + public HttpResponse getInvoicesForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5886,23 +6326,27 @@ public HttpResponse getInvoicesForHttpResponse( OffsetDateTime ifModifiedSince, /** * Allows you to retrieve a specified item *

200 - Success - return response of type Items array with specified Item + * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items getItem(UUID itemID) throws IOException { - HttpResponse response = getItemForHttpResponse(itemID); + public Items getItem(String xeroTenantId, UUID itemID) throws IOException { + HttpResponse response = getItemForHttpResponse(xeroTenantId, itemID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getItemForHttpResponse( UUID itemID) throws IOException { - // verify the required parameter 'itemID' is set + public HttpResponse getItemForHttpResponse( String xeroTenantId, UUID itemID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItem"); + }// verify the required parameter 'itemID' is set if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItem"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5931,23 +6375,27 @@ public HttpResponse getItemForHttpResponse( UUID itemID) throws IOException { /** * Allows you to retrieve history for items *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for specific Item + * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getItemHistory(UUID itemID) throws IOException { - HttpResponse response = getItemHistoryForHttpResponse(itemID); + public HistoryRecords getItemHistory(String xeroTenantId, UUID itemID) throws IOException { + HttpResponse response = getItemHistoryForHttpResponse(xeroTenantId, itemID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getItemHistoryForHttpResponse( UUID itemID) throws IOException { - // verify the required parameter 'itemID' is set + public HttpResponse getItemHistoryForHttpResponse( String xeroTenantId, UUID itemID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItemHistory"); + }// verify the required parameter 'itemID' is set if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling getItemHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -5976,6 +6424,7 @@ public HttpResponse getItemHistoryForHttpResponse( UUID itemID) throws IOExcepti /** * Allows you to retrieve any items *

200 - Success - return response of type Items array with all Item + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -5983,16 +6432,19 @@ public HttpResponse getItemHistoryForHttpResponse( UUID itemID) throws IOExcepti * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items getItems(OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - HttpResponse response = getItemsForHttpResponse(ifModifiedSince, where, order, unitdp); + public Items getItems(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpResponse response = getItemsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getItemsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - + public HttpResponse getItemsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getItems"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6047,23 +6499,27 @@ public HttpResponse getItemsForHttpResponse( OffsetDateTime ifModifiedSince, St /** * Allows you to retrieve a specified journals. *

200 - Success - return response of type Journals array with specified Journal + * @param xeroTenantId Xero identifier for Tenant * @param journalID Unique identifier for a Journal * @return Journals * @throws IOException if an error occurs while attempting to invoke the API **/ - public Journals getJournal(UUID journalID) throws IOException { - HttpResponse response = getJournalForHttpResponse(journalID); + public Journals getJournal(String xeroTenantId, UUID journalID) throws IOException { + HttpResponse response = getJournalForHttpResponse(xeroTenantId, journalID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getJournalForHttpResponse( UUID journalID) throws IOException { - // verify the required parameter 'journalID' is set + public HttpResponse getJournalForHttpResponse( String xeroTenantId, UUID journalID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournal"); + }// verify the required parameter 'journalID' is set if (journalID == null) { throw new IllegalArgumentException("Missing the required parameter 'journalID' when calling getJournal"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6092,22 +6548,26 @@ public HttpResponse getJournalForHttpResponse( UUID journalID) throws IOExceptio /** * Allows you to retrieve any journals. *

200 - Success - return response of type Journals array with all Journals + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned * @param paymentsOnly Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. * @return Journals * @throws IOException if an error occurs while attempting to invoke the API **/ - public Journals getJournals(OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { - HttpResponse response = getJournalsForHttpResponse(ifModifiedSince, offset, paymentsOnly); + public Journals getJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { + HttpResponse response = getJournalsForHttpResponse(xeroTenantId, ifModifiedSince, offset, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getJournalsForHttpResponse( OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { - + public HttpResponse getJournalsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, Integer offset, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getJournals"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6152,23 +6612,27 @@ public HttpResponse getJournalsForHttpResponse( OffsetDateTime ifModifiedSince, /** * Allows you to retrieve a specified linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with a specified LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactionID Unique identifier for a LinkedTransaction * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions getLinkedTransaction(UUID linkedTransactionID) throws IOException { - HttpResponse response = getLinkedTransactionForHttpResponse(linkedTransactionID); + public LinkedTransactions getLinkedTransaction(String xeroTenantId, UUID linkedTransactionID) throws IOException { + HttpResponse response = getLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getLinkedTransactionForHttpResponse( UUID linkedTransactionID) throws IOException { - // verify the required parameter 'linkedTransactionID' is set + public HttpResponse getLinkedTransactionForHttpResponse( String xeroTenantId, UUID linkedTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set if (linkedTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling getLinkedTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6197,6 +6661,7 @@ public HttpResponse getLinkedTransactionForHttpResponse( UUID linkedTransactionI /** * Retrieve linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with all LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant * @param page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. * @param linkedTransactionID The Xero identifier for an Linked Transaction * @param sourceTransactionID Filter by the SourceTransactionID. Get all the linked transactions created from a particular ACCPAY invoice @@ -6206,16 +6671,19 @@ public HttpResponse getLinkedTransactionForHttpResponse( UUID linkedTransactionI * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions getLinkedTransactions(Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { - HttpResponse response = getLinkedTransactionsForHttpResponse(page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); + public LinkedTransactions getLinkedTransactions(String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { + HttpResponse response = getLinkedTransactionsForHttpResponse(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getLinkedTransactionsForHttpResponse( Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { - + public HttpResponse getLinkedTransactionsForHttpResponse( String xeroTenantId, Integer page, String linkedTransactionID, String sourceTransactionID, String contactID, String status, String targetTransactionID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLinkedTransactions"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6300,23 +6768,27 @@ public HttpResponse getLinkedTransactionsForHttpResponse( Integer page, String /** * Allows you to retrieve a specified manual journals *

200 - Success - return response of type ManualJournals array with a specified ManualJournals + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals getManualJournal(UUID manualJournalID) throws IOException { - HttpResponse response = getManualJournalForHttpResponse(manualJournalID); + public ManualJournals getManualJournal(String xeroTenantId, UUID manualJournalID) throws IOException { + HttpResponse response = getManualJournalForHttpResponse(xeroTenantId, manualJournalID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getManualJournalForHttpResponse( UUID manualJournalID) throws IOException { - // verify the required parameter 'manualJournalID' is set + public HttpResponse getManualJournalForHttpResponse( String xeroTenantId, UUID manualJournalID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournal"); + }// verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournal"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6345,21 +6817,25 @@ public HttpResponse getManualJournalForHttpResponse( UUID manualJournalID) throw /** * Allows you to retrieve specified Attachment on ManualJournal by file name *

200 - Success - return response of attachment for Manual Journal as binary data + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param fileName The name of the file being attached to a ManualJournal * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getManualJournalAttachmentByFileName(UUID manualJournalID, String fileName, String contentType) throws IOException { - HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(manualJournalID, fileName, contentType); + public ByteArrayInputStream getManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { + HttpResponse response = getManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( UUID manualJournalID, String fileName, String contentType) throws IOException { - // verify the required parameter 'manualJournalID' is set + public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID manualJournalID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -6370,7 +6846,7 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( UUID ma throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6407,21 +6883,25 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( UUID ma /** * Allows you to retrieve specified Attachment on ManualJournals *

200 - Success - return response of attachment for Manual Journal as binary data + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getManualJournalAttachmentById(UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(manualJournalID, attachmentID, contentType); + public ByteArrayInputStream getManualJournalAttachmentById(String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getManualJournalAttachmentByIdForHttpResponse(xeroTenantId, manualJournalID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getManualJournalAttachmentByIdForHttpResponse( UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'manualJournalID' is set + public HttpResponse getManualJournalAttachmentByIdForHttpResponse( String xeroTenantId, UUID manualJournalID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachmentById"); + }// verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -6432,7 +6912,7 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse( UUID manualJo throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getManualJournalAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6469,23 +6949,27 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse( UUID manualJo /** * Allows you to retrieve Attachment for manual journals *

200 - Success - return response of type Attachments array with all Attachments for a ManualJournals + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getManualJournalAttachments(UUID manualJournalID) throws IOException { - HttpResponse response = getManualJournalAttachmentsForHttpResponse(manualJournalID); + public Attachments getManualJournalAttachments(String xeroTenantId, UUID manualJournalID) throws IOException { + HttpResponse response = getManualJournalAttachmentsForHttpResponse(xeroTenantId, manualJournalID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getManualJournalAttachmentsForHttpResponse( UUID manualJournalID) throws IOException { - // verify the required parameter 'manualJournalID' is set + public HttpResponse getManualJournalAttachmentsForHttpResponse( String xeroTenantId, UUID manualJournalID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournalAttachments"); + }// verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling getManualJournalAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6514,6 +6998,7 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse( UUID manualJourn /** * Allows you to retrieve any manual journals *

200 - Success - return response of type ManualJournals array with a all ManualJournals + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -6521,16 +7006,19 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse( UUID manualJourn * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals getManualJournals(OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - HttpResponse response = getManualJournalsForHttpResponse(ifModifiedSince, where, order, page); + public ManualJournals getManualJournals(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + HttpResponse response = getManualJournalsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getManualJournalsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { - + public HttpResponse getManualJournalsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getManualJournals"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6585,23 +7073,27 @@ public HttpResponse getManualJournalsForHttpResponse( OffsetDateTime ifModifiedS /** * Allows you to retrieve a URL to an online invoice *

200 - Success - return response of type OnlineInvoice array with one OnlineInvoice + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @return OnlineInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public OnlineInvoices getOnlineInvoice(UUID invoiceID) throws IOException { - HttpResponse response = getOnlineInvoiceForHttpResponse(invoiceID); + public OnlineInvoices getOnlineInvoice(String xeroTenantId, UUID invoiceID) throws IOException { + HttpResponse response = getOnlineInvoiceForHttpResponse(xeroTenantId, invoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOnlineInvoiceForHttpResponse( UUID invoiceID) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse getOnlineInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOnlineInvoice"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling getOnlineInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6630,23 +7122,27 @@ public HttpResponse getOnlineInvoiceForHttpResponse( UUID invoiceID) throws IOEx /** * Allows you To verify if an organisation is using contruction industry scheme, you can retrieve the CIS settings for the organistaion. *

200 - Success - return response of type Organisation array with specified Organisation + * @param xeroTenantId Xero identifier for Tenant * @param organisationID The organisationID parameter * @return CISOrgSetting * @throws IOException if an error occurs while attempting to invoke the API **/ - public CISOrgSetting getOrganisationCISSettings(UUID organisationID) throws IOException { - HttpResponse response = getOrganisationCISSettingsForHttpResponse(organisationID); + public CISOrgSetting getOrganisationCISSettings(String xeroTenantId, UUID organisationID) throws IOException { + HttpResponse response = getOrganisationCISSettingsForHttpResponse(xeroTenantId, organisationID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOrganisationCISSettingsForHttpResponse( UUID organisationID) throws IOException { - // verify the required parameter 'organisationID' is set + public HttpResponse getOrganisationCISSettingsForHttpResponse( String xeroTenantId, UUID organisationID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisationCISSettings"); + }// verify the required parameter 'organisationID' is set if (organisationID == null) { throw new IllegalArgumentException("Missing the required parameter 'organisationID' when calling getOrganisationCISSettings"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6675,19 +7171,23 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse( UUID organisation /** * Allows you to retrieve Organisation details *

200 - Success - return response of type Organisation array with all Organisation + * @param xeroTenantId Xero identifier for Tenant * @return Organisations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Organisations getOrganisations() throws IOException { - HttpResponse response = getOrganisationsForHttpResponse(); + public Organisations getOrganisations(String xeroTenantId) throws IOException { + HttpResponse response = getOrganisationsForHttpResponse(xeroTenantId); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOrganisationsForHttpResponse() throws IOException { - + public HttpResponse getOrganisationsForHttpResponse( String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOrganisations"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6711,23 +7211,27 @@ public HttpResponse getOrganisationsForHttpResponse() throws IOException { /** * Allows you to retrieve a specified overpayments *

200 - Success - return response of type Overpayments array with specified Overpayments + * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment * @return Overpayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Overpayments getOverpayment(UUID overpaymentID) throws IOException { - HttpResponse response = getOverpaymentForHttpResponse(overpaymentID); + public Overpayments getOverpayment(String xeroTenantId, UUID overpaymentID) throws IOException { + HttpResponse response = getOverpaymentForHttpResponse(xeroTenantId, overpaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOverpaymentForHttpResponse( UUID overpaymentID) throws IOException { - // verify the required parameter 'overpaymentID' is set + public HttpResponse getOverpaymentForHttpResponse( String xeroTenantId, UUID overpaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayment"); + }// verify the required parameter 'overpaymentID' is set if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6756,23 +7260,27 @@ public HttpResponse getOverpaymentForHttpResponse( UUID overpaymentID) throws IO /** * Allows you to retrieve a history records of an Overpayment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Overpayments + * @param xeroTenantId Xero identifier for Tenant * @param overpaymentID Unique identifier for a Overpayment * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getOverpaymentHistory(UUID overpaymentID) throws IOException { - HttpResponse response = getOverpaymentHistoryForHttpResponse(overpaymentID); + public HistoryRecords getOverpaymentHistory(String xeroTenantId, UUID overpaymentID) throws IOException { + HttpResponse response = getOverpaymentHistoryForHttpResponse(xeroTenantId, overpaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOverpaymentHistoryForHttpResponse( UUID overpaymentID) throws IOException { - // verify the required parameter 'overpaymentID' is set + public HttpResponse getOverpaymentHistoryForHttpResponse( String xeroTenantId, UUID overpaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpaymentHistory"); + }// verify the required parameter 'overpaymentID' is set if (overpaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling getOverpaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6801,6 +7309,7 @@ public HttpResponse getOverpaymentHistoryForHttpResponse( UUID overpaymentID) th /** * Allows you to retrieve overpayments *

200 - Success - return response of type Overpayments array with all Overpayments + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -6809,16 +7318,19 @@ public HttpResponse getOverpaymentHistoryForHttpResponse( UUID overpaymentID) th * @return Overpayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Overpayments getOverpayments(OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getOverpaymentsForHttpResponse(ifModifiedSince, where, order, page, unitdp); + public Overpayments getOverpayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getOverpaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getOverpaymentsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - + public HttpResponse getOverpaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getOverpayments"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6883,23 +7395,27 @@ public HttpResponse getOverpaymentsForHttpResponse( OffsetDateTime ifModifiedSin /** * Allows you to retrieve a specified payment for invoices and credit notes *

200 - Success - return response of type Payments array for specified Payment + * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments getPayment(UUID paymentID) throws IOException { - HttpResponse response = getPaymentForHttpResponse(paymentID); + public Payments getPayment(String xeroTenantId, UUID paymentID) throws IOException { + HttpResponse response = getPaymentForHttpResponse(xeroTenantId, paymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPaymentForHttpResponse( UUID paymentID) throws IOException { - // verify the required parameter 'paymentID' is set + public HttpResponse getPaymentForHttpResponse( String xeroTenantId, UUID paymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayment"); + }// verify the required parameter 'paymentID' is set if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6928,23 +7444,27 @@ public HttpResponse getPaymentForHttpResponse( UUID paymentID) throws IOExceptio /** * Allows you to retrieve history records of a payment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for Payments + * @param xeroTenantId Xero identifier for Tenant * @param paymentID Unique identifier for a Payment * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPaymentHistory(UUID paymentID) throws IOException { - HttpResponse response = getPaymentHistoryForHttpResponse(paymentID); + public HistoryRecords getPaymentHistory(String xeroTenantId, UUID paymentID) throws IOException { + HttpResponse response = getPaymentHistoryForHttpResponse(xeroTenantId, paymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPaymentHistoryForHttpResponse( UUID paymentID) throws IOException { - // verify the required parameter 'paymentID' is set + public HttpResponse getPaymentHistoryForHttpResponse( String xeroTenantId, UUID paymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentHistory"); + }// verify the required parameter 'paymentID' is set if (paymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling getPaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -6973,19 +7493,23 @@ public HttpResponse getPaymentHistoryForHttpResponse( UUID paymentID) throws IOE /** * Allows you to retrieve payment services *

200 - Success - return response of type PaymentServices array for all PaymentService + * @param xeroTenantId Xero identifier for Tenant * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices getPaymentServices() throws IOException { - HttpResponse response = getPaymentServicesForHttpResponse(); + public PaymentServices getPaymentServices(String xeroTenantId) throws IOException { + HttpResponse response = getPaymentServicesForHttpResponse(xeroTenantId); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPaymentServicesForHttpResponse() throws IOException { - + public HttpResponse getPaymentServicesForHttpResponse( String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPaymentServices"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7009,22 +7533,26 @@ public HttpResponse getPaymentServicesForHttpResponse() throws IOException { /** * Allows you to retrieve payments for invoices and credit notes *

200 - Success - return response of type Payments array for all Payments + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments getPayments(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getPaymentsForHttpResponse(ifModifiedSince, where, order); + public Payments getPayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getPaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPaymentsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - + public HttpResponse getPaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7069,23 +7597,27 @@ public HttpResponse getPaymentsForHttpResponse( OffsetDateTime ifModifiedSince, /** * Allows you to retrieve a specified prepayments *

200 - Success - return response of type Prepayments array for a specified Prepayment + * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID Unique identifier for a PrePayment * @return Prepayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Prepayments getPrepayment(UUID prepaymentID) throws IOException { - HttpResponse response = getPrepaymentForHttpResponse(prepaymentID); + public Prepayments getPrepayment(String xeroTenantId, UUID prepaymentID) throws IOException { + HttpResponse response = getPrepaymentForHttpResponse(xeroTenantId, prepaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPrepaymentForHttpResponse( UUID prepaymentID) throws IOException { - // verify the required parameter 'prepaymentID' is set + public HttpResponse getPrepaymentForHttpResponse( String xeroTenantId, UUID prepaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayment"); + }// verify the required parameter 'prepaymentID' is set if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepayment"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7114,23 +7646,27 @@ public HttpResponse getPrepaymentForHttpResponse( UUID prepaymentID) throws IOEx /** * Allows you to retrieve a history records of an Prepayment *

200 - Success - return response of type HistoryRecords array with all HistoryRecord for PrePayment + * @param xeroTenantId Xero identifier for Tenant * @param prepaymentID Unique identifier for a PrePayment * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPrepaymentHistory(UUID prepaymentID) throws IOException { - HttpResponse response = getPrepaymentHistoryForHttpResponse(prepaymentID); + public HistoryRecords getPrepaymentHistory(String xeroTenantId, UUID prepaymentID) throws IOException { + HttpResponse response = getPrepaymentHistoryForHttpResponse(xeroTenantId, prepaymentID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPrepaymentHistoryForHttpResponse( UUID prepaymentID) throws IOException { - // verify the required parameter 'prepaymentID' is set + public HttpResponse getPrepaymentHistoryForHttpResponse( String xeroTenantId, UUID prepaymentID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepaymentHistory"); + }// verify the required parameter 'prepaymentID' is set if (prepaymentID == null) { throw new IllegalArgumentException("Missing the required parameter 'prepaymentID' when calling getPrepaymentHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7159,6 +7695,7 @@ public HttpResponse getPrepaymentHistoryForHttpResponse( UUID prepaymentID) thro /** * Allows you to retrieve prepayments *

200 - Success - return response of type Prepayments array for all Prepayment + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -7167,16 +7704,19 @@ public HttpResponse getPrepaymentHistoryForHttpResponse( UUID prepaymentID) thro * @return Prepayments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Prepayments getPrepayments(OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - HttpResponse response = getPrepaymentsForHttpResponse(ifModifiedSince, where, order, page, unitdp); + public Prepayments getPrepayments(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + HttpResponse response = getPrepaymentsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, page, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPrepaymentsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { - + public HttpResponse getPrepaymentsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPrepayments"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7241,23 +7781,27 @@ public HttpResponse getPrepaymentsForHttpResponse( OffsetDateTime ifModifiedSinc /** * Allows you to retrieve a specified purchase orders *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders getPurchaseOrder(UUID purchaseOrderID) throws IOException { - HttpResponse response = getPurchaseOrderForHttpResponse(purchaseOrderID); + public PurchaseOrders getPurchaseOrder(String xeroTenantId, UUID purchaseOrderID) throws IOException { + HttpResponse response = getPurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPurchaseOrderForHttpResponse( UUID purchaseOrderID) throws IOException { - // verify the required parameter 'purchaseOrderID' is set + public HttpResponse getPurchaseOrderForHttpResponse( String xeroTenantId, UUID purchaseOrderID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrder"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7286,23 +7830,27 @@ public HttpResponse getPurchaseOrderForHttpResponse( UUID purchaseOrderID) throw /** * Allows you to retrieve history for PurchaseOrder *

200 - Success - return response of type HistoryRecords array for all HistoryRecord for PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getPurchaseOrderHistory(UUID purchaseOrderID) throws IOException { - HttpResponse response = getPurchaseOrderHistoryForHttpResponse(purchaseOrderID); + public HistoryRecords getPurchaseOrderHistory(String xeroTenantId, UUID purchaseOrderID) throws IOException { + HttpResponse response = getPurchaseOrderHistoryForHttpResponse(xeroTenantId, purchaseOrderID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPurchaseOrderHistoryForHttpResponse( UUID purchaseOrderID) throws IOException { - // verify the required parameter 'purchaseOrderID' is set + public HttpResponse getPurchaseOrderHistoryForHttpResponse( String xeroTenantId, UUID purchaseOrderID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderHistory"); + }// verify the required parameter 'purchaseOrderID' is set if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7331,6 +7879,7 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse( UUID purchaseOrderID /** * Allows you to retrieve purchase orders *

200 - Success - return response of type PurchaseOrder array of all PurchaseOrder + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param status Filter by purchase order status * @param dateFrom Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 @@ -7340,16 +7889,19 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse( UUID purchaseOrderID * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders getPurchaseOrders(OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { - HttpResponse response = getPurchaseOrdersForHttpResponse(ifModifiedSince, status, dateFrom, dateTo, order, page); + public PurchaseOrders getPurchaseOrders(String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { + HttpResponse response = getPurchaseOrdersForHttpResponse(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getPurchaseOrdersForHttpResponse( OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { - + public HttpResponse getPurchaseOrdersForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String status, String dateFrom, String dateTo, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrders"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7424,23 +7976,27 @@ public HttpResponse getPurchaseOrdersForHttpResponse( OffsetDateTime ifModifiedS /** * Allows you to retrieve a specified draft expense claim receipts *

200 - Success - return response of type Receipts array for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts getReceipt(UUID receiptID) throws IOException { - HttpResponse response = getReceiptForHttpResponse(receiptID); + public Receipts getReceipt(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptForHttpResponse(xeroTenantId, receiptID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReceiptForHttpResponse( UUID receiptID) throws IOException { - // verify the required parameter 'receiptID' is set + public HttpResponse getReceiptForHttpResponse( String xeroTenantId, UUID receiptID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipt"); + }// verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceipt"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7469,21 +8025,25 @@ public HttpResponse getReceiptForHttpResponse( UUID receiptID) throws IOExceptio /** * Allows you to retrieve Attachments on expense claim receipts by file name *

200 - Success - return response of attachment for Receipt as binary data + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param fileName The name of the file being attached to the Receipt * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getReceiptAttachmentByFileName(UUID receiptID, String fileName, String contentType) throws IOException { - HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(receiptID, fileName, contentType); + public ByteArrayInputStream getReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { + HttpResponse response = getReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( UUID receiptID, String fileName, String contentType) throws IOException { - // verify the required parameter 'receiptID' is set + public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID receiptID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -7494,7 +8054,7 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( UUID receiptI throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7531,21 +8091,25 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( UUID receiptI /** * Allows you to retrieve Attachments on expense claim receipts by ID *

200 - Success - return response of attachment for Receipt as binary data + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getReceiptAttachmentById(UUID receiptID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getReceiptAttachmentByIdForHttpResponse(receiptID, attachmentID, contentType); + public ByteArrayInputStream getReceiptAttachmentById(String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getReceiptAttachmentByIdForHttpResponse(xeroTenantId, receiptID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getReceiptAttachmentByIdForHttpResponse( UUID receiptID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'receiptID' is set + public HttpResponse getReceiptAttachmentByIdForHttpResponse( String xeroTenantId, UUID receiptID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachmentById"); + }// verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -7556,7 +8120,7 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse( UUID receiptID, UU throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getReceiptAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7593,23 +8157,27 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse( UUID receiptID, UU /** * Allows you to retrieve Attachments for expense claim receipts *

200 - Success - return response of type Attachments array of Attachments for a specified Receipt + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getReceiptAttachments(UUID receiptID) throws IOException { - HttpResponse response = getReceiptAttachmentsForHttpResponse(receiptID); + public Attachments getReceiptAttachments(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptAttachmentsForHttpResponse(xeroTenantId, receiptID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReceiptAttachmentsForHttpResponse( UUID receiptID) throws IOException { - // verify the required parameter 'receiptID' is set + public HttpResponse getReceiptAttachmentsForHttpResponse( String xeroTenantId, UUID receiptID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptAttachments"); + }// verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7638,23 +8206,27 @@ public HttpResponse getReceiptAttachmentsForHttpResponse( UUID receiptID) throws /** * Allows you to retrieve a history records of an Receipt *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Receipt + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getReceiptHistory(UUID receiptID) throws IOException { - HttpResponse response = getReceiptHistoryForHttpResponse(receiptID); + public HistoryRecords getReceiptHistory(String xeroTenantId, UUID receiptID) throws IOException { + HttpResponse response = getReceiptHistoryForHttpResponse(xeroTenantId, receiptID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReceiptHistoryForHttpResponse( UUID receiptID) throws IOException { - // verify the required parameter 'receiptID' is set + public HttpResponse getReceiptHistoryForHttpResponse( String xeroTenantId, UUID receiptID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceiptHistory"); + }// verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling getReceiptHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7683,6 +8255,7 @@ public HttpResponse getReceiptHistoryForHttpResponse( UUID receiptID) throws IOE /** * Allows you to retrieve draft expense claim receipts for any user *

200 - Success - return response of type Receipts array for all Receipt + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element @@ -7690,16 +8263,19 @@ public HttpResponse getReceiptHistoryForHttpResponse( UUID receiptID) throws IOE * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts getReceipts(OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - HttpResponse response = getReceiptsForHttpResponse(ifModifiedSince, where, order, unitdp); + public Receipts getReceipts(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + HttpResponse response = getReceiptsForHttpResponse(xeroTenantId, ifModifiedSince, where, order, unitdp); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReceiptsForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { - + public HttpResponse getReceiptsForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer unitdp) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReceipts"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7754,23 +8330,27 @@ public HttpResponse getReceiptsForHttpResponse( OffsetDateTime ifModifiedSince, /** * Allows you to retrieve a specified repeating invoice *

200 - Success - return response of type Repeating Invoices array with a specified Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public RepeatingInvoices getRepeatingInvoice(UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceForHttpResponse(repeatingInvoiceID); + public RepeatingInvoices getRepeatingInvoice(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceForHttpResponse(xeroTenantId, repeatingInvoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getRepeatingInvoiceForHttpResponse( UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse getRepeatingInvoiceForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoice"); + }// verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7799,21 +8379,25 @@ public HttpResponse getRepeatingInvoiceForHttpResponse( UUID repeatingInvoiceID) /** * Allows you to retrieve specified attachment on repeating invoices by file name *

200 - Success - return response of attachment for Repeating Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param fileName The name of the file being attached to a Repeating Invoice * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getRepeatingInvoiceAttachmentByFileName(UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(repeatingInvoiceID, fileName, contentType); + public ByteArrayInputStream getRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { - // verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, String fileName, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -7824,7 +8408,7 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( UUID throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7861,21 +8445,25 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( UUID /** * Allows you to retrieve a specified Attachments on repeating invoices *

200 - Success - return response of attachment for Repeating Invoice as binary data + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param attachmentID Unique identifier for a Attachment * @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf * @return File * @throws IOException if an error occurs while attempting to invoke the API **/ - public ByteArrayInputStream getRepeatingInvoiceAttachmentById(UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(repeatingInvoiceID, attachmentID, contentType); + public ByteArrayInputStream getRepeatingInvoiceAttachmentById(String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentByIdForHttpResponse(xeroTenantId, repeatingInvoiceID, attachmentID, contentType); InputStream is = response.getContent(); return convertInputToByteArray(is); - + } - public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { - // verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, UUID attachmentID, String contentType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachmentById"); + }// verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachmentById"); }// verify the required parameter 'attachmentID' is set @@ -7886,7 +8474,7 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( UUID repea throw new IllegalArgumentException("Missing the required parameter 'contentType' when calling getRepeatingInvoiceAttachmentById"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7923,23 +8511,27 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( UUID repea /** * Allows you to retrieve Attachments on repeating invoice *

200 - Success - return response of type Attachments array with all Attachments for a specified Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments getRepeatingInvoiceAttachments(UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(repeatingInvoiceID); + public Attachments getRepeatingInvoiceAttachments(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceAttachmentsForHttpResponse(xeroTenantId, repeatingInvoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceAttachments"); + }// verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceAttachments"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -7968,23 +8560,27 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( UUID repeatin /** * Allows you to retrieve history for a repeating invoice *

200 - Success - return response of type HistoryRecords array of all HistoryRecord for Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords getRepeatingInvoiceHistory(UUID repeatingInvoiceID) throws IOException { - HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(repeatingInvoiceID); + public HistoryRecords getRepeatingInvoiceHistory(String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + HttpResponse response = getRepeatingInvoiceHistoryForHttpResponse(xeroTenantId, repeatingInvoiceID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( UUID repeatingInvoiceID) throws IOException { - // verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoiceHistory"); + }// verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling getRepeatingInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8013,21 +8609,25 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( UUID repeatingInv /** * Allows you to retrieve any repeating invoices *

200 - Success - return response of type Repeating Invoices array for all Repeating Invoice + * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public RepeatingInvoices getRepeatingInvoices(String where, String order) throws IOException { - HttpResponse response = getRepeatingInvoicesForHttpResponse(where, order); + public RepeatingInvoices getRepeatingInvoices(String xeroTenantId, String where, String order) throws IOException { + HttpResponse response = getRepeatingInvoicesForHttpResponse(xeroTenantId, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getRepeatingInvoicesForHttpResponse( String where, String order) throws IOException { - + public HttpResponse getRepeatingInvoicesForHttpResponse( String xeroTenantId, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getRepeatingInvoices"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8072,6 +8672,7 @@ public HttpResponse getRepeatingInvoicesForHttpResponse( String where, String o /** * Allows you to retrieve report for AgedPayablesByContact *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param contactId Unique identifier for a Contact * @param date The date of the Aged Payables By Contact report * @param fromDate The from date of the Aged Payables By Contact report @@ -8079,19 +8680,22 @@ public HttpResponse getRepeatingInvoicesForHttpResponse( String where, String o * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportAgedPayablesByContact(UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - HttpResponse response = getReportAgedPayablesByContactForHttpResponse(contactId, date, fromDate, toDate); + public ReportWithRows getReportAgedPayablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + HttpResponse response = getReportAgedPayablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportAgedPayablesByContactForHttpResponse( UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - // verify the required parameter 'contactId' is set + public HttpResponse getReportAgedPayablesByContactForHttpResponse( String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedPayablesByContact"); + }// verify the required parameter 'contactId' is set if (contactId == null) { throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedPayablesByContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8156,6 +8760,7 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse( UUID contactI /** * Allows you to retrieve report for AgedReceivablesByContact *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param contactId Unique identifier for a Contact * @param date The date of the Aged Receivables By Contact report * @param fromDate The from date of the Aged Receivables By Contact report @@ -8163,19 +8768,22 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse( UUID contactI * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportAgedReceivablesByContact(UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(contactId, date, fromDate, toDate); + public ReportWithRows getReportAgedReceivablesByContact(String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + HttpResponse response = getReportAgedReceivablesByContactForHttpResponse(xeroTenantId, contactId, date, fromDate, toDate); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportAgedReceivablesByContactForHttpResponse( UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { - // verify the required parameter 'contactId' is set + public HttpResponse getReportAgedReceivablesByContactForHttpResponse( String xeroTenantId, UUID contactId, LocalDate date, LocalDate fromDate, LocalDate toDate) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportAgedReceivablesByContact"); + }// verify the required parameter 'contactId' is set if (contactId == null) { throw new IllegalArgumentException("Missing the required parameter 'contactId' when calling getReportAgedReceivablesByContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8240,23 +8848,27 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse( UUID conta /** * Allows you to retrieve report for BAS only valid for AU orgs *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param reportID Unique identifier for a Report * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBASorGST(String reportID) throws IOException { - HttpResponse response = getReportBASorGSTForHttpResponse(reportID); + public ReportWithRows getReportBASorGST(String xeroTenantId, String reportID) throws IOException { + HttpResponse response = getReportBASorGSTForHttpResponse(xeroTenantId, reportID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportBASorGSTForHttpResponse( String reportID) throws IOException { - // verify the required parameter 'reportID' is set + public HttpResponse getReportBASorGSTForHttpResponse( String xeroTenantId, String reportID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGST"); + }// verify the required parameter 'reportID' is set if (reportID == null) { throw new IllegalArgumentException("Missing the required parameter 'reportID' when calling getReportBASorGST"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8285,19 +8897,23 @@ public HttpResponse getReportBASorGSTForHttpResponse( String reportID) throws IO /** * Allows you to retrieve report for BAS only valid for AU orgs *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBASorGSTList() throws IOException { - HttpResponse response = getReportBASorGSTListForHttpResponse(); + public ReportWithRows getReportBASorGSTList(String xeroTenantId) throws IOException { + HttpResponse response = getReportBASorGSTListForHttpResponse(xeroTenantId); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportBASorGSTListForHttpResponse() throws IOException { - + public HttpResponse getReportBASorGSTListForHttpResponse( String xeroTenantId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBASorGSTList"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8321,6 +8937,7 @@ public HttpResponse getReportBASorGSTListForHttpResponse() throws IOException { /** * Allows you to retrieve report for BalanceSheet *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param date The date of the Balance Sheet report * @param periods The number of periods for the Balance Sheet report * @param timeframe The period size to compare to (MONTH, QUARTER, YEAR) @@ -8331,16 +8948,19 @@ public HttpResponse getReportBASorGSTListForHttpResponse() throws IOException { * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBalanceSheet(String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportBalanceSheetForHttpResponse(date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); + public ReportWithRows getReportBalanceSheet(String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportBalanceSheetForHttpResponse(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportBalanceSheetForHttpResponse( String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - + public HttpResponse getReportBalanceSheetForHttpResponse( String xeroTenantId, String date, Integer periods, String timeframe, String trackingOptionID1, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBalanceSheet"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8435,22 +9055,26 @@ public HttpResponse getReportBalanceSheetForHttpResponse( String date, Integer /** * Allows you to retrieve report for BankSummary *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Bank Summary report e.g. 2018-03-31 * @param period The number of periods to compare (integer between 1 and 12) * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBankSummary(LocalDate date, Integer period, Integer timeframe) throws IOException { - HttpResponse response = getReportBankSummaryForHttpResponse(date, period, timeframe); + public ReportWithRows getReportBankSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpResponse response = getReportBankSummaryForHttpResponse(xeroTenantId, date, period, timeframe); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportBankSummaryForHttpResponse( LocalDate date, Integer period, Integer timeframe) throws IOException { - + public HttpResponse getReportBankSummaryForHttpResponse( String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8505,22 +9129,26 @@ public HttpResponse getReportBankSummaryForHttpResponse( LocalDate date, Intege /** * Allows you to retrieve report for Budget Summary *

200 - success- return a Report with Rows object + * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Bank Summary report e.g. 2018-03-31 * @param period The number of periods to compare (integer between 1 and 12) * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year) * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportBudgetSummary(LocalDate date, Integer period, Integer timeframe) throws IOException { - HttpResponse response = getReportBudgetSummaryForHttpResponse(date, period, timeframe); + public ReportWithRows getReportBudgetSummary(String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + HttpResponse response = getReportBudgetSummaryForHttpResponse(xeroTenantId, date, period, timeframe); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportBudgetSummaryForHttpResponse( LocalDate date, Integer period, Integer timeframe) throws IOException { - + public HttpResponse getReportBudgetSummaryForHttpResponse( String xeroTenantId, LocalDate date, Integer period, Integer timeframe) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBudgetSummary"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8575,20 +9203,24 @@ public HttpResponse getReportBudgetSummaryForHttpResponse( LocalDate date, Inte /** * Allows you to retrieve report for ExecutiveSummary *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Bank Summary report e.g. 2018-03-31 * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportExecutiveSummary(LocalDate date) throws IOException { - HttpResponse response = getReportExecutiveSummaryForHttpResponse(date); + public ReportWithRows getReportExecutiveSummary(String xeroTenantId, LocalDate date) throws IOException { + HttpResponse response = getReportExecutiveSummaryForHttpResponse(xeroTenantId, date); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportExecutiveSummaryForHttpResponse( LocalDate date) throws IOException { - + public HttpResponse getReportExecutiveSummaryForHttpResponse( String xeroTenantId, LocalDate date) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportExecutiveSummary"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8623,6 +9255,7 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse( LocalDate date) th /** * Allows you to retrieve report for ProfitAndLoss *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param fromDate The from date for the ProfitAndLoss report e.g. 2018-03-31 * @param toDate The to date for the ProfitAndLoss report e.g. 2018-03-31 * @param periods The number of periods to compare (integer between 1 and 12) @@ -8636,16 +9269,19 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse( LocalDate date) th * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportProfitAndLoss(LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportProfitAndLossForHttpResponse(fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); + public ReportWithRows getReportProfitAndLoss(String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportProfitAndLossForHttpResponse(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportProfitAndLossForHttpResponse( LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { - + public HttpResponse getReportProfitAndLossForHttpResponse( String xeroTenantId, LocalDate fromDate, LocalDate toDate, Integer periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportProfitAndLoss"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8770,20 +9406,24 @@ public HttpResponse getReportProfitAndLossForHttpResponse( LocalDate fromDate, /** * Allows you to retrieve report for TenNinetyNine *

200 - Success - return response of type Reports + * @param xeroTenantId Xero identifier for Tenant * @param reportYear The year of the 1099 report * @return Reports * @throws IOException if an error occurs while attempting to invoke the API **/ - public Reports getReportTenNinetyNine(String reportYear) throws IOException { - HttpResponse response = getReportTenNinetyNineForHttpResponse(reportYear); + public Reports getReportTenNinetyNine(String xeroTenantId, String reportYear) throws IOException { + HttpResponse response = getReportTenNinetyNineForHttpResponse(xeroTenantId, reportYear); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportTenNinetyNineForHttpResponse( String reportYear) throws IOException { - + public HttpResponse getReportTenNinetyNineForHttpResponse( String xeroTenantId, String reportYear) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTenNinetyNine"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8818,21 +9458,25 @@ public HttpResponse getReportTenNinetyNineForHttpResponse( String reportYear) th /** * Allows you to retrieve report for TrialBalance *

200 - Success - return response of type ReportWithRows + * @param xeroTenantId Xero identifier for Tenant * @param date The date for the Trial Balance report e.g. 2018-03-31 * @param paymentsOnly Return cash only basis for the Trial Balance report * @return ReportWithRows * @throws IOException if an error occurs while attempting to invoke the API **/ - public ReportWithRows getReportTrialBalance(LocalDate date, Boolean paymentsOnly) throws IOException { - HttpResponse response = getReportTrialBalanceForHttpResponse(date, paymentsOnly); + public ReportWithRows getReportTrialBalance(String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { + HttpResponse response = getReportTrialBalanceForHttpResponse(xeroTenantId, date, paymentsOnly); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getReportTrialBalanceForHttpResponse( LocalDate date, Boolean paymentsOnly) throws IOException { - + public HttpResponse getReportTrialBalanceForHttpResponse( String xeroTenantId, LocalDate date, Boolean paymentsOnly) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportTrialBalance"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8877,22 +9521,26 @@ public HttpResponse getReportTrialBalanceForHttpResponse( LocalDate date, Boole /** * Allows you to retrieve Tax Rates *

200 - Success - return response of type TaxRates array with TaxRates + * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @param taxType Filter by tax type * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates getTaxRates(String where, String order, String taxType) throws IOException { - HttpResponse response = getTaxRatesForHttpResponse(where, order, taxType); + public TaxRates getTaxRates(String xeroTenantId, String where, String order, String taxType) throws IOException { + HttpResponse response = getTaxRatesForHttpResponse(xeroTenantId, where, order, taxType); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getTaxRatesForHttpResponse( String where, String order, String taxType) throws IOException { - + public HttpResponse getTaxRatesForHttpResponse( String xeroTenantId, String where, String order, String taxType) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTaxRates"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -8947,22 +9595,26 @@ public HttpResponse getTaxRatesForHttpResponse( String where, String order, St /** * Allows you to retrieve tracking categories and options *

200 - Success - return response of type TrackingCategories array of TrackingCategory + * @param xeroTenantId Xero identifier for Tenant * @param where Filter by an any element * @param order Order by an any element * @param includeArchived e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories getTrackingCategories(String where, String order, Boolean includeArchived) throws IOException { - HttpResponse response = getTrackingCategoriesForHttpResponse(where, order, includeArchived); + public TrackingCategories getTrackingCategories(String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { + HttpResponse response = getTrackingCategoriesForHttpResponse(xeroTenantId, where, order, includeArchived); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getTrackingCategoriesForHttpResponse( String where, String order, Boolean includeArchived) throws IOException { - + public HttpResponse getTrackingCategoriesForHttpResponse( String xeroTenantId, String where, String order, Boolean includeArchived) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9017,23 +9669,27 @@ public HttpResponse getTrackingCategoriesForHttpResponse( String where, String /** * Allows you to retrieve tracking categories and options for specified category *

200 - Success - return response of type TrackingCategories array of specified TrackingCategory + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories getTrackingCategory(UUID trackingCategoryID) throws IOException { - HttpResponse response = getTrackingCategoryForHttpResponse(trackingCategoryID); + public TrackingCategories getTrackingCategory(String xeroTenantId, UUID trackingCategoryID) throws IOException { + HttpResponse response = getTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getTrackingCategoryForHttpResponse( UUID trackingCategoryID) throws IOException { - // verify the required parameter 'trackingCategoryID' is set + public HttpResponse getTrackingCategoryForHttpResponse( String xeroTenantId, UUID trackingCategoryID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling getTrackingCategory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9062,23 +9718,27 @@ public HttpResponse getTrackingCategoryForHttpResponse( UUID trackingCategoryID) /** * Allows you to retrieve a specified user *

200 - Success - return response of type Users array of specified User + * @param xeroTenantId Xero identifier for Tenant * @param userID Unique identifier for a User * @return Users * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUser(UUID userID) throws IOException { - HttpResponse response = getUserForHttpResponse(userID); + public Users getUser(String xeroTenantId, UUID userID) throws IOException { + HttpResponse response = getUserForHttpResponse(xeroTenantId, userID); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getUserForHttpResponse( UUID userID) throws IOException { - // verify the required parameter 'userID' is set + public HttpResponse getUserForHttpResponse( String xeroTenantId, UUID userID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUser"); + }// verify the required parameter 'userID' is set if (userID == null) { throw new IllegalArgumentException("Missing the required parameter 'userID' when calling getUser"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9107,22 +9767,26 @@ public HttpResponse getUserForHttpResponse( UUID userID) throws IOException { /** * Allows you to retrieve users *

200 - Success - return response of type Users array of all User + * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element * @return Users * @throws IOException if an error occurs while attempting to invoke the API **/ - public Users getUsers(OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - HttpResponse response = getUsersForHttpResponse(ifModifiedSince, where, order); + public Users getUsers(String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + HttpResponse response = getUsersForHttpResponse(xeroTenantId, ifModifiedSince, where, order); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getUsersForHttpResponse( OffsetDateTime ifModifiedSince, String where, String order) throws IOException { - + public HttpResponse getUsersForHttpResponse( String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getUsers"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9168,19 +9832,23 @@ public HttpResponse getUsersForHttpResponse( OffsetDateTime ifModifiedSince, St * Allows you to update a chart of accounts *

200 - Success - update existing Account and return response of type Accounts array with updated Account *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for retrieving single object * @param accounts Request of type Accounts array with one Account * @return Accounts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Accounts updateAccount(UUID accountID, Accounts accounts) throws IOException { - HttpResponse response = updateAccountForHttpResponse(accountID, accounts); + public Accounts updateAccount(String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { + HttpResponse response = updateAccountForHttpResponse(xeroTenantId, accountID, accounts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateAccountForHttpResponse( UUID accountID, Accounts accounts) throws IOException { - // verify the required parameter 'accountID' is set + public HttpResponse updateAccountForHttpResponse( String xeroTenantId, UUID accountID, Accounts accounts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccount"); + }// verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccount"); }// verify the required parameter 'accounts' is set @@ -9188,7 +9856,7 @@ public HttpResponse updateAccountForHttpResponse( UUID accountID, Accounts acco throw new IllegalArgumentException("Missing the required parameter 'accounts' when calling updateAccount"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9220,20 +9888,24 @@ public HttpResponse updateAccountForHttpResponse( UUID accountID, Accounts acco * Allows you to update Attachment on Account by Filename *

200 - Success - return response of type Attachments array of Attachment *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant * @param accountID Unique identifier for Account object * @param fileName Name of the attachment * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateAccountAttachmentByFileName(UUID accountID, String fileName, File body) throws IOException { - HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(accountID, fileName, body); + public Attachments updateAccountAttachmentByFileName(String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { + HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse(xeroTenantId, accountID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( UUID accountID, String fileName, File body) throws IOException { - // verify the required parameter 'accountID' is set + public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID accountID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateAccountAttachmentByFileName"); + }// verify the required parameter 'accountID' is set if (accountID == null) { throw new IllegalArgumentException("Missing the required parameter 'accountID' when calling updateAccountAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9244,7 +9916,7 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( UUID accou throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9279,19 +9951,23 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( UUID accou * Allows you to update a single spend or receive money transaction *

200 - Success - return response of type BankTransactions array with updated BankTransaction *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param bankTransactions The bankTransactions parameter * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions updateBankTransaction(UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { - HttpResponse response = updateBankTransactionForHttpResponse(bankTransactionID, bankTransactions); + public BankTransactions updateBankTransaction(String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { + HttpResponse response = updateBankTransactionForHttpResponse(xeroTenantId, bankTransactionID, bankTransactions); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateBankTransactionForHttpResponse( UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { - // verify the required parameter 'bankTransactionID' is set + public HttpResponse updateBankTransactionForHttpResponse( String xeroTenantId, UUID bankTransactionID, BankTransactions bankTransactions) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); + }// verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); }// verify the required parameter 'bankTransactions' is set @@ -9299,7 +9975,7 @@ public HttpResponse updateBankTransactionForHttpResponse( UUID bankTransactionID throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9331,20 +10007,24 @@ public HttpResponse updateBankTransactionForHttpResponse( UUID bankTransactionID * Allows you to update an Attachment on BankTransaction by Filename *

200 - Success - return response of Attachments array of Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction * @param fileName The name of the file being attached * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransactionAttachmentByFileName(UUID bankTransactionID, String fileName, File body) throws IOException { - HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(bankTransactionID, fileName, body); + public Attachments updateBankTransactionAttachmentByFileName(String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { + HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransactionID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( UUID bankTransactionID, String fileName, File body) throws IOException { - // verify the required parameter 'bankTransactionID' is set + public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransactionID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransactionAttachmentByFileName"); + }// verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransactionID' when calling updateBankTransactionAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9355,7 +10035,7 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( UU throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransactionAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9389,20 +10069,24 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( UU /** *

200 - Success - return response of Attachments array of 0 to N Attachment for a Bank Transfer *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer * @param fileName The name of the file being attached to a Bank Transfer * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateBankTransferAttachmentByFileName(UUID bankTransferID, String fileName, File body) throws IOException { - HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(bankTransferID, fileName, body); + public Attachments updateBankTransferAttachmentByFileName(String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { + HttpResponse response = updateBankTransferAttachmentByFileNameForHttpResponse(xeroTenantId, bankTransferID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( UUID bankTransferID, String fileName, File body) throws IOException { - // verify the required parameter 'bankTransferID' is set + public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID bankTransferID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateBankTransferAttachmentByFileName"); + }// verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException("Missing the required parameter 'bankTransferID' when calling updateBankTransferAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9413,7 +10097,7 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( UUID throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateBankTransferAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9447,19 +10131,23 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( UUID /** *

200 - Success - return response of type Contacts array with an updated Contact *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param contacts an array of Contacts containing single Contact object with properties to update * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts updateContact(UUID contactID, Contacts contacts) throws IOException { - HttpResponse response = updateContactForHttpResponse(contactID, contacts); + public Contacts updateContact(String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { + HttpResponse response = updateContactForHttpResponse(xeroTenantId, contactID, contacts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateContactForHttpResponse( UUID contactID, Contacts contacts) throws IOException { - // verify the required parameter 'contactID' is set + public HttpResponse updateContactForHttpResponse( String xeroTenantId, UUID contactID, Contacts contacts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContact"); + }// verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContact"); }// verify the required parameter 'contacts' is set @@ -9467,7 +10155,7 @@ public HttpResponse updateContactForHttpResponse( UUID contactID, Contacts cont throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling updateContact"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9498,20 +10186,24 @@ public HttpResponse updateContactForHttpResponse( UUID contactID, Contacts cont /** *

200 - Success - return response of type Attachments array with an updated Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactID Unique identifier for a Contact * @param fileName Name for the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateContactAttachmentByFileName(UUID contactID, String fileName, File body) throws IOException { - HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(contactID, fileName, body); + public Attachments updateContactAttachmentByFileName(String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { + HttpResponse response = updateContactAttachmentByFileNameForHttpResponse(xeroTenantId, contactID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateContactAttachmentByFileNameForHttpResponse( UUID contactID, String fileName, File body) throws IOException { - // verify the required parameter 'contactID' is set + public HttpResponse updateContactAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID contactID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactAttachmentByFileName"); + }// verify the required parameter 'contactID' is set if (contactID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactID' when calling updateContactAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9522,7 +10214,7 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( UUID conta throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9557,19 +10249,23 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( UUID conta * Allows you to update a Contract Group *

200 - Success - return response of type Contact Groups array of updated Contact Group *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param contactGroupID Unique identifier for a Contact Group * @param contactGroups an array of Contact groups with Name of specific group to update * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API **/ - public ContactGroups updateContactGroup(UUID contactGroupID, ContactGroups contactGroups) throws IOException { - HttpResponse response = updateContactGroupForHttpResponse(contactGroupID, contactGroups); + public ContactGroups updateContactGroup(String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { + HttpResponse response = updateContactGroupForHttpResponse(xeroTenantId, contactGroupID, contactGroups); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateContactGroupForHttpResponse( UUID contactGroupID, ContactGroups contactGroups) throws IOException { - // verify the required parameter 'contactGroupID' is set + public HttpResponse updateContactGroupForHttpResponse( String xeroTenantId, UUID contactGroupID, ContactGroups contactGroups) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); + }// verify the required parameter 'contactGroupID' is set if (contactGroupID == null) { throw new IllegalArgumentException("Missing the required parameter 'contactGroupID' when calling updateContactGroup"); }// verify the required parameter 'contactGroups' is set @@ -9577,7 +10273,7 @@ public HttpResponse updateContactGroupForHttpResponse( UUID contactGroupID, Con throw new IllegalArgumentException("Missing the required parameter 'contactGroups' when calling updateContactGroup"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9609,19 +10305,23 @@ public HttpResponse updateContactGroupForHttpResponse( UUID contactGroupID, Con * Allows you to update a specific credit note *

200 - Success - return response of type Credit Notes array with updated CreditNote *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param creditNotes an array of Credit Notes containing credit note details to update * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes updateCreditNote(UUID creditNoteID, CreditNotes creditNotes) throws IOException { - HttpResponse response = updateCreditNoteForHttpResponse(creditNoteID, creditNotes); + public CreditNotes updateCreditNote(String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { + HttpResponse response = updateCreditNoteForHttpResponse(xeroTenantId, creditNoteID, creditNotes); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateCreditNoteForHttpResponse( UUID creditNoteID, CreditNotes creditNotes) throws IOException { - // verify the required parameter 'creditNoteID' is set + public HttpResponse updateCreditNoteForHttpResponse( String xeroTenantId, UUID creditNoteID, CreditNotes creditNotes) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); + }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNote"); }// verify the required parameter 'creditNotes' is set @@ -9629,7 +10329,7 @@ public HttpResponse updateCreditNoteForHttpResponse( UUID creditNoteID, CreditN throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling updateCreditNote"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9661,20 +10361,24 @@ public HttpResponse updateCreditNoteForHttpResponse( UUID creditNoteID, CreditN * Allows you to update Attachments on CreditNote by file name *

200 - Success - return response of type Attachments array with updated Attachment for specific Credit Note *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note * @param fileName Name of the file you are attaching to Credit Note * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateCreditNoteAttachmentByFileName(UUID creditNoteID, String fileName, File body) throws IOException { - HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(creditNoteID, fileName, body); + public Attachments updateCreditNoteAttachmentByFileName(String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { + HttpResponse response = updateCreditNoteAttachmentByFileNameForHttpResponse(xeroTenantId, creditNoteID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( UUID creditNoteID, String fileName, File body) throws IOException { - // verify the required parameter 'creditNoteID' is set + public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID creditNoteID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateCreditNoteAttachmentByFileName"); + }// verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException("Missing the required parameter 'creditNoteID' when calling updateCreditNoteAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9685,7 +10389,7 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( UUID cr throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateCreditNoteAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9720,19 +10424,23 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( UUID cr * Allows you to update a specific employee used in Xero payrun *

200 - Success - return response of type Employees array with updated Employee *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param employeeID Unique identifier for a Employee * @param employees The employees parameter * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees updateEmployee(UUID employeeID, Employees employees) throws IOException { - HttpResponse response = updateEmployeeForHttpResponse(employeeID, employees); + public Employees updateEmployee(String xeroTenantId, UUID employeeID, Employees employees) throws IOException { + HttpResponse response = updateEmployeeForHttpResponse(xeroTenantId, employeeID, employees); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateEmployeeForHttpResponse( UUID employeeID, Employees employees) throws IOException { - // verify the required parameter 'employeeID' is set + public HttpResponse updateEmployeeForHttpResponse( String xeroTenantId, UUID employeeID, Employees employees) 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 'employees' is set @@ -9740,7 +10448,7 @@ public HttpResponse updateEmployeeForHttpResponse( UUID employeeID, Employees e throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9772,19 +10480,23 @@ public HttpResponse updateEmployeeForHttpResponse( UUID employeeID, Employees e * Allows you to update specified expense claims *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param expenseClaimID Unique identifier for a ExpenseClaim * @param expenseClaims The expenseClaims parameter * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims updateExpenseClaim(UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { - HttpResponse response = updateExpenseClaimForHttpResponse(expenseClaimID, expenseClaims); + public ExpenseClaims updateExpenseClaim(String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { + HttpResponse response = updateExpenseClaimForHttpResponse(xeroTenantId, expenseClaimID, expenseClaims); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateExpenseClaimForHttpResponse( UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { - // verify the required parameter 'expenseClaimID' is set + public HttpResponse updateExpenseClaimForHttpResponse( String xeroTenantId, UUID expenseClaimID, ExpenseClaims expenseClaims) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); + }// verify the required parameter 'expenseClaimID' is set if (expenseClaimID == null) { throw new IllegalArgumentException("Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); }// verify the required parameter 'expenseClaims' is set @@ -9792,7 +10504,7 @@ public HttpResponse updateExpenseClaimForHttpResponse( UUID expenseClaimID, Exp throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9824,19 +10536,23 @@ public HttpResponse updateExpenseClaimForHttpResponse( UUID expenseClaimID, Exp * Allows you to update a specified sales invoices or purchase bills *

200 - Success - return response of type Invoices array with updated Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param invoices The invoices parameter * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices updateInvoice(UUID invoiceID, Invoices invoices) throws IOException { - HttpResponse response = updateInvoiceForHttpResponse(invoiceID, invoices); + public Invoices updateInvoice(String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { + HttpResponse response = updateInvoiceForHttpResponse(xeroTenantId, invoiceID, invoices); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateInvoiceForHttpResponse( UUID invoiceID, Invoices invoices) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse updateInvoiceForHttpResponse( String xeroTenantId, UUID invoiceID, Invoices invoices) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoice"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoice"); }// verify the required parameter 'invoices' is set @@ -9844,7 +10560,7 @@ public HttpResponse updateInvoiceForHttpResponse( UUID invoiceID, Invoices invo throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling updateInvoice"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9876,20 +10592,24 @@ public HttpResponse updateInvoiceForHttpResponse( UUID invoiceID, Invoices invo * Allows you to update Attachment on invoices or purchase bills by it's filename *

200 - Success - return response of type Attachments array with updated Attachment *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice * @param fileName Name of the file you are attaching * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateInvoiceAttachmentByFileName(UUID invoiceID, String fileName, File body) throws IOException { - HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(invoiceID, fileName, body); + public Attachments updateInvoiceAttachmentByFileName(String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { + HttpResponse response = updateInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, invoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( UUID invoiceID, String fileName, File body) throws IOException { - // verify the required parameter 'invoiceID' is set + public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID invoiceID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateInvoiceAttachmentByFileName"); + }// verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceID' when calling updateInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -9900,7 +10620,7 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( UUID invoi throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9935,19 +10655,23 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( UUID invoi * Allows you to udpate a specified item *

200 - Success - return response of type Items array with updated Item *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param itemID Unique identifier for an Item * @param items The items parameter * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items updateItem(UUID itemID, Items items) throws IOException { - HttpResponse response = updateItemForHttpResponse(itemID, items); + public Items updateItem(String xeroTenantId, UUID itemID, Items items) throws IOException { + HttpResponse response = updateItemForHttpResponse(xeroTenantId, itemID, items); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateItemForHttpResponse( UUID itemID, Items items) throws IOException { - // verify the required parameter 'itemID' is set + public HttpResponse updateItemForHttpResponse( String xeroTenantId, UUID itemID, Items items) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateItem"); + }// verify the required parameter 'itemID' is set if (itemID == null) { throw new IllegalArgumentException("Missing the required parameter 'itemID' when calling updateItem"); }// verify the required parameter 'items' is set @@ -9955,7 +10679,7 @@ public HttpResponse updateItemForHttpResponse( UUID itemID, Items items) throws throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateItem"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -9987,19 +10711,23 @@ public HttpResponse updateItemForHttpResponse( UUID itemID, Items items) throws * Allows you to update a specified linked transactions (billable expenses) *

200 - Success - return response of type LinkedTransactions array with updated LinkedTransaction *

400 - Success - return response of type LinkedTransactions array with updated LinkedTransaction + * @param xeroTenantId Xero identifier for Tenant * @param linkedTransactionID Unique identifier for a LinkedTransaction * @param linkedTransactions The linkedTransactions parameter * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions updateLinkedTransaction(UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { - HttpResponse response = updateLinkedTransactionForHttpResponse(linkedTransactionID, linkedTransactions); + public LinkedTransactions updateLinkedTransaction(String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { + HttpResponse response = updateLinkedTransactionForHttpResponse(xeroTenantId, linkedTransactionID, linkedTransactions); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateLinkedTransactionForHttpResponse( UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { - // verify the required parameter 'linkedTransactionID' is set + public HttpResponse updateLinkedTransactionForHttpResponse( String xeroTenantId, UUID linkedTransactionID, LinkedTransactions linkedTransactions) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); + }// verify the required parameter 'linkedTransactionID' is set if (linkedTransactionID == null) { throw new IllegalArgumentException("Missing the required parameter 'linkedTransactionID' when calling updateLinkedTransaction"); }// verify the required parameter 'linkedTransactions' is set @@ -10007,7 +10735,7 @@ public HttpResponse updateLinkedTransactionForHttpResponse( UUID linkedTransacti throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling updateLinkedTransaction"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -10039,19 +10767,23 @@ public HttpResponse updateLinkedTransactionForHttpResponse( UUID linkedTransacti * Allows you to update a specified manual journal *

200 - Success - return response of type ManualJournals array with an updated ManualJournal *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param manualJournals The manualJournals parameter * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals updateManualJournal(UUID manualJournalID, ManualJournals manualJournals) throws IOException { - HttpResponse response = updateManualJournalForHttpResponse(manualJournalID, manualJournals); + public ManualJournals updateManualJournal(String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { + HttpResponse response = updateManualJournalForHttpResponse(xeroTenantId, manualJournalID, manualJournals); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateManualJournalForHttpResponse( UUID manualJournalID, ManualJournals manualJournals) throws IOException { - // verify the required parameter 'manualJournalID' is set + public HttpResponse updateManualJournalForHttpResponse( String xeroTenantId, UUID manualJournalID, ManualJournals manualJournals) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); + }// verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournal"); }// verify the required parameter 'manualJournals' is set @@ -10059,7 +10791,7 @@ public HttpResponse updateManualJournalForHttpResponse( UUID manualJournalID, M throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling updateManualJournal"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -10091,20 +10823,24 @@ public HttpResponse updateManualJournalForHttpResponse( UUID manualJournalID, M * Allows you to update a specified Attachment on ManualJournal by file name *

200 - Success - return response of type Attachments array with an update Attachment for a ManualJournals *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal * @param fileName The name of the file being attached to a ManualJournal * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateManualJournalAttachmentByFileName(UUID manualJournalID, String fileName, File body) throws IOException { - HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(manualJournalID, fileName, body); + public Attachments updateManualJournalAttachmentByFileName(String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { + HttpResponse response = updateManualJournalAttachmentByFileNameForHttpResponse(xeroTenantId, manualJournalID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( UUID manualJournalID, String fileName, File body) throws IOException { - // verify the required parameter 'manualJournalID' is set + public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling updateManualJournalAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -10115,7 +10851,7 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( UUID throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateManualJournalAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -10150,19 +10886,23 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( UUID * Allows you to update a specified purchase order *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for a PurchaseOrder * @param purchaseOrders The purchaseOrders parameter * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders updatePurchaseOrder(UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { - HttpResponse response = updatePurchaseOrderForHttpResponse(purchaseOrderID, purchaseOrders); + public PurchaseOrders updatePurchaseOrder(String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { + HttpResponse response = updatePurchaseOrderForHttpResponse(xeroTenantId, purchaseOrderID, purchaseOrders); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updatePurchaseOrderForHttpResponse( UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { - // verify the required parameter 'purchaseOrderID' is set + public HttpResponse updatePurchaseOrderForHttpResponse( String xeroTenantId, UUID purchaseOrderID, PurchaseOrders purchaseOrders) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); + }// verify the required parameter 'purchaseOrderID' is set if (purchaseOrderID == null) { throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); }// verify the required parameter 'purchaseOrders' is set @@ -10170,7 +10910,7 @@ public HttpResponse updatePurchaseOrderForHttpResponse( UUID purchaseOrderID, P throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -10202,19 +10942,23 @@ public HttpResponse updatePurchaseOrderForHttpResponse( UUID purchaseOrderID, P * Allows you to retrieve a specified draft expense claim receipts *

200 - Success - return response of type Receipts array for updated Receipt *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param receipts The receipts parameter * @return Receipts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Receipts updateReceipt(UUID receiptID, Receipts receipts) throws IOException { - HttpResponse response = updateReceiptForHttpResponse(receiptID, receipts); + public Receipts updateReceipt(String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { + HttpResponse response = updateReceiptForHttpResponse(xeroTenantId, receiptID, receipts); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateReceiptForHttpResponse( UUID receiptID, Receipts receipts) throws IOException { - // verify the required parameter 'receiptID' is set + public HttpResponse updateReceiptForHttpResponse( String xeroTenantId, UUID receiptID, Receipts receipts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceipt"); + }// verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceipt"); }// verify the required parameter 'receipts' is set @@ -10222,7 +10966,7 @@ public HttpResponse updateReceiptForHttpResponse( UUID receiptID, Receipts rece throw new IllegalArgumentException("Missing the required parameter 'receipts' when calling updateReceipt"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -10254,20 +10998,24 @@ public HttpResponse updateReceiptForHttpResponse( UUID receiptID, Receipts rece * Allows you to update Attachment on expense claim receipts by file name *

200 - Success - return response of type Attachments array with updated Attachment for a specified Receipt *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt * @param fileName The name of the file being attached to the Receipt * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateReceiptAttachmentByFileName(UUID receiptID, String fileName, File body) throws IOException { - HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(receiptID, fileName, body); + public Attachments updateReceiptAttachmentByFileName(String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { + HttpResponse response = updateReceiptAttachmentByFileNameForHttpResponse(xeroTenantId, receiptID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( UUID receiptID, String fileName, File body) throws IOException { - // verify the required parameter 'receiptID' is set + public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID receiptID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateReceiptAttachmentByFileName"); + }// verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException("Missing the required parameter 'receiptID' when calling updateReceiptAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -10278,7 +11026,7 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( UUID recei throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -10313,20 +11061,24 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( UUID recei * Allows you to update specified attachment on repeating invoices by file name *

200 - Success - return response of type Attachments array with specified Attachment for a specified Repeating Invoice *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice * @param fileName The name of the file being attached to a Repeating Invoice * @param body Byte array of file in body of request * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments updateRepeatingInvoiceAttachmentByFileName(UUID repeatingInvoiceID, String fileName, File body) throws IOException { - HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(repeatingInvoiceID, fileName, body); + public Attachments updateRepeatingInvoiceAttachmentByFileName(String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { + HttpResponse response = updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(xeroTenantId, repeatingInvoiceID, fileName, body); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( UUID repeatingInvoiceID, String fileName, File body) throws IOException { - // verify the required parameter 'repeatingInvoiceID' is set + public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( String xeroTenantId, UUID repeatingInvoiceID, String fileName, File body) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateRepeatingInvoiceAttachmentByFileName"); + }// verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException("Missing the required parameter 'repeatingInvoiceID' when calling updateRepeatingInvoiceAttachmentByFileName"); }// verify the required parameter 'fileName' is set @@ -10337,7 +11089,7 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( U throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateRepeatingInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -10372,23 +11124,27 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( U * Allows you to update Tax Rates *

200 - Success - return response of type TaxRates array updated TaxRate *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param taxRates The taxRates parameter * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates updateTaxRate(TaxRates taxRates) throws IOException { - HttpResponse response = updateTaxRateForHttpResponse(taxRates); + public TaxRates updateTaxRate(String xeroTenantId, TaxRates taxRates) throws IOException { + HttpResponse response = updateTaxRateForHttpResponse(xeroTenantId, taxRates); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateTaxRateForHttpResponse( TaxRates taxRates) throws IOException { - // verify the required parameter 'taxRates' is set + public HttpResponse updateTaxRateForHttpResponse( String xeroTenantId, TaxRates taxRates) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTaxRate"); + }// verify the required parameter 'taxRates' is set if (taxRates == null) { throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling updateTaxRate"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -10415,19 +11171,23 @@ public HttpResponse updateTaxRateForHttpResponse( TaxRates taxRates) throws IOEx * Allows you to update tracking categories *

200 - Success - return response of type TrackingCategories array of updated TrackingCategory *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant * @param trackingCategoryID Unique identifier for a TrackingCategory * @param trackingCategory The trackingCategory parameter * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API **/ - public TrackingCategories updateTrackingCategory(UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { - HttpResponse response = updateTrackingCategoryForHttpResponse(trackingCategoryID, trackingCategory); + public TrackingCategories updateTrackingCategory(String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { + HttpResponse response = updateTrackingCategoryForHttpResponse(xeroTenantId, trackingCategoryID, trackingCategory); TypeReference typeRef = new TypeReference() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse updateTrackingCategoryForHttpResponse( UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { - // verify the required parameter 'trackingCategoryID' is set + public HttpResponse updateTrackingCategoryForHttpResponse( String xeroTenantId, UUID trackingCategoryID, TrackingCategory trackingCategory) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingCategory"); + }// verify the required parameter 'trackingCategoryID' is set if (trackingCategoryID == null) { throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingCategory"); }// verify the required parameter 'trackingCategory' is set @@ -10435,7 +11195,7 @@ public HttpResponse updateTrackingCategoryForHttpResponse( UUID trackingCategory throw new IllegalArgumentException("Missing the required parameter 'trackingCategory' when calling updateTrackingCategory"); } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); diff --git a/src/main/java/com/xero/example/AuthenticatedResource.java b/src/main/java/com/xero/example/AuthenticatedResource.java index 43aee497..0e6c2485 100755 --- a/src/main/java/com/xero/example/AuthenticatedResource.java +++ b/src/main/java/com/xero/example/AuthenticatedResource.java @@ -27,14 +27,18 @@ import com.xero.models.accounting.Phone.PhoneTypeEnum; import com.xero.api.client.AccountingApi; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.threeten.bp.*; @WebServlet("/AuthenticatedResource") public class AuthenticatedResource extends HttpServlet { private static final long serialVersionUID = 1L; - //private Config config = null; - //final static Logger logger = LogManager.getLogger(OAuthRequestResource.class); + final static Logger logger = LogManager.getLogger(AuthenticatedResource.class); + final String clientId = "--YOUR_CLIENT_ID--"; + final String clientSecret = "--YOUR_CLIENT_SECRET--"; + final String redirectURI = "--YOUR_REDIRECT_URI--"; private String htmlString = "" + "" @@ -47,12 +51,9 @@ public class AuthenticatedResource extends HttpServlet + "

" + "" + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "
" - + "
" - + "" - + "
" - + "
"; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - PrintWriter respWriter = response.getWriter(); - response.setStatus(200); - response.setContentType("text/html"); - respWriter.println(htmlString); - } - - @SuppressWarnings("null") - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - boolean summarizeErrors = false; - String ids= null; - boolean includeArchived = false; - String invoiceNumbers = null; - String contactIDs = null; - String statuses = null; - boolean createdByMyApp = false; - int unitDp = 2; - Calendar now = Calendar.getInstance(); - int day = now.get(Calendar.DATE); - int year = now.get(Calendar.YEAR); - int lastMonth = now.get(Calendar.MONTH) - 1; - int nextMonth = now.get(Calendar.MONTH) + 1; - if (lastMonth == 0) { - lastMonth = 1; - } - if (lastMonth == -1) { - lastMonth = 12; - year = year -1; - } - if (nextMonth == 13) { - nextMonth = 1; - year = year + 1; - } - if (day > 28) { - day = 28; - } - - PrintWriter respWriter = response.getWriter(); - response.setStatus(200); - response.setContentType("text/html"); - respWriter.println(htmlString); - respWriter.println("

begin processing request
"); - - String object = request.getParameter("object"); - ArrayList messages = new ArrayList(); - - // Get Tokens and Xero Tenant Id from Storage - TokenStorage store = new TokenStorage(); - String savedAccessToken =store.get(request, "access_token"); - String savedRefreshToken = store.get(request, "refresh_token"); - String xeroTenantId = store.get(request, "xero_tenant_id"); - - // Check expiration of token and refresh if necessary - // This should be done prior to each API call to ensure your accessToken is valid - String accessToken = new TokenRefresh().checkToken(savedAccessToken,savedRefreshToken,response); - +public class AuthenticatedResource extends HttpServlet { + private static final long serialVersionUID = 1L; + final static Logger logger = LogManager.getLogger(AuthenticatedResource.class); + private AccountingApi accountingApi = null; + + private String htmlString = "" + + "" + + "" + + "

Xero API - JAVA

" + "
" + + "Logout" + "
" + + "
" + "
" + + "" + + "" + "
" + "
" + + "" + "
" + "
"; + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse + * response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + PrintWriter respWriter = response.getWriter(); + response.setStatus(200); + response.setContentType("text/html"); + respWriter.println(htmlString); + } + + @SuppressWarnings("null") + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + OffsetDateTime ifModifiedSince = null; + String where = null; + String order = null; + boolean summarizeErrors = false; + String ids = null; + boolean includeArchived = false; + String invoiceNumbers = null; + String contactIDs = null; + String statuses = null; + boolean createdByMyApp = false; + int unitDp = 2; + Calendar now = Calendar.getInstance(); + int day = now.get(Calendar.DATE); + int year = now.get(Calendar.YEAR); + int lastMonth = now.get(Calendar.MONTH) - 1; + int nextMonth = now.get(Calendar.MONTH) + 1; + if (lastMonth == 0) { + lastMonth = 1; + } + if (lastMonth == -1) { + lastMonth = 12; + year = year - 1; + } + if (nextMonth == 13) { + nextMonth = 1; + year = year + 1; + } + if (day > 28) { + day = 28; + } + + PrintWriter respWriter = response.getWriter(); + response.setStatus(200); + response.setContentType("text/html"); + respWriter.println(htmlString); + respWriter.println("

begin processing request
"); + + String object = request.getParameter("object"); + ArrayList messages = new ArrayList(); + + // Get Tokens and Xero Tenant Id from Storage + TokenStorage store = new TokenStorage(); + String savedAccessToken = store.get(request, "access_token"); + String savedRefreshToken = store.get(request, "refresh_token"); + String xeroTenantId = store.get(request, "xero_tenant_id"); + + // Check expiration of token and refresh if necessary + // This should be done prior to each API call to ensure your accessToken is + // valid + String accessToken = new TokenRefresh().checkToken(savedAccessToken, savedRefreshToken, response); + // Init AccountingApi client ApiClient defaultClient = new ApiClient(); // Get Singleton - instance of accounting client - accountingApi = AccountingApi.getInstance(defaultClient); - - if (object.equals("Accounts")) { - // ACCOUNTS - try { - // GET all accounts - Accounts accounts = accountingApi.getAccounts(accessToken,xeroTenantId,null, null, null); - messages.add("Get a all Accounts - total : " + accounts.getAccounts().size()); - - // GET one account - Accounts oneAccount = accountingApi.getAccount(accessToken,xeroTenantId,accounts.getAccounts().get(0).getAccountID()); - messages.add("Get a one Account - name : " + oneAccount.getAccounts().get(0).getName()); - - // CREATE account - Account acct = new Account(); - acct.setName("Bye" + loadRandomNum()); - acct.setCode("Hello" + loadRandomNum()); - acct.setDescription("Foo boo"); - acct.setType(com.xero.models.accounting.AccountType.EXPENSE); - Accounts newAccount = accountingApi.createAccount(accessToken,xeroTenantId,acct); - messages.add("Create a new Account - Name : " + newAccount.getAccounts().get(0).getName() + " Description : " + newAccount.getAccounts().get(0).getDescription() + ""); - UUID accountID = newAccount.getAccounts().get(0).getAccountID(); - - // CREATE Bank account - Account bankAcct = new Account(); - bankAcct.setName("Checking " + loadRandomNum()); - bankAcct.setCode("12" + loadRandomNum()); - bankAcct.setType(com.xero.models.accounting.AccountType.BANK); - bankAcct.setBankAccountNumber("1234" + loadRandomNum()); - Accounts newBankAccount = accountingApi.createAccount(accessToken, xeroTenantId,bankAcct); - messages.add("Create Bank Account - Name : " + newBankAccount.getAccounts().get(0).getName()); - - // GET BANK account - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - messages.add("Get a all Accounts - total : " + accountsWhere.getAccounts().size()); - - // UDPATE Account - newAccount.getAccounts().get(0).setDescription("Monsters Inc."); - newAccount.getAccounts().get(0).setStatus(null); - Accounts updateAccount = accountingApi.updateAccount(accessToken,xeroTenantId,accountID, newAccount); - messages.add("Update Account - Name : " + updateAccount.getAccounts().get(0).getName() + " Description : " + updateAccount.getAccounts().get(0).getDescription() + ""); - - // ARCHIVE Account - Accounts archiveAccounts = new Accounts(); - Account archiveAccount = new Account(); - archiveAccount.setStatus(com.xero.models.accounting.Account.StatusEnum.ARCHIVED); - archiveAccount.setAccountID(accountID); - archiveAccounts.addAccountsItem(archiveAccount); - Accounts achivedAccount = accountingApi.updateAccount(accessToken,xeroTenantId,accountID, archiveAccounts); - messages.add("Archived Account - Name : " + achivedAccount.getAccounts().get(0).getName() + " Status: " + achivedAccount.getAccounts().get(0).getStatus()); - - // DELETE Account - UUID deleteAccountID = newAccount.getAccounts().get(0).getAccountID(); - Accounts deleteAccount = accountingApi.deleteAccount(accessToken,xeroTenantId,deleteAccountID); - messages.add("Delete account - Status? : " + deleteAccount.getAccounts().get(0).getStatus()); - - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - + accountingApi = AccountingApi.getInstance(defaultClient); + + if (object.equals("debug")) { + + /* + * Invoices invoices = new Invoices(); Invoice invoice = new Invoice(); LineItem + * li = new LineItem(); li.setLineAmount(100.00); + * + * invoice.setType(TypeEnum.ACCREC); invoice.setReference("hello world"); + * invoice.addLineItemsItem(li); + * + * Contact contact1 = new Contact(); contact1.setName("Mr. Sid Maestre" + + * this.loadRandomNum()); invoice.setContact(contact1); + * invoices.addInvoicesItem(invoice); + * + * Invoices newInvoices = accountingApi.createInvoice(accessToken, xeroTenantId, + * invoices, false); System.out.println("New Invoice created"); + * System.out.println(newInvoices.toString()); + */ + + } else if (object.equals("Accounts")) { + // ACCOUNTS + try { + // GET all accounts + Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, null, null, null); + messages.add("Get a all Accounts - total : " + accounts.getAccounts().size()); + + // GET one account + Accounts oneAccount = accountingApi.getAccount(accessToken, xeroTenantId, + accounts.getAccounts().get(0).getAccountID()); + messages.add("Get a one Account - name : " + oneAccount.getAccounts().get(0).getName()); + + // CREATE account + Account acct = new Account(); + acct.setName("Bye" + loadRandomNum()); + acct.setCode("Hello" + loadRandomNum()); + acct.setDescription("Foo boo"); + acct.setType(com.xero.models.accounting.AccountType.EXPENSE); + Accounts newAccount = accountingApi.createAccount(accessToken, xeroTenantId, acct); + messages.add("Create a new Account - Name : " + newAccount.getAccounts().get(0).getName() + + " Description : " + newAccount.getAccounts().get(0).getDescription() + ""); + UUID accountID = newAccount.getAccounts().get(0).getAccountID(); + + // CREATE Bank account + Account bankAcct = new Account(); + bankAcct.setName("Checking " + loadRandomNum()); + bankAcct.setCode("12" + loadRandomNum()); + bankAcct.setType(com.xero.models.accounting.AccountType.BANK); + bankAcct.setBankAccountNumber("1234" + loadRandomNum()); + Accounts newBankAccount = accountingApi.createAccount(accessToken, xeroTenantId, bankAcct); + messages.add("Create Bank Account - Name : " + newBankAccount.getAccounts().get(0).getName()); + + // GET BANK account + where = "Status==\"ACTIVE\"&&Type==\"BANK\""; + Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, + order); + messages.add("Get a all Accounts - total : " + accountsWhere.getAccounts().size()); + + // UDPATE Account + newAccount.getAccounts().get(0).setDescription("Monsters Inc."); + newAccount.getAccounts().get(0).setStatus(null); + Accounts updateAccount = accountingApi.updateAccount(accessToken, xeroTenantId, accountID, newAccount); + messages.add("Update Account - Name : " + updateAccount.getAccounts().get(0).getName() + + " Description : " + updateAccount.getAccounts().get(0).getDescription() + ""); + + // ARCHIVE Account + Accounts archiveAccounts = new Accounts(); + Account archiveAccount = new Account(); + archiveAccount.setStatus(com.xero.models.accounting.Account.StatusEnum.ARCHIVED); + archiveAccount.setAccountID(accountID); + archiveAccounts.addAccountsItem(archiveAccount); + Accounts achivedAccount = accountingApi.updateAccount(accessToken, xeroTenantId, accountID, + archiveAccounts); + messages.add("Archived Account - Name : " + achivedAccount.getAccounts().get(0).getName() + " Status: " + + achivedAccount.getAccounts().get(0).getStatus()); + + // DELETE Account + UUID deleteAccountID = newAccount.getAccounts().get(0).getAccountID(); + Accounts deleteAccount = accountingApi.deleteAccount(accessToken, xeroTenantId, deleteAccountID); + messages.add("Delete account - Status? : " + deleteAccount.getAccounts().get(0).getStatus()); + + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("GetAttachments")) { - - try { - // GET Account Attachment - where = "Status==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - if (accounts.getAccounts().size() > 0) { - UUID accountID = accounts.getAccounts().get(0).getAccountID(); - Attachments accountsAttachments = accountingApi.getAccountAttachments(accessToken,xeroTenantId,accountID); - if (accountsAttachments.getAttachments().size() > 0) { - UUID attachementId = accountsAttachments.getAttachments().get(0).getAttachmentID(); - String contentType = accountsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream input = accountingApi.getAccountAttachmentById(accessToken,xeroTenantId,accountID,attachementId, contentType); - String fileName = "Account_" + accountsAttachments.getAttachments().get(0).getFileName(); - String saveFilePath = saveFile(input,fileName); - messages.add("Get Account attachment - save it here: " + saveFilePath); - } - } - - // GET BankTransactions Attachment - where = null; - BankTransactions bankTransactions = accountingApi.getBankTransactions(accessToken,xeroTenantId,ifModifiedSince, where, order, null, null); - if (bankTransactions.getBankTransactions().size() > 0) { - UUID BankTransactionID = bankTransactions.getBankTransactions().get(0).getBankTransactionID(); - Attachments bankTransactionsAttachments = accountingApi.getBankTransactionAttachments(accessToken,xeroTenantId,BankTransactionID); - if (bankTransactionsAttachments.getAttachments().size() > 0) { - UUID BankTransactionAttachementID = bankTransactionsAttachments.getAttachments().get(0).getAttachmentID(); - String BankTransactionContentType = bankTransactionsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream BankTransactionInput = accountingApi.getAccountAttachmentById(accessToken,xeroTenantId,BankTransactionID,BankTransactionAttachementID, BankTransactionContentType); - String BankTransactionFileName = "BankTransaction_" + bankTransactionsAttachments.getAttachments().get(0).getFileName(); - String BankTransactionSaveFilePath = saveFile(BankTransactionInput,BankTransactionFileName); - messages.add("Get BankTransactions attachment - save it here: " + BankTransactionSaveFilePath); - } - } - - // GET BankTransfers Attachment - BankTransfers bankTransfers = accountingApi.getBankTransfers(accessToken,xeroTenantId,ifModifiedSince, where, order); - if (bankTransfers.getBankTransfers().size() > 0) { - UUID BankTransferID = bankTransfers.getBankTransfers().get(0).getBankTransferID(); - Attachments bankTransfersAttachments = accountingApi.getBankTransferAttachments(accessToken,xeroTenantId,BankTransferID); - if (bankTransfersAttachments.getAttachments().size() > 0) { - UUID BankTransferAttachementID = bankTransfersAttachments.getAttachments().get(0).getAttachmentID(); - String BankTransferContentType = bankTransfersAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream BankTransferInput = accountingApi.getAccountAttachmentById(accessToken,xeroTenantId,BankTransferID,BankTransferAttachementID, BankTransferContentType); - String BankTransferFileName = "BankTransfer_" + bankTransfersAttachments.getAttachments().get(0).getFileName(); - String BankTransferSaveFilePath = saveFile(BankTransferInput,BankTransferFileName); - messages.add("Get BankTransfers attachment - save it here: " + BankTransferSaveFilePath); - } - } - // GET Contacts Attachment - where = "ContactStatus==\"ACTIVE\""; - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - if (contacts.getContacts().size() > 0) { - UUID ContactID = contacts.getContacts().get(0).getContactID(); - Attachments contactsAttachments = accountingApi.getContactAttachments(accessToken,xeroTenantId,ContactID); - if (contactsAttachments.getAttachments().size() > 0) { - UUID ContactAttachementID = contactsAttachments.getAttachments().get(0).getAttachmentID(); - String ContactContentType = contactsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream ContactInput = accountingApi.getAccountAttachmentById(accessToken,xeroTenantId,ContactID,ContactAttachementID, ContactContentType); - String ContactFileName = "Contact_" + contactsAttachments.getAttachments().get(0).getFileName(); - String ContactSaveFilePath = saveFile(ContactInput,ContactFileName); - messages.add("Get Contacts attachment - save it here: " + ContactSaveFilePath); - } - } - // GET CreditNotes Attachment - where = "Status==\"AUTHORISED\""; - CreditNotes creditNotes = accountingApi.getCreditNotes(accessToken,xeroTenantId,ifModifiedSince, where, order, null); - if (creditNotes.getCreditNotes().size() > 0) { - UUID CreditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - Attachments creditNotesAttachments = accountingApi.getCreditNoteAttachments(accessToken,xeroTenantId,CreditNoteID); - if (creditNotesAttachments.getAttachments().size() > 0) { - UUID CreditNoteAttachementID = creditNotesAttachments.getAttachments().get(0).getAttachmentID(); - String CreditNoteContentType = creditNotesAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream CreditNoteInput = accountingApi.getAccountAttachmentById(accessToken,xeroTenantId,CreditNoteID,CreditNoteAttachementID, CreditNoteContentType); - String CreditNoteFileName = "CreditNote_" + creditNotesAttachments.getAttachments().get(0).getFileName(); - String CreditNoteSaveFilePath = saveFile(CreditNoteInput,CreditNoteFileName); - messages.add("Get CreditNotes attachment - save it here: " + CreditNoteSaveFilePath); - } - } - - // GET Invoices Attachment - Invoices invoices = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - if (invoices.getInvoices().size() > 0) { - UUID InvoiceID = invoices.getInvoices().get(0).getInvoiceID(); - Attachments invoicesAttachments = accountingApi.getInvoiceAttachments(accessToken,xeroTenantId,InvoiceID); - if (invoicesAttachments.getAttachments().size() > 0) { - UUID InvoiceAttachementID = invoicesAttachments.getAttachments().get(0).getAttachmentID(); - String InvoiceContentType = invoicesAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream InvoiceInput = accountingApi.getAccountAttachmentById(accessToken,xeroTenantId,InvoiceID,InvoiceAttachementID, InvoiceContentType); - String InvoiceFileName = "Invoice_" + invoicesAttachments.getAttachments().get(0).getFileName(); - String InvoiceSaveFilePath = saveFile(InvoiceInput,InvoiceFileName); - messages.add("Get Invoices attachment - save it here: " + InvoiceSaveFilePath); - } - } - - // GET ManualJournals Attachment - where= null; - ManualJournals manualJournals = accountingApi.getManualJournals(accessToken,xeroTenantId,ifModifiedSince, where, order, null); - if (manualJournals.getManualJournals().size() > 0) { - UUID ManualJournalID = manualJournals.getManualJournals().get(0).getManualJournalID(); - Attachments manualJournalsAttachments = accountingApi.getManualJournalAttachments(accessToken,xeroTenantId,ManualJournalID); - if (manualJournalsAttachments.getAttachments().size() > 0) { - UUID ManualJournalAttachementID = manualJournalsAttachments.getAttachments().get(0).getAttachmentID(); - String ManualJournalContentType = manualJournalsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream ManualJournalInput = accountingApi.getAccountAttachmentById(accessToken,xeroTenantId,ManualJournalID,ManualJournalAttachementID, ManualJournalContentType); - String ManualJournalFileName = "ManualJournal_" + manualJournalsAttachments.getAttachments().get(0).getFileName(); - String ManualJournalSaveFilePath = saveFile(ManualJournalInput,ManualJournalFileName); - messages.add("Get ManualJournals attachment - save it here: " + ManualJournalSaveFilePath); - } - } - - // GET Receipts Attachment - Receipts receipts = accountingApi.getReceipts(accessToken,xeroTenantId,ifModifiedSince, where, order, null); - if (receipts.getReceipts().size() > 0) { - UUID ReceiptID = receipts.getReceipts().get(0).getReceiptID(); - Attachments receiptsAttachments = accountingApi.getReceiptAttachments(accessToken,xeroTenantId,ReceiptID); - if (receiptsAttachments.getAttachments().size() > 0) { - UUID ReceiptAttachementID = receiptsAttachments.getAttachments().get(0).getAttachmentID(); - String ReceiptContentType = receiptsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream ReceiptInput = accountingApi.getAccountAttachmentById(accessToken,xeroTenantId,ReceiptID,ReceiptAttachementID, ReceiptContentType); - String ReceiptFileName = "Receipt_" + receiptsAttachments.getAttachments().get(0).getFileName(); - String ReceiptSaveFilePath = saveFile(ReceiptInput,ReceiptFileName); - messages.add("Get Receipts attachment - save it here: " + ReceiptSaveFilePath); - } - } - - // GET RepeatingInvoices Attachment - RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(accessToken,xeroTenantId,where, order); - if (repeatingInvoices.getRepeatingInvoices().size() > 0) { - UUID RepeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - Attachments repeatingInvoicesAttachments = accountingApi.getRepeatingInvoiceAttachments(accessToken,xeroTenantId,RepeatingInvoiceID); - if (repeatingInvoicesAttachments.getAttachments().size() > 0) { - UUID RepeatingInvoiceAttachementID = repeatingInvoicesAttachments.getAttachments().get(0).getAttachmentID(); - String RepeatingInvoiceContentType = repeatingInvoicesAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream RepeatingInvoiceInput = accountingApi.getAccountAttachmentById(accessToken,xeroTenantId,RepeatingInvoiceID,RepeatingInvoiceAttachementID, RepeatingInvoiceContentType); - String RepeatingInvoiceFileName = "RepeatingInvoice_" + repeatingInvoicesAttachments.getAttachments().get(0).getFileName(); - String RepeatingInvoiceSaveFilePath = saveFile(RepeatingInvoiceInput,RepeatingInvoiceFileName); - messages.add("Get RepeatingInvoices attachment - save it here: " + RepeatingInvoiceSaveFilePath); - } - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("CreateAttachments")) { - // JSON - File bytes = new File("/Users/sid.maestre/eclipse-workspace/xero-sdk-oauth2-dev-01/resources/youngsid.jpg"); - String newFileName = bytes.getName(); - - try { - // CREATE Accounts attachment - where = "Status==\"ACTIVE\""; - Accounts myAccounts = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - if ( myAccounts.getAccounts().size() > 0) { - UUID accountID = myAccounts.getAccounts().get(0).getAccountID(); - String accountName = myAccounts.getAccounts().get(0).getName(); - Attachments createdAttachments = accountingApi.createAccountAttachmentByFileName(accessToken,xeroTenantId,accountID, newFileName, bytes); - messages.add("Attachment to Name: " + accountName + " Account ID: " + accountID + " attachment - ID: " + createdAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - where = null; - // CREATE BankTransactions attachment - BankTransactions myBanktransactions = accountingApi.getBankTransactions(accessToken,xeroTenantId,ifModifiedSince, where, order, null, null); - if ( myBanktransactions.getBankTransactions().size() > 0) { - UUID banktransactionID = myBanktransactions.getBankTransactions().get(0).getBankTransactionID(); - Attachments createdBanktransationAttachments = accountingApi.createBankTransactionAttachmentByFileName(accessToken,xeroTenantId,banktransactionID, newFileName, bytes); - messages.add("Attachment to BankTransaction ID: " + banktransactionID + " attachment - ID: " + createdBanktransationAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE BankTransfer attachment - BankTransfers myBankTransfer = accountingApi.getBankTransfers(accessToken,xeroTenantId,ifModifiedSince, where, order); - if ( myBankTransfer.getBankTransfers().size() > 0) { - UUID bankTransferID = myBankTransfer.getBankTransfers().get(0).getBankTransferID(); - Attachments createdBankTransferAttachments = accountingApi.createBankTransferAttachmentByFileName(accessToken,xeroTenantId,bankTransferID, newFileName, bytes); - messages.add("Attachment to BankTransfer ID: " + bankTransferID + " attachment - ID: " + createdBankTransferAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE Contacts attachment - where = "ContactStatus==\"ACTIVE\""; - Contacts contactsWhere = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - if ( contactsWhere.getContacts().size() > 0) { - UUID contactID = contactsWhere.getContacts().get(0).getContactID(); - Attachments createdContactAttachments = accountingApi.createContactAttachmentByFileName(accessToken,xeroTenantId,contactID, newFileName, bytes); - messages.add("Attachment to Contact ID: " + contactID + " attachment - ID: " + createdContactAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - where = "Status==\"AUTHORISED\""; - // CREATE CreditNotes attachment - CreditNotes myCreditNotes = accountingApi.getCreditNotes(accessToken,xeroTenantId,ifModifiedSince, where, order, null); - if ( myCreditNotes.getCreditNotes().size() > 0) { - UUID creditNoteID = myCreditNotes.getCreditNotes().get(0).getCreditNoteID(); - Attachments createdCreditNoteAttachments = accountingApi.createCreditNoteAttachmentByFileName(accessToken,xeroTenantId,creditNoteID, newFileName, bytes); - messages.add("Attachment to Credit Notes ID: " + creditNoteID + " attachment - ID: " + createdCreditNoteAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE invoice attachment - Invoices myInvoices = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - if ( myInvoices.getInvoices().size() > 0) { - UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); - Attachments createdInvoiceAttachments = accountingApi.createInvoiceAttachmentByFileName(accessToken,xeroTenantId,invoiceID, newFileName, bytes); - messages.add("Attachment to Invoice ID: " + invoiceID + " attachment - ID: " + createdInvoiceAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE ManualJournals attachment - where= null; - ManualJournals myManualJournals = accountingApi.getManualJournals(accessToken,xeroTenantId,ifModifiedSince, where, order, null); - System.out.println(myManualJournals.getManualJournals().size()); - - if ( myManualJournals.getManualJournals().size() > 0) { - UUID manualJournalID = myManualJournals.getManualJournals().get(0).getManualJournalID(); - Attachments createdManualJournalAttachments = accountingApi.createManualJournalAttachmentByFileName(accessToken,xeroTenantId,manualJournalID, newFileName, bytes); - messages.add("Attachment to Manual Journal ID: " + manualJournalID + " attachment - ID: " + createdManualJournalAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE Receipts attachment - Receipts myReceipts = accountingApi.getReceipts(accessToken,xeroTenantId,ifModifiedSince, where, order, null); - if ( myReceipts.getReceipts().size() > 0) { - UUID receiptID = myReceipts.getReceipts().get(0).getReceiptID(); - Attachments createdReceiptsAttachments = accountingApi.createReceiptAttachmentByFileName(accessToken,xeroTenantId,receiptID, newFileName, bytes); - messages.add("Attachment to Receipt ID: " + receiptID + " attachment - ID: " + createdReceiptsAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE Repeating Invoices attachment - RepeatingInvoices myRepeatingInvoices = accountingApi.getRepeatingInvoices(accessToken,xeroTenantId,where, order); - if ( myRepeatingInvoices.getRepeatingInvoices().size() > 0) { - UUID repeatingInvoiceID = myRepeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - Attachments createdRepeatingInvoiceAttachments = accountingApi.createRepeatingInvoiceAttachmentByFileName(accessToken,xeroTenantId,repeatingInvoiceID, newFileName, bytes); - messages.add("Attachment to Repeating Invoices ID: " + repeatingInvoiceID + " attachment - ID: " + createdRepeatingInvoiceAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("BankTransfers")) { - /* BANK TRANSFER */ - try { - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - where = null; - // Maker sure we have at least 2 banks - if(accountsWhere.getAccounts().size() > 1) { - // CREATE bank transfer - BankTransfer bankTransfer = new BankTransfer(); - bankTransfer.setFromBankAccount(accountsWhere.getAccounts().get(1)); - bankTransfer.setToBankAccount(accountsWhere.getAccounts().get(0)); - bankTransfer.setAmount("50.00"); - BankTransfers newBTs = new BankTransfers(); - newBTs.addBankTransfersItem(bankTransfer); - BankTransfers newBankTranfer = accountingApi.createBankTransfer(accessToken,xeroTenantId,newBTs); - messages.add("Get a one Bank Transfer - amount : " + newBankTranfer.getBankTransfers().get(0).getAmount()); - - // GET all Bank Transfers - BankTransfers bankTranfers = accountingApi.getBankTransfers(accessToken,xeroTenantId,ifModifiedSince, where, order); - messages.add("Get a all Bank Transfers - total : " + bankTranfers.getBankTransfers().size()); - UUID bankTransferId = bankTranfers.getBankTransfers().get(0).getBankTransferID(); - - // GET one Bank Transfer - BankTransfers oneBankTranfer = accountingApi.getBankTransfer(accessToken,xeroTenantId,bankTransferId); - messages.add("Get a one Bank Transfer - amount : " + oneBankTranfer.getBankTransfers().get(0).getAmount()); - - // GET Bank Transfer History - HistoryRecords hr = accountingApi.getBankTransferHistory(accessToken,xeroTenantId,bankTransferId); - messages.add("Get a one Bank Transfer History Record - details :" + hr.getHistoryRecords().get(0).getDetails()); - - // CREATE Bank Transfer History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords historyRecords = new HistoryRecords(); - HistoryRecord historyRecord = new HistoryRecord(); - historyRecord.setDetails("This is a sample history note"); - historyRecords.addHistoryRecordsItem(historyRecord); - HistoryRecords newHr = accountingApi.createBankTransferHistoryRecord(bankTransferId, historyRecords); - messages.add("Get a one Bank Transfer History Record - details :" + newHr.getHistoryRecords().get(0).getDetails()); - */ - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } + + try { + // GET Account Attachment + where = "Status==\"ACTIVE\""; + Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); + if (accounts.getAccounts().size() > 0) { + UUID accountID = accounts.getAccounts().get(0).getAccountID(); + Attachments accountsAttachments = accountingApi.getAccountAttachments(accessToken, xeroTenantId, + accountID); + if (accountsAttachments.getAttachments().size() > 0) { + UUID attachementId = accountsAttachments.getAttachments().get(0).getAttachmentID(); + String contentType = accountsAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream input = accountingApi.getAccountAttachmentById(accessToken, xeroTenantId, + accountID, attachementId, contentType); + String fileName = "Account_" + accountsAttachments.getAttachments().get(0).getFileName(); + String saveFilePath = saveFile(input, fileName); + messages.add("Get Account attachment - save it here: " + saveFilePath); + } + } + + // GET BankTransactions Attachment + where = null; + BankTransactions bankTransactions = accountingApi.getBankTransactions(accessToken, xeroTenantId, + ifModifiedSince, where, order, null, null); + if (bankTransactions.getBankTransactions().size() > 0) { + UUID BankTransactionID = bankTransactions.getBankTransactions().get(0).getBankTransactionID(); + Attachments bankTransactionsAttachments = accountingApi.getBankTransactionAttachments(accessToken, + xeroTenantId, BankTransactionID); + if (bankTransactionsAttachments.getAttachments().size() > 0) { + UUID BankTransactionAttachementID = bankTransactionsAttachments.getAttachments().get(0) + .getAttachmentID(); + String BankTransactionContentType = bankTransactionsAttachments.getAttachments().get(0) + .getMimeType(); + ByteArrayInputStream BankTransactionInput = accountingApi.getAccountAttachmentById(accessToken, + xeroTenantId, BankTransactionID, BankTransactionAttachementID, + BankTransactionContentType); + String BankTransactionFileName = "BankTransaction_" + + bankTransactionsAttachments.getAttachments().get(0).getFileName(); + String BankTransactionSaveFilePath = saveFile(BankTransactionInput, BankTransactionFileName); + messages.add("Get BankTransactions attachment - save it here: " + BankTransactionSaveFilePath); + } + } + + // GET BankTransfers Attachment + BankTransfers bankTransfers = accountingApi.getBankTransfers(accessToken, xeroTenantId, ifModifiedSince, + where, order); + if (bankTransfers.getBankTransfers().size() > 0) { + UUID BankTransferID = bankTransfers.getBankTransfers().get(0).getBankTransferID(); + Attachments bankTransfersAttachments = accountingApi.getBankTransferAttachments(accessToken, + xeroTenantId, BankTransferID); + if (bankTransfersAttachments.getAttachments().size() > 0) { + UUID BankTransferAttachementID = bankTransfersAttachments.getAttachments().get(0) + .getAttachmentID(); + String BankTransferContentType = bankTransfersAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream BankTransferInput = accountingApi.getAccountAttachmentById(accessToken, + xeroTenantId, BankTransferID, BankTransferAttachementID, BankTransferContentType); + String BankTransferFileName = "BankTransfer_" + + bankTransfersAttachments.getAttachments().get(0).getFileName(); + String BankTransferSaveFilePath = saveFile(BankTransferInput, BankTransferFileName); + messages.add("Get BankTransfers attachment - save it here: " + BankTransferSaveFilePath); + } + } + // GET Contacts Attachment + where = "ContactStatus==\"ACTIVE\""; + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, null, includeArchived); + if (contacts.getContacts().size() > 0) { + UUID ContactID = contacts.getContacts().get(0).getContactID(); + Attachments contactsAttachments = accountingApi.getContactAttachments(accessToken, xeroTenantId, + ContactID); + if (contactsAttachments.getAttachments().size() > 0) { + UUID ContactAttachementID = contactsAttachments.getAttachments().get(0).getAttachmentID(); + String ContactContentType = contactsAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream ContactInput = accountingApi.getAccountAttachmentById(accessToken, + xeroTenantId, ContactID, ContactAttachementID, ContactContentType); + String ContactFileName = "Contact_" + contactsAttachments.getAttachments().get(0).getFileName(); + String ContactSaveFilePath = saveFile(ContactInput, ContactFileName); + messages.add("Get Contacts attachment - save it here: " + ContactSaveFilePath); + } + } + // GET CreditNotes Attachment + where = "Status==\"AUTHORISED\""; + CreditNotes creditNotes = accountingApi.getCreditNotes(accessToken, xeroTenantId, ifModifiedSince, + where, order, null); + if (creditNotes.getCreditNotes().size() > 0) { + UUID CreditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); + Attachments creditNotesAttachments = accountingApi.getCreditNoteAttachments(accessToken, + xeroTenantId, CreditNoteID); + if (creditNotesAttachments.getAttachments().size() > 0) { + UUID CreditNoteAttachementID = creditNotesAttachments.getAttachments().get(0).getAttachmentID(); + String CreditNoteContentType = creditNotesAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream CreditNoteInput = accountingApi.getAccountAttachmentById(accessToken, + xeroTenantId, CreditNoteID, CreditNoteAttachementID, CreditNoteContentType); + String CreditNoteFileName = "CreditNote_" + + creditNotesAttachments.getAttachments().get(0).getFileName(); + String CreditNoteSaveFilePath = saveFile(CreditNoteInput, CreditNoteFileName); + messages.add("Get CreditNotes attachment - save it here: " + CreditNoteSaveFilePath); + } + } + + // GET Invoices Attachment + Invoices invoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + if (invoices.getInvoices().size() > 0) { + UUID InvoiceID = invoices.getInvoices().get(0).getInvoiceID(); + Attachments invoicesAttachments = accountingApi.getInvoiceAttachments(accessToken, xeroTenantId, + InvoiceID); + if (invoicesAttachments.getAttachments().size() > 0) { + UUID InvoiceAttachementID = invoicesAttachments.getAttachments().get(0).getAttachmentID(); + String InvoiceContentType = invoicesAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream InvoiceInput = accountingApi.getAccountAttachmentById(accessToken, + xeroTenantId, InvoiceID, InvoiceAttachementID, InvoiceContentType); + String InvoiceFileName = "Invoice_" + invoicesAttachments.getAttachments().get(0).getFileName(); + String InvoiceSaveFilePath = saveFile(InvoiceInput, InvoiceFileName); + messages.add("Get Invoices attachment - save it here: " + InvoiceSaveFilePath); + } + } + + // GET ManualJournals Attachment + where = null; + ManualJournals manualJournals = accountingApi.getManualJournals(accessToken, xeroTenantId, + ifModifiedSince, where, order, null); + if (manualJournals.getManualJournals().size() > 0) { + UUID ManualJournalID = manualJournals.getManualJournals().get(0).getManualJournalID(); + Attachments manualJournalsAttachments = accountingApi.getManualJournalAttachments(accessToken, + xeroTenantId, ManualJournalID); + if (manualJournalsAttachments.getAttachments().size() > 0) { + UUID ManualJournalAttachementID = manualJournalsAttachments.getAttachments().get(0) + .getAttachmentID(); + String ManualJournalContentType = manualJournalsAttachments.getAttachments().get(0) + .getMimeType(); + ByteArrayInputStream ManualJournalInput = accountingApi.getAccountAttachmentById(accessToken, + xeroTenantId, ManualJournalID, ManualJournalAttachementID, ManualJournalContentType); + String ManualJournalFileName = "ManualJournal_" + + manualJournalsAttachments.getAttachments().get(0).getFileName(); + String ManualJournalSaveFilePath = saveFile(ManualJournalInput, ManualJournalFileName); + messages.add("Get ManualJournals attachment - save it here: " + ManualJournalSaveFilePath); + } + } + + // GET Receipts Attachment + Receipts receipts = accountingApi.getReceipts(accessToken, xeroTenantId, ifModifiedSince, where, order, + null); + if (receipts.getReceipts().size() > 0) { + UUID ReceiptID = receipts.getReceipts().get(0).getReceiptID(); + Attachments receiptsAttachments = accountingApi.getReceiptAttachments(accessToken, xeroTenantId, + ReceiptID); + if (receiptsAttachments.getAttachments().size() > 0) { + UUID ReceiptAttachementID = receiptsAttachments.getAttachments().get(0).getAttachmentID(); + String ReceiptContentType = receiptsAttachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream ReceiptInput = accountingApi.getAccountAttachmentById(accessToken, + xeroTenantId, ReceiptID, ReceiptAttachementID, ReceiptContentType); + String ReceiptFileName = "Receipt_" + receiptsAttachments.getAttachments().get(0).getFileName(); + String ReceiptSaveFilePath = saveFile(ReceiptInput, ReceiptFileName); + messages.add("Get Receipts attachment - save it here: " + ReceiptSaveFilePath); + } + } + + // GET RepeatingInvoices Attachment + RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(accessToken, xeroTenantId, + where, order); + if (repeatingInvoices.getRepeatingInvoices().size() > 0) { + UUID RepeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); + Attachments repeatingInvoicesAttachments = accountingApi.getRepeatingInvoiceAttachments(accessToken, + xeroTenantId, RepeatingInvoiceID); + if (repeatingInvoicesAttachments.getAttachments().size() > 0) { + UUID RepeatingInvoiceAttachementID = repeatingInvoicesAttachments.getAttachments().get(0) + .getAttachmentID(); + String RepeatingInvoiceContentType = repeatingInvoicesAttachments.getAttachments().get(0) + .getMimeType(); + ByteArrayInputStream RepeatingInvoiceInput = accountingApi.getAccountAttachmentById(accessToken, + xeroTenantId, RepeatingInvoiceID, RepeatingInvoiceAttachementID, + RepeatingInvoiceContentType); + String RepeatingInvoiceFileName = "RepeatingInvoice_" + + repeatingInvoicesAttachments.getAttachments().get(0).getFileName(); + String RepeatingInvoiceSaveFilePath = saveFile(RepeatingInvoiceInput, RepeatingInvoiceFileName); + messages.add( + "Get RepeatingInvoices attachment - save it here: " + RepeatingInvoiceSaveFilePath); + } + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("CreateAttachments")) { + // JSON + File bytes = new File("/Users/sid.maestre/eclipse-workspace/xero-sdk-oauth2-dev-01/resources/youngsid.jpg"); + String newFileName = bytes.getName(); + + try { + // CREATE Accounts attachment + where = "Status==\"ACTIVE\""; + Accounts myAccounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, + order); + if (myAccounts.getAccounts().size() > 0) { + UUID accountID = myAccounts.getAccounts().get(0).getAccountID(); + String accountName = myAccounts.getAccounts().get(0).getName(); + Attachments createdAttachments = accountingApi.createAccountAttachmentByFileName(accessToken, + xeroTenantId, accountID, newFileName, bytes); + messages.add("Attachment to Name: " + accountName + " Account ID: " + accountID + + " attachment - ID: " + createdAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + try { + where = null; + // CREATE BankTransactions attachment + BankTransactions myBanktransactions = accountingApi.getBankTransactions(accessToken, xeroTenantId, + ifModifiedSince, where, order, null, null); + if (myBanktransactions.getBankTransactions().size() > 0) { + UUID banktransactionID = myBanktransactions.getBankTransactions().get(0).getBankTransactionID(); + Attachments createdBanktransationAttachments = accountingApi + .createBankTransactionAttachmentByFileName(accessToken, xeroTenantId, banktransactionID, + newFileName, bytes); + messages.add("Attachment to BankTransaction ID: " + banktransactionID + " attachment - ID: " + + createdBanktransationAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + try { + // CREATE BankTransfer attachment + BankTransfers myBankTransfer = accountingApi.getBankTransfers(accessToken, xeroTenantId, + ifModifiedSince, where, order); + if (myBankTransfer.getBankTransfers().size() > 0) { + UUID bankTransferID = myBankTransfer.getBankTransfers().get(0).getBankTransferID(); + Attachments createdBankTransferAttachments = accountingApi.createBankTransferAttachmentByFileName( + accessToken, xeroTenantId, bankTransferID, newFileName, bytes); + messages.add("Attachment to BankTransfer ID: " + bankTransferID + " attachment - ID: " + + createdBankTransferAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + try { + // CREATE Contacts attachment + where = "ContactStatus==\"ACTIVE\""; + Contacts contactsWhere = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, + order, ids, null, includeArchived); + if (contactsWhere.getContacts().size() > 0) { + UUID contactID = contactsWhere.getContacts().get(0).getContactID(); + Attachments createdContactAttachments = accountingApi.createContactAttachmentByFileName(accessToken, + xeroTenantId, contactID, newFileName, bytes); + messages.add("Attachment to Contact ID: " + contactID + " attachment - ID: " + + createdContactAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + try { + where = "Status==\"AUTHORISED\""; + // CREATE CreditNotes attachment + CreditNotes myCreditNotes = accountingApi.getCreditNotes(accessToken, xeroTenantId, ifModifiedSince, + where, order, null); + if (myCreditNotes.getCreditNotes().size() > 0) { + UUID creditNoteID = myCreditNotes.getCreditNotes().get(0).getCreditNoteID(); + Attachments createdCreditNoteAttachments = accountingApi.createCreditNoteAttachmentByFileName( + accessToken, xeroTenantId, creditNoteID, newFileName, bytes); + messages.add("Attachment to Credit Notes ID: " + creditNoteID + " attachment - ID: " + + createdCreditNoteAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + try { + // CREATE invoice attachment + Invoices myInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, + order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + if (myInvoices.getInvoices().size() > 0) { + UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); + Attachments createdInvoiceAttachments = accountingApi.createInvoiceAttachmentByFileName(accessToken, + xeroTenantId, invoiceID, newFileName, bytes); + messages.add("Attachment to Invoice ID: " + invoiceID + " attachment - ID: " + + createdInvoiceAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + try { + // CREATE ManualJournals attachment + where = null; + ManualJournals myManualJournals = accountingApi.getManualJournals(accessToken, xeroTenantId, + ifModifiedSince, where, order, null); + System.out.println(myManualJournals.getManualJournals().size()); + + if (myManualJournals.getManualJournals().size() > 0) { + UUID manualJournalID = myManualJournals.getManualJournals().get(0).getManualJournalID(); + Attachments createdManualJournalAttachments = accountingApi.createManualJournalAttachmentByFileName( + accessToken, xeroTenantId, manualJournalID, newFileName, bytes); + messages.add("Attachment to Manual Journal ID: " + manualJournalID + " attachment - ID: " + + createdManualJournalAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + try { + // CREATE Receipts attachment + Receipts myReceipts = accountingApi.getReceipts(accessToken, xeroTenantId, ifModifiedSince, where, + order, null); + if (myReceipts.getReceipts().size() > 0) { + UUID receiptID = myReceipts.getReceipts().get(0).getReceiptID(); + Attachments createdReceiptsAttachments = accountingApi.createReceiptAttachmentByFileName( + accessToken, xeroTenantId, receiptID, newFileName, bytes); + messages.add("Attachment to Receipt ID: " + receiptID + " attachment - ID: " + + createdReceiptsAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + try { + // CREATE Repeating Invoices attachment + RepeatingInvoices myRepeatingInvoices = accountingApi.getRepeatingInvoices(accessToken, xeroTenantId, + where, order); + if (myRepeatingInvoices.getRepeatingInvoices().size() > 0) { + UUID repeatingInvoiceID = myRepeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); + Attachments createdRepeatingInvoiceAttachments = accountingApi + .createRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, + newFileName, bytes); + messages.add("Attachment to Repeating Invoices ID: " + repeatingInvoiceID + " attachment - ID: " + + createdRepeatingInvoiceAttachments.getAttachments().get(0).getAttachmentID()); + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } else if (object.equals("BankTransfers")) { + /* BANK TRANSFER */ + try { + where = "Status==\"ACTIVE\"&&Type==\"BANK\""; + Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, + order); + where = null; + // Maker sure we have at least 2 banks + if (accountsWhere.getAccounts().size() > 1) { + // CREATE bank transfer + BankTransfer bankTransfer = new BankTransfer(); + bankTransfer.setFromBankAccount(accountsWhere.getAccounts().get(1)); + bankTransfer.setToBankAccount(accountsWhere.getAccounts().get(0)); + bankTransfer.setAmount("50.00"); + BankTransfers newBTs = new BankTransfers(); + newBTs.addBankTransfersItem(bankTransfer); + BankTransfers newBankTranfer = accountingApi.createBankTransfer(accessToken, xeroTenantId, newBTs); + messages.add("Get a one Bank Transfer - amount : " + + newBankTranfer.getBankTransfers().get(0).getAmount()); + + // GET all Bank Transfers + BankTransfers bankTranfers = accountingApi.getBankTransfers(accessToken, xeroTenantId, + ifModifiedSince, where, order); + messages.add("Get a all Bank Transfers - total : " + bankTranfers.getBankTransfers().size()); + UUID bankTransferId = bankTranfers.getBankTransfers().get(0).getBankTransferID(); + + // GET one Bank Transfer + BankTransfers oneBankTranfer = accountingApi.getBankTransfer(accessToken, xeroTenantId, + bankTransferId); + messages.add("Get a one Bank Transfer - amount : " + + oneBankTranfer.getBankTransfers().get(0).getAmount()); + + // GET Bank Transfer History + HistoryRecords hr = accountingApi.getBankTransferHistory(accessToken, xeroTenantId, bankTransferId); + messages.add("Get a one Bank Transfer History Record - details :" + + hr.getHistoryRecords().get(0).getDetails()); + + // CREATE Bank Transfer History + // Error: "The document with the supplied id was not found for this endpoint. + /* + * HistoryRecords historyRecords = new HistoryRecords(); HistoryRecord + * historyRecord = new HistoryRecord(); + * historyRecord.setDetails("This is a sample history note"); + * historyRecords.addHistoryRecordsItem(historyRecord); HistoryRecords newHr = + * accountingApi.createBankTransferHistoryRecord(bankTransferId, + * historyRecords); + * messages.add("Get a one Bank Transfer History Record - details :" + + * newHr.getHistoryRecords().get(0).getDetails()); + */ + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } } else if (object.equals("BankTransactions")) { - /* BANK TRANSACTION */ - try { - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - - Account bankAcct = new Account(); - bankAcct.setCode(accountsWhere.getAccounts().get(0).getCode()); - - where = null; - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // Maker sure we have at least 1 bank - if(accountsWhere.getAccounts().size() > 0) { - // Create Bank Transaction - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode("400"); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setUnitAmount(20.0); - lineItems.add(li); - BankTransaction bt = new BankTransaction(); - bt.setBankAccount(bankAcct); - bt.setContact(useContact); - bt.setLineitems(lineItems); - bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.SPEND); - BankTransactions bts = new BankTransactions(); - bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(accessToken,xeroTenantId,bts, summarizeErrors); - messages.add("Create new BankTransaction : amount:" + newBankTransaction.getBankTransactions().get(0).getTotal()); - - // GET all Bank Transaction - BankTransactions bankTransactions = accountingApi.getBankTransactions(accessToken,xeroTenantId,ifModifiedSince, where, order, null, null); - messages.add("Get a all Bank Transactions - total : " + bankTransactions.getBankTransactions().size()); - - // GET one Bank Transaction - BankTransactions oneBankTransaction = accountingApi.getBankTransaction(accessToken,xeroTenantId,bankTransactions.getBankTransactions().get(0).getBankTransactionID()); - messages.add("Get a one Bank Transaction : amount:" + oneBankTransaction.getBankTransactions().get(0).getTotal()); - - // UDPATE Bank Transaction - newBankTransaction.getBankTransactions().get(0).setSubTotal(null); - newBankTransaction.getBankTransactions().get(0).setTotal(null); - newBankTransaction.getBankTransactions().get(0).setReference("You just updated"); - BankTransactions updateBankTransaction = accountingApi.updateBankTransaction(accessToken,xeroTenantId,newBankTransaction.getBankTransactions().get(0).getBankTransactionID(),newBankTransaction); - messages.add("Update new BankTransaction : reference:" + updateBankTransaction.getBankTransactions().get(0).getReference()); - - // DELETE Bank Transaction - newBankTransaction.getBankTransactions().get(0).setStatus(com.xero.models.accounting.BankTransaction.StatusEnum.DELETED); - BankTransactions deletedBankTransaction = accountingApi.updateBankTransaction(accessToken,xeroTenantId,newBankTransaction.getBankTransactions().get(0).getBankTransactionID(),newBankTransaction); - messages.add("Deleted new Bank Transaction : Status:" + deletedBankTransaction.getBankTransactions().get(0).getStatus()); - - // GET Bank Transaction History - HistoryRecords hr = accountingApi.getBankTransactionsHistory(accessToken,xeroTenantId,oneBankTransaction.getBankTransactions().get(0).getBankTransactionID()); - messages.add("Get a one Bank Transaction History Record - details :" + hr.getHistoryRecords().get(0).getDetails()); - - // CREATE Bank Transaction History - // Error: "The document with the supplied id was not found for this end point. - /* - HistoryRecords historyRecords = new HistoryRecords(); - HistoryRecord historyRecord = new HistoryRecord(); - historyRecord.setDetails("This is a sample history note"); - historyRecords.addHistoryRecordsItem(historyRecord); - HistoryRecords newHr = accountingApi.createBankTransactionHistoryRecord(oneBankTransaction.getBankTransactions().get(0).getBankTransactionID(), historyRecords); - messages.add("Create a one Bank Transaction History Record - details :" + newHr.getHistoryRecords().get(0).getDetails()); - */ - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } + /* BANK TRANSACTION */ + try { + where = "Status==\"ACTIVE\"&&Type==\"BANK\""; + Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, + order); + + Account bankAcct = new Account(); + bankAcct.setCode(accountsWhere.getAccounts().get(0).getCode()); + + where = null; + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + // Maker sure we have at least 1 bank + if (accountsWhere.getAccounts().size() > 0) { + // Create Bank Transaction + List lineItems = new ArrayList<>(); + LineItem li = new LineItem(); + li.setAccountCode("400"); + li.setDescription("Foobar"); + li.setQuantity(1.0); + li.setUnitAmount(20.0); + lineItems.add(li); + BankTransaction bt = new BankTransaction(); + bt.setBankAccount(bankAcct); + bt.setContact(useContact); + bt.setLineitems(lineItems); + bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.SPEND); + BankTransactions bts = new BankTransactions(); + bts.addBankTransactionsItem(bt); + BankTransactions newBankTransaction = accountingApi.createBankTransaction(accessToken, xeroTenantId, + bts, summarizeErrors); + messages.add("Create new BankTransaction : amount:" + + newBankTransaction.getBankTransactions().get(0).getTotal()); + + // GET all Bank Transaction + BankTransactions bankTransactions = accountingApi.getBankTransactions(accessToken, xeroTenantId, + ifModifiedSince, where, order, null, null); + messages.add( + "Get a all Bank Transactions - total : " + bankTransactions.getBankTransactions().size()); + + // GET one Bank Transaction + BankTransactions oneBankTransaction = accountingApi.getBankTransaction(accessToken, xeroTenantId, + bankTransactions.getBankTransactions().get(0).getBankTransactionID()); + messages.add("Get a one Bank Transaction : amount:" + + oneBankTransaction.getBankTransactions().get(0).getTotal()); + + // UDPATE Bank Transaction + newBankTransaction.getBankTransactions().get(0).setSubTotal(null); + newBankTransaction.getBankTransactions().get(0).setTotal(null); + newBankTransaction.getBankTransactions().get(0).setReference("You just updated"); + BankTransactions updateBankTransaction = accountingApi.updateBankTransaction(accessToken, + xeroTenantId, newBankTransaction.getBankTransactions().get(0).getBankTransactionID(), + newBankTransaction); + messages.add("Update new BankTransaction : reference:" + + updateBankTransaction.getBankTransactions().get(0).getReference()); + + // DELETE Bank Transaction + newBankTransaction.getBankTransactions().get(0) + .setStatus(com.xero.models.accounting.BankTransaction.StatusEnum.DELETED); + BankTransactions deletedBankTransaction = accountingApi.updateBankTransaction(accessToken, + xeroTenantId, newBankTransaction.getBankTransactions().get(0).getBankTransactionID(), + newBankTransaction); + messages.add("Deleted new Bank Transaction : Status:" + + deletedBankTransaction.getBankTransactions().get(0).getStatus()); + + // GET Bank Transaction History + HistoryRecords hr = accountingApi.getBankTransactionsHistory(accessToken, xeroTenantId, + oneBankTransaction.getBankTransactions().get(0).getBankTransactionID()); + messages.add("Get a one Bank Transaction History Record - details :" + + hr.getHistoryRecords().get(0).getDetails()); + + // CREATE Bank Transaction History + // Error: "The document with the supplied id was not found for this end point. + /* + * HistoryRecords historyRecords = new HistoryRecords(); HistoryRecord + * historyRecord = new HistoryRecord(); + * historyRecord.setDetails("This is a sample history note"); + * historyRecords.addHistoryRecordsItem(historyRecord); HistoryRecords newHr = + * accountingApi.createBankTransactionHistoryRecord(oneBankTransaction. + * getBankTransactions().get(0).getBankTransactionID(), historyRecords); + * messages.add("Create a one Bank Transaction History Record - details :" + + * newHr.getHistoryRecords().get(0).getDetails()); + */ + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } } else if (object.equals("BatchPayments")) { - //BATCH PAYMENTS - try { - // CREATE payment - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - Invoice inv2 = new Invoice(); - inv2.setInvoiceID(allInvoices.getInvoices().get(1).getInvoiceID()); - Invoice inv3 = new Invoice(); - inv3.setInvoiceID(allInvoices.getInvoices().get(3).getInvoiceID()); - where = null; - - where = "EnablePaymentsToAccount==true"; - Accounts accountsWhere = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - Account paymentAccount = new Account(); - paymentAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); - where = null; - - BatchPayments createBatchPayments = new BatchPayments(); - BatchPayment createBatchPayment = new BatchPayment(); - createBatchPayment.setAccount(paymentAccount); - createBatchPayment.setAmount(3.0); - LocalDate currDate = LocalDate.now(); - createBatchPayment.setDate(currDate); - createBatchPayment.setReference("Foobar" + loadRandomNum()); - - Payment payment01 = new Payment(); - payment01.setAccount(paymentAccount); - payment01.setInvoice(inv); - payment01.setAmount(1.0); - payment01.setDate(currDate); - - Payment payment02 = new Payment(); - payment02.setAccount(paymentAccount); - payment02.setInvoice(inv2); - payment02.setAmount(1.0); - payment02.setDate(currDate); - - Payment payment03 = new Payment(); - payment03.setAccount(paymentAccount); - payment03.setInvoice(inv3); - payment03.setAmount(1.0); - payment03.setDate(currDate); - - createBatchPayment.addPaymentsItem(payment01); - createBatchPayment.addPaymentsItem(payment02); - createBatchPayment.addPaymentsItem(payment03); - - createBatchPayments.addBatchPaymentsItem(createBatchPayment); - - BatchPayments newBatchPayments = accountingApi.createBatchPayment(accessToken,xeroTenantId,createBatchPayments); - messages.add("Create BatchPayments - ID : " + newBatchPayments.getBatchPayments().get(0).getTotalAmount()); - - // GET all Payments - BatchPayments allBatchPayments = accountingApi.getBatchPayments(accessToken,xeroTenantId,ifModifiedSince, where, order); - messages.add("Get BatchPayments - Total : " + allBatchPayments.getBatchPayments().size()); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } + // BATCH PAYMENTS + try { + // CREATE payment + where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; + Invoices allInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, + order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoice inv = new Invoice(); + inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); + Invoice inv2 = new Invoice(); + inv2.setInvoiceID(allInvoices.getInvoices().get(1).getInvoiceID()); + Invoice inv3 = new Invoice(); + inv3.setInvoiceID(allInvoices.getInvoices().get(3).getInvoiceID()); + where = null; + + where = "EnablePaymentsToAccount==true"; + Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, + order); + Account paymentAccount = new Account(); + paymentAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); + where = null; + + BatchPayments createBatchPayments = new BatchPayments(); + BatchPayment createBatchPayment = new BatchPayment(); + createBatchPayment.setAccount(paymentAccount); + createBatchPayment.setAmount(3.0); + LocalDate currDate = LocalDate.now(); + createBatchPayment.setDate(currDate); + createBatchPayment.setReference("Foobar" + loadRandomNum()); + + Payment payment01 = new Payment(); + payment01.setAccount(paymentAccount); + payment01.setInvoice(inv); + payment01.setAmount(1.0); + payment01.setDate(currDate); + + Payment payment02 = new Payment(); + payment02.setAccount(paymentAccount); + payment02.setInvoice(inv2); + payment02.setAmount(1.0); + payment02.setDate(currDate); + + Payment payment03 = new Payment(); + payment03.setAccount(paymentAccount); + payment03.setInvoice(inv3); + payment03.setAmount(1.0); + payment03.setDate(currDate); + + createBatchPayment.addPaymentsItem(payment01); + createBatchPayment.addPaymentsItem(payment02); + createBatchPayment.addPaymentsItem(payment03); + + createBatchPayments.addBatchPaymentsItem(createBatchPayment); + + BatchPayments newBatchPayments = accountingApi.createBatchPayment(accessToken, xeroTenantId, + createBatchPayments); + messages.add( + "Create BatchPayments - ID : " + newBatchPayments.getBatchPayments().get(0).getTotalAmount()); + + // GET all Payments + BatchPayments allBatchPayments = accountingApi.getBatchPayments(accessToken, xeroTenantId, + ifModifiedSince, where, order); + messages.add("Get BatchPayments - Total : " + allBatchPayments.getBatchPayments().size()); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } } else if (object.equals("BrandingThemes")) { - /* BRANDING THEME */ - try { - // GET all BrandingTheme - BrandingThemes bt = accountingApi.getBrandingThemes(accessToken,xeroTenantId); - messages.add("Get a All Branding Themes - total : " + bt.getBrandingThemes().size()); - - // GET one BrandingTheme - UUID btID = bt.getBrandingThemes().get(0).getBrandingThemeID(); - BrandingThemes oneBt = accountingApi.getBrandingTheme(accessToken,xeroTenantId,btID); - messages.add("Get a one Branding Themes - name : " + oneBt.getBrandingThemes().get(0).getName()); -/* - // Create PaymentService for a Branding Theme - PaymentServices paymentServices = accountingApi.getPaymentServices(); - UUID paymentServiceID = paymentServices.getPaymentServices().get(0).getPaymentServiceID(); - PaymentService btPaymentService = new PaymentService(); - btPaymentService.setPaymentServiceType("Custom"); - btPaymentService.setPaymentServiceID(paymentServiceID); - PaymentServices createdPaymentService = accountingApi.createBrandingThemePaymentServices(btID, btPaymentService); - messages.add("Created payment services for Branding Themes - name : " + createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); -*/ - // GET Payment Services for a single Branding Theme - PaymentServices paymentServicesForBrandingTheme = accountingApi.getBrandingThemePaymentServices(accessToken,xeroTenantId,btID); - messages.add("Get payment services for Branding Themes - name : " + paymentServicesForBrandingTheme.getPaymentServices().get(0).getPaymentServiceName()); - - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Contacts")) { - /* CONTACTS */ - try { - // CREATE contact - Contact contact = new Contact(); - contact.setName("Foo" + loadRandomNum()); - contact.setEmailAddress("sid" + loadRandomNum() + "@blah.com"); - List phones = new ArrayList(); - Phone phone = new Phone(); - phone.setPhoneType(PhoneTypeEnum.MOBILE); - phone.setPhoneNumber("555-1212"); - phone.setPhoneAreaCode("415"); - phones.add(phone); - contact.setPhones(phones); - Contacts newContact = accountingApi.createContact(accessToken,xeroTenantId,contact); - messages.add("Create new Contact - Name : " + newContact.getContacts().get(0).getName()); - - // UPDATE contact - newContact.getContacts().get(0).setName("Foo"); - UUID contactID = newContact.getContacts().get(0).getContactID(); - Contacts updatedContact = accountingApi.updateContact(accessToken,xeroTenantId,contactID, newContact); - messages.add("Update new Contact - Name : " + updatedContact.getContacts().get(0).getName()); - - // GET all contact - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - messages.add("Get a All Contacts - Total : " + contacts.getContacts().size()); - - // GET one contact - UUID oneContactID = contacts.getContacts().get(0).getContactID(); - Contacts oneContact = accountingApi.getContact(accessToken,xeroTenantId,oneContactID); - messages.add("Get a One Contact - Name : " + oneContact.getContacts().get(0).getName()); - - // GET contact cisSettings - where = "Name==\"sidney\""; - Contacts cisContact = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - if (cisContact.getContacts().size() > 0) { - CISSettings cisSettings = accountingApi.getContactCISSettings(accessToken,xeroTenantId,cisContact.getContacts().get(0).getContactID()); - messages.add("Get a Contact cisSettings - Enabled? : " + cisSettings.getCiSSettings().get(0).getCiSEnabled()); - } - - where = null; - // GET active contacts - where = "ContactStatus==\"ACTIVE\""; - Contacts contactsWhere = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - messages.add("Get a all ACTIVE Contacts - Total : " + contactsWhere.getContacts().size()); - where = null; - - // Get Contact History - HistoryRecords contactHistory = accountingApi.getContactHistory(accessToken,xeroTenantId,contactID); - messages.add("Contact History - count : " + contactHistory.getHistoryRecords().size() ); - - // Create Contact History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - - HistoryRecords newInvoiceHistory = accountingApi.createContactHistory(accessToken,xeroTenantId,contactID,newHistoryRecords); - messages.add("Contact History - note added to : " + newInvoiceHistory.getHistoryRecords().get(0).getDetails()); - - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } + /* BRANDING THEME */ + try { + // GET all BrandingTheme + BrandingThemes bt = accountingApi.getBrandingThemes(accessToken, xeroTenantId); + messages.add("Get a All Branding Themes - total : " + bt.getBrandingThemes().size()); + + // GET one BrandingTheme + UUID btID = bt.getBrandingThemes().get(0).getBrandingThemeID(); + BrandingThemes oneBt = accountingApi.getBrandingTheme(accessToken, xeroTenantId, btID); + messages.add("Get a one Branding Themes - name : " + oneBt.getBrandingThemes().get(0).getName()); + /* + * // Create PaymentService for a Branding Theme PaymentServices paymentServices + * = accountingApi.getPaymentServices(); UUID paymentServiceID = + * paymentServices.getPaymentServices().get(0).getPaymentServiceID(); + * PaymentService btPaymentService = new PaymentService(); + * btPaymentService.setPaymentServiceType("Custom"); + * btPaymentService.setPaymentServiceID(paymentServiceID); PaymentServices + * createdPaymentService = + * accountingApi.createBrandingThemePaymentServices(btID, btPaymentService); + * messages.add("Created payment services for Branding Themes - name : " + + * createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); + */ + // GET Payment Services for a single Branding Theme + PaymentServices paymentServicesForBrandingTheme = accountingApi + .getBrandingThemePaymentServices(accessToken, xeroTenantId, btID); + messages.add("Get payment services for Branding Themes - name : " + + paymentServicesForBrandingTheme.getPaymentServices().get(0).getPaymentServiceName()); + + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Contacts")) { + /* CONTACTS */ + try { + // CREATE contact + Contact contact = new Contact(); + contact.setName("Foo" + loadRandomNum()); + contact.setEmailAddress("sid" + loadRandomNum() + "@blah.com"); + List phones = new ArrayList(); + Phone phone = new Phone(); + phone.setPhoneType(PhoneTypeEnum.MOBILE); + phone.setPhoneNumber("555-1212"); + phone.setPhoneAreaCode("415"); + phones.add(phone); + contact.setPhones(phones); + Contacts newContact = accountingApi.createContact(accessToken, xeroTenantId, contact); + messages.add("Create new Contact - Name : " + newContact.getContacts().get(0).getName()); + + // UPDATE contact + newContact.getContacts().get(0).setName("Foo"); + UUID contactID = newContact.getContacts().get(0).getContactID(); + Contacts updatedContact = accountingApi.updateContact(accessToken, xeroTenantId, contactID, newContact); + messages.add("Update new Contact - Name : " + updatedContact.getContacts().get(0).getName()); + + // GET all contact + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, null, includeArchived); + messages.add("Get a All Contacts - Total : " + contacts.getContacts().size()); + + // GET one contact + UUID oneContactID = contacts.getContacts().get(0).getContactID(); + Contacts oneContact = accountingApi.getContact(accessToken, xeroTenantId, oneContactID); + messages.add("Get a One Contact - Name : " + oneContact.getContacts().get(0).getName()); + + // GET contact cisSettings + where = "Name==\"sidney\""; + Contacts cisContact = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, + order, ids, null, includeArchived); + if (cisContact.getContacts().size() > 0) { + CISSettings cisSettings = accountingApi.getContactCISSettings(accessToken, xeroTenantId, + cisContact.getContacts().get(0).getContactID()); + messages.add("Get a Contact cisSettings - Enabled? : " + + cisSettings.getCiSSettings().get(0).getCiSEnabled()); + } + + where = null; + // GET active contacts + where = "ContactStatus==\"ACTIVE\""; + Contacts contactsWhere = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, + order, ids, null, includeArchived); + messages.add("Get a all ACTIVE Contacts - Total : " + contactsWhere.getContacts().size()); + where = null; + + // Get Contact History + HistoryRecords contactHistory = accountingApi.getContactHistory(accessToken, xeroTenantId, contactID); + messages.add("Contact History - count : " + contactHistory.getHistoryRecords().size()); + + // Create Contact History + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + + HistoryRecords newInvoiceHistory = accountingApi.createContactHistory(accessToken, xeroTenantId, + contactID, newHistoryRecords); + messages.add("Contact History - note added to : " + + newInvoiceHistory.getHistoryRecords().get(0).getDetails()); + + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } } else if (object.equals("ContactGroups")) { - - /* CONTACT GROUP */ - try { - // Create contact group - ContactGroups newCGs = new ContactGroups(); - ContactGroup cg = new ContactGroup(); - cg.setName("NewGroup" + loadRandomNum()); - newCGs.addContactGroupsItem(cg); - ContactGroups newContactGroup = accountingApi.createContactGroup(accessToken,xeroTenantId,newCGs); - messages.add("Create a ContactGroup - Name : " + newContactGroup.getContactGroups().get(0).getName()); - - // UPDATE Contact group - newCGs.getContactGroups().get(0).setName("Old Group" + loadRandomNum()); - UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - ContactGroups updateContactGroup = accountingApi.updateContactGroup(accessToken,xeroTenantId,newContactGroupID, newCGs); - messages.add("Update a ContactGroup - Name : " + updateContactGroup.getContactGroups().get(0).getName()); - - // GET all contact groups - ContactGroups contactGroups = accountingApi.getContactGroups(accessToken,xeroTenantId,where, order); - messages.add("Get all ContactGroups - Total : " + contactGroups.getContactGroups().size()); - - // GET one contact groups - UUID contactGroupId = contactGroups.getContactGroups().get(0).getContactGroupID(); - ContactGroups oneCg = accountingApi.getContactGroup(accessToken,xeroTenantId,contactGroupId); - messages.add("Get one ContactGroups - Name : " + oneCg.getContactGroups().get(0).getName()); - - // DELETE contact Group - newCGs.getContactGroups().get(0).setStatus(com.xero.models.accounting.ContactGroup.StatusEnum.DELETED); - UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - ContactGroups deletedContactGroup = accountingApi.updateContactGroup(accessToken,xeroTenantId,contactGroupID, contactGroups); - messages.add("Delete a ContactGroup - Name : " + deletedContactGroup.getContactGroups().get(0).getName()); - - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("ContactGroupContacts")) { - /* CONTACT GROUP CONTACTS */ - try { - // Create new Contact Group - ContactGroups newCGs = new ContactGroups(); - ContactGroup cg = new ContactGroup(); - cg.setName("NewGroup" + loadRandomNum()); - newCGs.addContactGroupsItem(cg); - ContactGroups newContactGroup = accountingApi.createContactGroup(accessToken,xeroTenantId,newCGs); - - Contacts allContacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - - // Create Contacts in Group - Contacts contactList = new Contacts(); - contactList.addContactsItem(allContacts.getContacts().get(0)); - contactList.addContactsItem(allContacts.getContacts().get(1)); - UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - Contacts addContacts = accountingApi.createContactGroupContacts(accessToken,xeroTenantId,contactGroupID, contactList); - messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts.getContacts().size()); - - // DELETE all Contacts in Group - accountingApi.deleteContactGroupContacts(accessToken,xeroTenantId,newContactGroup.getContactGroups().get(0).getContactGroupID()); - messages.add("Delete All Contacts to Contact Group - no content in response "); - - ContactGroups oneCg = accountingApi.getContactGroup(accessToken,xeroTenantId,newContactGroup.getContactGroups().get(0).getContactGroupID()); - messages.add("Get ContactGroups - Total Contacts : " + oneCg.getContactGroups().get(0).getContacts().size()); - - // DELETE Single Contact - Contacts contactList2 = new Contacts(); - contactList2.addContactsItem(allContacts.getContacts().get(3)); - contactList2.addContactsItem(allContacts.getContacts().get(4)); - - UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - Contacts addContacts2 = accountingApi.createContactGroupContacts(accessToken,xeroTenantId,newContactGroupID, contactList2); - messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts2.getContacts().size()); - - // DELETE Single CONACTS - accountingApi.deleteContactGroupContact(accessToken,xeroTenantId,newContactGroup.getContactGroups().get(0).getContactGroupID(),allContacts.getContacts().get(3).getContactID()); - messages.add("Delete 1 contact from Contact Group - no content in response"); - - ContactGroups oneCg2 = accountingApi.getContactGroup(accessToken,xeroTenantId,newContactGroup.getContactGroups().get(0).getContactGroupID()); - messages.add("Get ContactGroups - Total Contacts : " + oneCg2.getContactGroups().get(0).getContacts().size()); - - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("CreditNotesPDF")) { - // GET CreditNote As a PDF - CreditNotes creditNotes = accountingApi.getCreditNotes(accessToken,xeroTenantId,ifModifiedSince, where, order, null); - UUID creditNoteId = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - ByteArrayInputStream CreditNoteInput = accountingApi.getCreditNoteAsPdf(accessToken,xeroTenantId,creditNoteId, "application/pdf"); - String CreditNoteFileName = "CreditNoteAsPDF.pdf"; - - String CreditNoteSaveFilePath = saveFile(CreditNoteInput,CreditNoteFileName); - messages.add("Get CreditNote attachment - save it here: " + CreditNoteSaveFilePath); - - } else if (object.equals("CreditNotes")) { - // CREDIT NOTE - try { - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - - // Create Credit Note - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode("400"); - li.setDescription("Foobar"); - li.setQuantity(2.0); - li.setUnitAmount(20.0); - lineItems.add(li); - - CreditNotes newCNs = new CreditNotes(); - CreditNote cn = new CreditNote(); - cn.setContact(contacts.getContacts().get(0)); - cn.setLineItems(lineItems); - cn.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT); - newCNs.addCreditNotesItem(cn); - CreditNotes newCreditNote = accountingApi.createCreditNote(accessToken,xeroTenantId,newCNs, summarizeErrors); - messages.add("Create a CreditNote - Amount : " + newCreditNote.getCreditNotes().get(0).getTotal()); - UUID newCreditNoteId = newCreditNote.getCreditNotes().get(0).getCreditNoteID(); - - // GET all Credit Note - CreditNotes creditNotes = accountingApi.getCreditNotes(accessToken,xeroTenantId,ifModifiedSince, where, order, null); - messages.add("Get all CreditNotes - Total : " + creditNotes.getCreditNotes().size()); - - // GET One Credit Note - UUID creditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - CreditNotes oneCreditNote = accountingApi.getCreditNote(accessToken,xeroTenantId,creditNoteID); - messages.add("Get a CreditNote - Amount : " + oneCreditNote.getCreditNotes().get(0).getTotal()); - - // UPDATE Credit Note - newCNs.getCreditNotes().get(0).setStatus(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED); - CreditNotes updatedCreditNote = accountingApi.updateCreditNote(accessToken,xeroTenantId,newCreditNoteId, newCNs); - messages.add("Update a CreditNote - Ref : " + updatedCreditNote.getCreditNotes().get(0).getReference()); - - // Allocate Credit Note - Allocations allocations = new Allocations(); - Allocation allocation = new Allocation(); - - where = "Status==\"AUTHORISED\"&&Type==\"ACCPAY\""; - Invoices allInvoices = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - allocation.setInvoice(inv); - allocation.setAmount(1.0); - LocalDate currDate = LocalDate.now(); - allocation.setDate(currDate); - allocations.addAllocationsItem(allocation); - where = null; - - Allocations allocatedCreditNote = accountingApi.createCreditNoteAllocation(accessToken,xeroTenantId,newCreditNoteId,allocations); - messages.add("Update CreditNote Allocation - Amount : " + allocatedCreditNote.getAllocations().get(0).getAmount()); - - // Get Invoice History - HistoryRecords history = accountingApi.getCreditNoteHistory(accessToken,xeroTenantId,creditNoteID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create Invoice History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - - HistoryRecords newHistory = accountingApi.createCreditNoteHistory(accessToken,xeroTenantId,creditNoteID, newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Currencies")) { - - /* CURRENCY */ - // JSON - incomplete - try { - //Get All - Currencies currencies = accountingApi.getCurrencies(accessToken,xeroTenantId,where, order); - messages.add("Get all Currencies - Total : " + currencies.getCurrencies().size()); - - // Create New -// Error: 400 - /* - Currency curr = new Currency(); - curr.setCode(CurrencyCode.SGD); - Currencies currs = new Currencies(); - currs.addCurrenciesItem(curr); - Currencies newCurrency = accountingApi.createCurrency(currs); - messages.add("New Currencies - Code : " + newCurrency.getCurrencies().get(0).getCode()); - */ - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Employees")) { - // EMPLOYEE - try { - - // Create - Employee employee = new Employee(); - employee.setFirstName("Sam"); - employee.setLastName("Jackson" + loadRandomNum()); - ExternalLink extLink = new ExternalLink(); - extLink.setUrl("http://twitter.com/#!/search/Homer+Simpson"); - employee.setExternalLink(extLink); - Employees emps = new Employees(); - emps.addEmployeesItem(employee); - - Employees newEmployee = accountingApi.createEmployee(accessToken,xeroTenantId,emps); - messages.add("Create an Employee - Last Name : " + newEmployee.getEmployees().get(0).getLastName()); - - //Get All - Employees employees = accountingApi.getEmployees(accessToken,xeroTenantId,ifModifiedSince, where, order); - messages.add("Get all Employees - Total : " + employees.getEmployees().size()); - - UUID newEmpId = employees.getEmployees().get(0).getEmployeeID(); - - // Get One - Employees oneEmployee = accountingApi.getEmployee(accessToken,xeroTenantId,newEmpId); - messages.add("Get one Employees - Name : " + oneEmployee.getEmployees().get(0).getFirstName()); - -// 404 ERROR - // Update No EmployeeID as part of URI - first/last name used as unique key - ExternalLink extLink2 = new ExternalLink(); - extLink2.setUrl("http://twitter.com/#!/search/Bart+Simpson"); - newEmployee.getEmployees().get(0).setExternalLink(extLink2); - - Employees updateEmployee = accountingApi.updateEmployee(accessToken,xeroTenantId,newEmpId, newEmployee); - messages.add("Update an Employee - Last Name : " + updateEmployee.getEmployees().get(0).getLastName()); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("ExpenseClaims")) { - // EXPENSE CLAIM - try { - //Create - //where = "IsSubscriber==true"; - Users users = accountingApi.getUsers(accessToken,xeroTenantId,ifModifiedSince, where, order); - where = null; - - where = "ShowInExpenseClaims==true&&Status==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - where = null; - - if (users.getUsers().size() > 0) { - User user = new User(); - user.setUserID(users.getUsers().get(0).getUserID()); - - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // CREATE NEW RECEIPT - Receipts receipts = new Receipts(); - Receipt receipt = new Receipt(); - - LineItem li = new LineItem(); - li.setAccountCode(accounts.getAccounts().get(0).getCode()); - li.setDescription("Foobar"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - receipt.addLineitemsItem(li); - receipt.setUser(user); - receipt.lineAmountTypes(LineAmountTypes.NOTAX); - receipt.contact(useContact); - receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); - receipts.addReceiptsItem(receipt); - Receipts newReceipts = accountingApi.createReceipt(accessToken,xeroTenantId,receipts); - - // CREATE EXPENSE CLAIM - ExpenseClaims createExpenseClaims = new ExpenseClaims(); - ExpenseClaim expenseClaim = new ExpenseClaim(); - expenseClaim.setUser(user); - - Receipts myReceipts = new Receipts(); - Receipt myReceipt = new Receipt(); - myReceipt.setReceiptID(newReceipts.getReceipts().get(0).getReceiptID()); - myReceipts.addReceiptsItem(myReceipt); - expenseClaim.setReceipts(myReceipts.getReceipts()); - expenseClaim.setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED); - createExpenseClaims.addExpenseClaimsItem(expenseClaim); - ExpenseClaims newExpenseClaims = accountingApi.createExpenseClaim(accessToken,xeroTenantId,createExpenseClaims, summarizeErrors); - messages.add("Create new Expense Claim - Status : " + newExpenseClaims.getExpenseClaims().get(0).getStatus()); - - // UPDATE EXPENSE CLAIM - createExpenseClaims.getExpenseClaims().get(0).setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED); - UUID expenseClaimID = newExpenseClaims.getExpenseClaims().get(0).getExpenseClaimID(); - ExpenseClaims updateExpenseClaims = accountingApi.updateExpenseClaim(accessToken,xeroTenantId,expenseClaimID, createExpenseClaims); - messages.add("Update new Expense Claim - Status : " + updateExpenseClaims.getExpenseClaims().get(0).getStatus()); - - //Get All Expense Claims - ExpenseClaims expenseClaims = accountingApi.getExpenseClaims(accessToken,xeroTenantId,ifModifiedSince, where, order); - messages.add("Get all Expense Claim - Total : " + expenseClaims.getExpenseClaims().size()); - - // Get One Expense Claim - ExpenseClaims oneExpenseClaim = accountingApi.getExpenseClaim(accessToken,xeroTenantId,expenseClaims.getExpenseClaims().get(0).getExpenseClaimID()); - messages.add("Get one Expense Claim - Total : " + oneExpenseClaim.getExpenseClaims().get(0).getStatus()); - - // VOID EXPENSE CLAIM - createExpenseClaims.getExpenseClaims().get(0).setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.VOIDED); - ExpenseClaims voidExpenseClaims = accountingApi.updateExpenseClaim(accessToken,xeroTenantId,expenseClaimID, createExpenseClaims); - messages.add("Void new Expense Claim - Status : " + voidExpenseClaims.getExpenseClaims().get(0).getStatus()); - - // Get Invoice History - HistoryRecords history = accountingApi.getExpenseClaimHistory(accessToken,xeroTenantId,expenseClaimID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create Invoice History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createExpenseClaimHistory(expenseClaimID, newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - */ - } else { - System.out.println("No User Found"); - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Invoices")) { - // INVOICE - - // GET Invoice As a PDF - Invoices myInvoicesForPDF = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - UUID invoiceIDForPDF = myInvoicesForPDF.getInvoices().get(0).getInvoiceID(); - ByteArrayInputStream InvoiceNoteInput = accountingApi.getInvoiceAsPdf(accessToken,xeroTenantId,invoiceIDForPDF, "application/pdf"); - String InvoiceFileName = "InvoiceAsPDF.pdf"; - String InvoiceSaveFilePath = saveFile(InvoiceNoteInput,InvoiceFileName); - messages.add("Get Invoice attachment - save it here: " + InvoiceSaveFilePath); - - // Create Invoice - where = "Type==\"REVENUE\""; - Accounts accounts = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - String accountCodeForInvoice = accounts.getAccounts().get(0).getCode(); - where = null; - - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - - UUID contactIDForInvoice = contacts.getContacts().get(0).getContactID(); - - for(int i=0; i > contacts.getContacts().size(); i++) { - String email = contacts.getContacts().get(i).getEmailAddress().toString(); - - if ( email != null && !email.isEmpty()) { - contactIDForInvoice = contacts.getContacts().get(i).getContactID(); - break; - } - } - - contactIDForInvoice = UUID.fromString("9f857fe0-4a14-408b-b526-4f742db3b079"); - Contact useContact = new Contact(); - useContact.setContactID(contactIDForInvoice); - - Invoices newInvoices = new Invoices(); - Invoice myInvoice = new Invoice(); - - LineItem li = new LineItem(); - li.setAccountCode(accountCodeForInvoice); - li.setDescription("Acme Tires"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - myInvoice.addLineItemsItem(li); - myInvoice.setContact(useContact); - LocalDate dueDate = LocalDate.of(2018,Month.DECEMBER,10); - myInvoice.setDueDate(dueDate); - LocalDate todayDate = LocalDate.now(); - myInvoice.setDate(todayDate); - myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); - myInvoice.setReference("One Fish, Two Fish"); - myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); - newInvoices.addInvoicesItem(myInvoice); - - Invoices newInvoice = accountingApi.createInvoice(accessToken,xeroTenantId,newInvoices, summarizeErrors); - messages.add("Create invoice - Reference : " + newInvoice.getInvoices().get(0).getReference()); - UUID newInvoiceID = newInvoice.getInvoices().get(0).getInvoiceID(); - Invoices updateInvoices = new Invoices(); - Invoice updateInvoice = new Invoice(); - updateInvoice.setInvoiceID(newInvoiceID); - updateInvoice.setReference("Red Fish, Blue Fish"); - updateInvoices.addInvoicesItem(updateInvoice); - - Invoices updatedInvoice = accountingApi.updateInvoice(accessToken,xeroTenantId,newInvoiceID,updateInvoices); - messages.add("Update invoice - Reference : " + updatedInvoice.getInvoices().get(0).getReference()); - - //Get All - Invoices invoices = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - messages.add("Get all invoices - Total : " + invoices.getInvoices().size()); - - //Get Invoice If-Modified-Since - OffsetDateTime invModified = OffsetDateTime.of(LocalDateTime.of(2018, 12, 06, 15, 00), ZoneOffset.UTC); - Invoices invoicesSince = accountingApi.getInvoices(accessToken,xeroTenantId,invModified, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - messages.add("Get all invoices - Since Modfied Date - Total : " + invoicesSince.getInvoices().size()); - - // Get One - Invoices oneInvoice = accountingApi.getInvoice(accessToken,xeroTenantId,invoices.getInvoices().get(0).getInvoiceID()); - messages.add("Get one invoice - total : " + oneInvoice.getInvoices().get(0).getTotal()); - LocalDate myDate = oneInvoice.getInvoices().get(0).getDate(); - OffsetDateTime myUTC = oneInvoice.getInvoices().get(0).getUpdatedDateUTC(); - - // Get Online Invoice - OnlineInvoices onlineInvoice = accountingApi.getOnlineInvoice(accessToken,xeroTenantId,newInvoiceID); - messages.add("Get Online invoice - URL : " + onlineInvoice.getOnlineInvoices().get(0).getOnlineInvoiceUrl()); - - // Email Invoice - RequestEmpty empty = new RequestEmpty(); - accountingApi.emailInvoice(accessToken,xeroTenantId,newInvoiceID,empty); - messages.add("Email invoice - no content in response"); - - // Get Invoice History - HistoryRecords history = accountingApi.getInvoiceHistory(accessToken,xeroTenantId,newInvoiceID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create Invoice History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createInvoiceHistory(accessToken,xeroTenantId,newInvoiceID,newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - - // CREATE invoice attachment - statuses = "AUTHORISED"; - Invoices myInvoices = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); - - File requestBodyFile = new File("/Users/sid.maestre/eclipse-workspace/xero-sdk-oauth2-dev-01/resources/youngsid.jpg"); - String newFileName = requestBodyFile.getName(); - - Attachments createdAttachments = accountingApi.createInvoiceAttachmentByFileName(accessToken,xeroTenantId,invoiceID, newFileName, requestBodyFile); - messages.add("Attachment to Invoice complete - ID: " + createdAttachments.getAttachments().get(0).getAttachmentID()); - - // GET Invoice Attachment - System.out.println(invoiceID); - Attachments attachments = accountingApi.getInvoiceAttachments(accessToken,xeroTenantId,invoiceID); - System.out.println(attachments.getAttachments().get(0).getFileName()); - UUID attachementId = attachments.getAttachments().get(0).getAttachmentID(); - String contentType = attachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream InvoiceAttachmentInput = accountingApi.getInvoiceAttachmentById(accessToken,xeroTenantId,invoiceID,attachementId, contentType); - - String InvoiceAttachmentFileName = attachments.getAttachments().get(0).getFileName(); - String InvoiceAttachmentSaveFilePath = saveFile(InvoiceAttachmentInput,InvoiceAttachmentFileName); - messages.add("Get Invoice attachment - save it here: " + InvoiceAttachmentSaveFilePath); - - } else if (object.equals("InvoiceReminders")) { - // INVOICE REMINDER - try { - InvoiceReminders invReminders = accountingApi.getInvoiceReminders(accessToken,xeroTenantId); - messages.add("Get a Invoice Reminder - Is Enabled: " + invReminders.getInvoiceReminders().get(0).getEnabled() ); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Items")) { - // ITEM - try { - // Create Items - Items myItems = new Items(); - Item myItem = new Item(); - myItem.setCode("abc" + loadRandomNum()); - myItem.setDescription("foobar"); - myItem.setName("Hello"+loadRandomNum()); - myItems.addItemsItem(myItem); - Items newItems = accountingApi.createItem(accessToken,xeroTenantId,myItems); - messages.add("Create new item - Description : " + newItems.getItems().get(0).getDescription()); - UUID newItemId = newItems.getItems().get(0).getItemID(); - - // Update Item - newItems.getItems().get(0).setDescription("Barfoo"); - Items updateItem = accountingApi.updateItem(accessToken,xeroTenantId,newItemId, newItems); - messages.add("Update item - Description : " + updateItem.getItems().get(0).getDescription()); - - //Get All Items - Items items = accountingApi.getItems(accessToken,xeroTenantId,ifModifiedSince, where, order, null); - messages.add("Get all items - Total : " + items.getItems().size()); - - // Get One Item - UUID itemId = items.getItems().get(0).getItemID(); - Items oneItem = accountingApi.getItem(accessToken,xeroTenantId,itemId); - messages.add("Get one item - Description : " + oneItem.getItems().get(0).getDescription()); - - // Get Invoice History - HistoryRecords history = accountingApi.getItemHistory(accessToken,xeroTenantId,itemId); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create Invoice History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords createdHistory = accountingApi.createItemHistory(itemId,newHistoryRecords); - messages.add("History - note added to : " + createdHistory.getHistoryRecords().get(0).getDetails()); - */ - - //Delete - accountingApi.deleteItem(accessToken,xeroTenantId,newItemId); - messages.add("Delete one item - no content in response"); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Journals")) { - // JOURNAL - try { - - boolean paymentsOnly = false; - // GET all Journals - Journals journals = accountingApi.getJournals(accessToken,xeroTenantId,ifModifiedSince, null, paymentsOnly); - messages.add("Get Journals - total : " + journals.getJournals().size()); - - // GET Journal with offset - Journals journalsOffset = accountingApi.getJournals(accessToken,xeroTenantId,ifModifiedSince, null, paymentsOnly); - messages.add("Get Journals offset - total : " + journalsOffset.getJournals().size()); -// 404 ERROR -/* - // GET one Journal - UUID journalId = journals.getJournals().get(0).getJournalID(); - Journals oneJournal = accountingApi.getJournal(journalId); - messages.add("Get one Journal - number : " + oneJournal.getJournals().get(0).getJournalNumber()); -*/ - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("LinkedTransactions")) { - - /* LINKED TRANSACTION */ - try { - // Create Linked Transaction - where = "Type==\"EXPENSE\""; - Accounts accounts = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - where = null; - - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - Invoices newInvoices = new Invoices(); - Invoice myInvoice = new Invoice(); - - LineItem li = new LineItem(); - li.setAccountCode(accounts.getAccounts().get(0).getCode()); - li.setDescription("Acme Tires"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - myInvoice.addLineItemsItem(li); - myInvoice.setContact(useContact); - LocalDate dueDate = LocalDate.of(2018,Month.OCTOBER,10); - myInvoice.setDueDate(dueDate); - LocalDate todayDate = LocalDate.now(); - myInvoice.setDate(todayDate); - myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCPAY); - myInvoice.setReference("One Fish, Two Fish"); - myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); - newInvoices.addInvoicesItem(myInvoice); - - Invoices newInvoice = accountingApi.createInvoice(accessToken,xeroTenantId,newInvoices, summarizeErrors); - - UUID sourceTransactionID1 = newInvoice.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID1 = newInvoice.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - LinkedTransactions newLinkedTransactions = new LinkedTransactions(); - LinkedTransaction newLinkedTransaction = new LinkedTransaction(); - newLinkedTransaction.setSourceTransactionID(sourceTransactionID1); - newLinkedTransaction.setSourceLineItemID(sourceLineItemID1); - newLinkedTransactions.addLinkedTransactionsItem(newLinkedTransaction); - - LinkedTransactions createdLinkedTransaction = accountingApi.createLinkedTransaction(accessToken,xeroTenantId,newLinkedTransactions); - messages.add("Create LinkedTransaction - Status : " + createdLinkedTransaction.getLinkedTransactions().get(0).getStatus()); - - // Created Linked Transaction 2 - Contact contact = new Contact(); - contact.setName("Foo" + loadRandomNum()); - contact.setEmailAddress("sid" + loadRandomNum() + "@blah.com"); - Contacts newContact = accountingApi.createContact(accessToken,xeroTenantId,contact); - UUID newContactID = newContact.getContacts().get(0).getContactID(); - - Invoices newInvoice2 = accountingApi.createInvoice(accessToken,xeroTenantId,newInvoices, summarizeErrors); - - UUID sourceTransactionID2 = newInvoice2.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID2 = newInvoice2.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - LinkedTransactions newLinkedTransactions2 = new LinkedTransactions(); - LinkedTransaction newLinkedTransaction2 = new LinkedTransaction(); - newLinkedTransaction2.setSourceTransactionID(sourceTransactionID2); - newLinkedTransaction2.setSourceLineItemID(sourceLineItemID2); - newLinkedTransaction2.setContactID(newContactID); - newLinkedTransactions2.addLinkedTransactionsItem(newLinkedTransaction2); - - LinkedTransactions createdLinkedTransaction2 = accountingApi.createLinkedTransaction(accessToken,xeroTenantId,newLinkedTransactions2); - messages.add("Create LinkedTransaction 2 - Status : " + createdLinkedTransaction2.getLinkedTransactions().get(0).getStatus()); - - // Created Linked Transaction 3 - Invoices newInvoicesAccRec = new Invoices(); - Invoice myInvoiceAccRec = new Invoice(); - - myInvoiceAccRec.addLineItemsItem(li); - myInvoiceAccRec.setContact(useContact); - - myInvoiceAccRec.setDueDate(dueDate); - myInvoiceAccRec.setDate(todayDate); - - myInvoiceAccRec.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); - myInvoiceAccRec.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); - newInvoicesAccRec.addInvoicesItem(myInvoiceAccRec); - - Invoices newInvoiceAccRec = accountingApi.createInvoice(accessToken,xeroTenantId,newInvoicesAccRec, summarizeErrors); - UUID sourceTransactionID4 = newInvoiceAccRec.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID4 = newInvoiceAccRec.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - - Invoices newInvoice3 = accountingApi.createInvoice(accessToken,xeroTenantId,newInvoices, summarizeErrors); - - UUID sourceTransactionID3 = newInvoice3.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID3 = newInvoice3.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - LinkedTransactions newLinkedTransactions3 = new LinkedTransactions(); - LinkedTransaction newLinkedTransaction3 = new LinkedTransaction(); - newLinkedTransaction3.setSourceTransactionID(sourceTransactionID3); - newLinkedTransaction3.setSourceLineItemID(sourceLineItemID3); - newLinkedTransaction3.setContactID(useContact.getContactID()); - newLinkedTransaction3.setTargetTransactionID(sourceTransactionID4); - newLinkedTransaction3.setTargetLineItemID(sourceLineItemID4); - newLinkedTransactions3.addLinkedTransactionsItem(newLinkedTransaction3); - - LinkedTransactions createdLinkedTransaction3 = accountingApi.createLinkedTransaction(accessToken,xeroTenantId,newLinkedTransactions3); - messages.add("Create LinkedTransaction 3 - Status : " + createdLinkedTransaction3.getLinkedTransactions().get(0).getStatus()); - - // GET all Link Transactions - - int page = 1; - String linkedTransactionID = null; - String sourceTransactionID = null; - String targetTransactionID = null; - String status = null; - String contactID = null; - LinkedTransactions linkTransactions = accountingApi.getLinkedTransactions(accessToken,xeroTenantId,page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); - messages.add("Get Link Transactions - total : " + linkTransactions.getLinkedTransactions().size()); - - // GET all Link Transactions - UUID linkedTransactionID2 = linkTransactions.getLinkedTransactions().get(0).getLinkedTransactionID(); - LinkedTransactions oneLinkTransaction = accountingApi.getLinkedTransaction(accessToken,xeroTenantId,linkedTransactionID2); - messages.add("Get one Link Transaction - Status : " + oneLinkTransaction.getLinkedTransactions().get(0).getStatus()); -// 500 Error - /* - // DELETE LINKEDTRANSACTION - UUID newLinkedTransactionID = createdLinkedTransaction.getLinkedTransactions().get(0).getLinkedTransactionID(); - accountingApi.deleteLinkedTransaction(newLinkedTransactionID); - messages.add("Delete LinkedTransaction - no content in response"); - */ - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("ManualJournals")) { - // MANUAL JOURNAL - try { - // Create Manual Journal - where = "Type==\"EXPENSE\" && Status ==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - String accountCode = accounts.getAccounts().get(0).getCode(); - where = null; - ManualJournals manualJournals = new ManualJournals(); - ManualJournal manualJournal = new ManualJournal(); - LocalDate currDate = LocalDate.now(); - manualJournal.setDate(currDate); - manualJournal.setNarration("Foo bar"); - - ManualJournalLine credit = new ManualJournalLine(); - credit.setDescription("Hello there"); - credit.setAccountCode(accountCode); - credit.setLineAmount(100.00); - manualJournal.addJournalLinesItem(credit); - - ManualJournalLine debit = new ManualJournalLine(); - debit.setDescription("Goodbye"); - debit.setAccountCode(accountCode); - debit.setLineAmount(-100.00); - manualJournal.addJournalLinesItem(debit); - manualJournals.addManualJournalsItem(manualJournal); - ManualJournals createdManualJournals = accountingApi.createManualJournal(accessToken,xeroTenantId,manualJournals); - UUID newManualJournalId = createdManualJournals.getManualJournals().get(0).getManualJournalID(); - messages.add("Create Manual Journal - Narration : " + createdManualJournals.getManualJournals().get(0).getNarration()); - - // GET all Manual Journal - ManualJournals getManualJournals = accountingApi.getManualJournals(accessToken,xeroTenantId,ifModifiedSince, where, order, null); - messages.add("Get Manual Journal - total : " + getManualJournals.getManualJournals().size()); - - // GET one Manual Journal - UUID manualJournalId = getManualJournals.getManualJournals().get(0).getManualJournalID(); - ManualJournals oneManualJournal = accountingApi.getManualJournal(accessToken,xeroTenantId,manualJournalId); - messages.add("Get one Manual Journal - Narration : " + oneManualJournal.getManualJournals().get(0).getNarration()); - - // Update Manual Journal - ManualJournals updateManualJournals = new ManualJournals(); - ManualJournal updateManualJournal = new ManualJournal(); - updateManualJournal.setManualJournalID(newManualJournalId); - updateManualJournal.setNarration("Hello Xero"); - updateManualJournals.addManualJournalsItem(updateManualJournal); - ManualJournals updatedManualJournal = accountingApi.updateManualJournal(accessToken,xeroTenantId,newManualJournalId,updateManualJournals); - messages.add("Update Manual Journal - Narration : " + updatedManualJournal.getManualJournals().get(0).getNarration()); - - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } + + /* CONTACT GROUP */ + try { + // Create contact group + ContactGroups newCGs = new ContactGroups(); + ContactGroup cg = new ContactGroup(); + cg.setName("NewGroup" + loadRandomNum()); + newCGs.addContactGroupsItem(cg); + ContactGroups newContactGroup = accountingApi.createContactGroup(accessToken, xeroTenantId, newCGs); + messages.add("Create a ContactGroup - Name : " + newContactGroup.getContactGroups().get(0).getName()); + + // UPDATE Contact group + newCGs.getContactGroups().get(0).setName("Old Group" + loadRandomNum()); + UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); + ContactGroups updateContactGroup = accountingApi.updateContactGroup(accessToken, xeroTenantId, + newContactGroupID, newCGs); + messages.add( + "Update a ContactGroup - Name : " + updateContactGroup.getContactGroups().get(0).getName()); + + // GET all contact groups + ContactGroups contactGroups = accountingApi.getContactGroups(accessToken, xeroTenantId, where, order); + messages.add("Get all ContactGroups - Total : " + contactGroups.getContactGroups().size()); + + // GET one contact groups + UUID contactGroupId = contactGroups.getContactGroups().get(0).getContactGroupID(); + ContactGroups oneCg = accountingApi.getContactGroup(accessToken, xeroTenantId, contactGroupId); + messages.add("Get one ContactGroups - Name : " + oneCg.getContactGroups().get(0).getName()); + + // DELETE contact Group + newCGs.getContactGroups().get(0).setStatus(com.xero.models.accounting.ContactGroup.StatusEnum.DELETED); + UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); + ContactGroups deletedContactGroup = accountingApi.updateContactGroup(accessToken, xeroTenantId, + contactGroupID, contactGroups); + messages.add( + "Delete a ContactGroup - Name : " + deletedContactGroup.getContactGroups().get(0).getName()); + + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("ContactGroupContacts")) { + /* CONTACT GROUP CONTACTS */ + try { + // Create new Contact Group + ContactGroups newCGs = new ContactGroups(); + ContactGroup cg = new ContactGroup(); + cg.setName("NewGroup" + loadRandomNum()); + newCGs.addContactGroupsItem(cg); + ContactGroups newContactGroup = accountingApi.createContactGroup(accessToken, xeroTenantId, newCGs); + + Contacts allContacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, + order, ids, null, includeArchived); + + // Create Contacts in Group + Contacts contactList = new Contacts(); + contactList.addContactsItem(allContacts.getContacts().get(0)); + contactList.addContactsItem(allContacts.getContacts().get(1)); + UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); + Contacts addContacts = accountingApi.createContactGroupContacts(accessToken, xeroTenantId, + contactGroupID, contactList); + messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts.getContacts().size()); + + // DELETE all Contacts in Group + accountingApi.deleteContactGroupContacts(accessToken, xeroTenantId, + newContactGroup.getContactGroups().get(0).getContactGroupID()); + messages.add("Delete All Contacts to Contact Group - no content in response "); + + ContactGroups oneCg = accountingApi.getContactGroup(accessToken, xeroTenantId, + newContactGroup.getContactGroups().get(0).getContactGroupID()); + messages.add( + "Get ContactGroups - Total Contacts : " + oneCg.getContactGroups().get(0).getContacts().size()); + + // DELETE Single Contact + Contacts contactList2 = new Contacts(); + contactList2.addContactsItem(allContacts.getContacts().get(3)); + contactList2.addContactsItem(allContacts.getContacts().get(4)); + + UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); + Contacts addContacts2 = accountingApi.createContactGroupContacts(accessToken, xeroTenantId, + newContactGroupID, contactList2); + messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts2.getContacts().size()); + + // DELETE Single CONACTS + accountingApi.deleteContactGroupContact(accessToken, xeroTenantId, + newContactGroup.getContactGroups().get(0).getContactGroupID(), + allContacts.getContacts().get(3).getContactID()); + messages.add("Delete 1 contact from Contact Group - no content in response"); + + ContactGroups oneCg2 = accountingApi.getContactGroup(accessToken, xeroTenantId, + newContactGroup.getContactGroups().get(0).getContactGroupID()); + messages.add("Get ContactGroups - Total Contacts : " + + oneCg2.getContactGroups().get(0).getContacts().size()); + + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("CreditNotesPDF")) { + // GET CreditNote As a PDF + CreditNotes creditNotes = accountingApi.getCreditNotes(accessToken, xeroTenantId, ifModifiedSince, where, + order, null); + UUID creditNoteId = creditNotes.getCreditNotes().get(0).getCreditNoteID(); + ByteArrayInputStream CreditNoteInput = accountingApi.getCreditNoteAsPdf(accessToken, xeroTenantId, + creditNoteId, "application/pdf"); + String CreditNoteFileName = "CreditNoteAsPDF.pdf"; + + String CreditNoteSaveFilePath = saveFile(CreditNoteInput, CreditNoteFileName); + messages.add("Get CreditNote attachment - save it here: " + CreditNoteSaveFilePath); + + } else if (object.equals("CreditNotes")) { + // CREDIT NOTE + try { + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, null, includeArchived); + + // Create Credit Note + List lineItems = new ArrayList<>(); + LineItem li = new LineItem(); + li.setAccountCode("400"); + li.setDescription("Foobar"); + li.setQuantity(2.0); + li.setUnitAmount(20.0); + lineItems.add(li); + + CreditNotes newCNs = new CreditNotes(); + CreditNote cn = new CreditNote(); + cn.setContact(contacts.getContacts().get(0)); + cn.setLineItems(lineItems); + cn.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT); + newCNs.addCreditNotesItem(cn); + CreditNotes newCreditNote = accountingApi.createCreditNote(accessToken, xeroTenantId, newCNs, + summarizeErrors); + messages.add("Create a CreditNote - Amount : " + newCreditNote.getCreditNotes().get(0).getTotal()); + UUID newCreditNoteId = newCreditNote.getCreditNotes().get(0).getCreditNoteID(); + + // GET all Credit Note + CreditNotes creditNotes = accountingApi.getCreditNotes(accessToken, xeroTenantId, ifModifiedSince, + where, order, null); + messages.add("Get all CreditNotes - Total : " + creditNotes.getCreditNotes().size()); + + // GET One Credit Note + UUID creditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); + CreditNotes oneCreditNote = accountingApi.getCreditNote(accessToken, xeroTenantId, creditNoteID); + messages.add("Get a CreditNote - Amount : " + oneCreditNote.getCreditNotes().get(0).getTotal()); + + // UPDATE Credit Note + newCNs.getCreditNotes().get(0).setStatus(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED); + CreditNotes updatedCreditNote = accountingApi.updateCreditNote(accessToken, xeroTenantId, + newCreditNoteId, newCNs); + messages.add("Update a CreditNote - Ref : " + updatedCreditNote.getCreditNotes().get(0).getReference()); + + // Allocate Credit Note + Allocations allocations = new Allocations(); + Allocation allocation = new Allocation(); + + where = "Status==\"AUTHORISED\"&&Type==\"ACCPAY\""; + Invoices allInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, + order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoice inv = new Invoice(); + inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); + allocation.setInvoice(inv); + allocation.setAmount(1.0); + LocalDate currDate = LocalDate.now(); + allocation.setDate(currDate); + allocations.addAllocationsItem(allocation); + where = null; + + Allocations allocatedCreditNote = accountingApi.createCreditNoteAllocation(accessToken, xeroTenantId, + newCreditNoteId, allocations); + messages.add("Update CreditNote Allocation - Amount : " + + allocatedCreditNote.getAllocations().get(0).getAmount()); + + // Get Invoice History + HistoryRecords history = accountingApi.getCreditNoteHistory(accessToken, xeroTenantId, creditNoteID); + messages.add("History - count : " + history.getHistoryRecords().size()); + + // Create Invoice History + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + + HistoryRecords newHistory = accountingApi.createCreditNoteHistory(accessToken, xeroTenantId, + creditNoteID, newHistoryRecords); + messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Currencies")) { + + /* CURRENCY */ + // JSON - incomplete + try { + // Get All + Currencies currencies = accountingApi.getCurrencies(accessToken, xeroTenantId, where, order); + messages.add("Get all Currencies - Total : " + currencies.getCurrencies().size()); + + // Create New + // Error: 400 + /* + * Currency curr = new Currency(); curr.setCode(CurrencyCode.SGD); Currencies + * currs = new Currencies(); currs.addCurrenciesItem(curr); Currencies + * newCurrency = accountingApi.createCurrency(currs); + * messages.add("New Currencies - Code : " + + * newCurrency.getCurrencies().get(0).getCode()); + */ + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Employees")) { + // EMPLOYEE + try { + + // Create + Employee employee = new Employee(); + employee.setFirstName("Sam"); + employee.setLastName("Jackson" + loadRandomNum()); + ExternalLink extLink = new ExternalLink(); + extLink.setUrl("http://twitter.com/#!/search/Homer+Simpson"); + employee.setExternalLink(extLink); + Employees emps = new Employees(); + emps.addEmployeesItem(employee); + + Employees newEmployee = accountingApi.createEmployee(accessToken, xeroTenantId, emps); + messages.add("Create an Employee - Last Name : " + newEmployee.getEmployees().get(0).getLastName()); + + // Get All + Employees employees = accountingApi.getEmployees(accessToken, xeroTenantId, ifModifiedSince, where, + order); + messages.add("Get all Employees - Total : " + employees.getEmployees().size()); + + UUID newEmpId = employees.getEmployees().get(0).getEmployeeID(); + + // Get One + Employees oneEmployee = accountingApi.getEmployee(accessToken, xeroTenantId, newEmpId); + messages.add("Get one Employees - Name : " + oneEmployee.getEmployees().get(0).getFirstName()); + + // 404 ERROR + // Update No EmployeeID as part of URI - first/last name used as unique key + ExternalLink extLink2 = new ExternalLink(); + extLink2.setUrl("http://twitter.com/#!/search/Bart+Simpson"); + newEmployee.getEmployees().get(0).setExternalLink(extLink2); + + Employees updateEmployee = accountingApi.updateEmployee(accessToken, xeroTenantId, newEmpId, + newEmployee); + messages.add("Update an Employee - Last Name : " + updateEmployee.getEmployees().get(0).getLastName()); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("ExpenseClaims")) { + // EXPENSE CLAIM + try { + // Create + // where = "IsSubscriber==true"; + Users users = accountingApi.getUsers(accessToken, xeroTenantId, ifModifiedSince, where, order); + where = null; + + where = "ShowInExpenseClaims==true&&Status==\"ACTIVE\""; + Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); + where = null; + + if (users.getUsers().size() > 0) { + User user = new User(); + user.setUserID(users.getUsers().get(0).getUserID()); + + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, + order, ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + // CREATE NEW RECEIPT + Receipts receipts = new Receipts(); + Receipt receipt = new Receipt(); + + LineItem li = new LineItem(); + li.setAccountCode(accounts.getAccounts().get(0).getCode()); + li.setDescription("Foobar"); + li.setQuantity(2.0); + li.setUnitAmount(20.00); + li.setLineAmount(40.00); + li.setTaxType("NONE"); + + receipt.addLineitemsItem(li); + receipt.setUser(user); + receipt.lineAmountTypes(LineAmountTypes.NOTAX); + receipt.contact(useContact); + receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); + receipts.addReceiptsItem(receipt); + Receipts newReceipts = accountingApi.createReceipt(accessToken, xeroTenantId, receipts); + + // CREATE EXPENSE CLAIM + ExpenseClaims createExpenseClaims = new ExpenseClaims(); + ExpenseClaim expenseClaim = new ExpenseClaim(); + expenseClaim.setUser(user); + + Receipts myReceipts = new Receipts(); + Receipt myReceipt = new Receipt(); + myReceipt.setReceiptID(newReceipts.getReceipts().get(0).getReceiptID()); + myReceipts.addReceiptsItem(myReceipt); + expenseClaim.setReceipts(myReceipts.getReceipts()); + expenseClaim.setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED); + createExpenseClaims.addExpenseClaimsItem(expenseClaim); + ExpenseClaims newExpenseClaims = accountingApi.createExpenseClaim(accessToken, xeroTenantId, + createExpenseClaims, summarizeErrors); + messages.add("Create new Expense Claim - Status : " + + newExpenseClaims.getExpenseClaims().get(0).getStatus()); + + // UPDATE EXPENSE CLAIM + createExpenseClaims.getExpenseClaims().get(0) + .setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED); + UUID expenseClaimID = newExpenseClaims.getExpenseClaims().get(0).getExpenseClaimID(); + ExpenseClaims updateExpenseClaims = accountingApi.updateExpenseClaim(accessToken, xeroTenantId, + expenseClaimID, createExpenseClaims); + messages.add("Update new Expense Claim - Status : " + + updateExpenseClaims.getExpenseClaims().get(0).getStatus()); + + // Get All Expense Claims + ExpenseClaims expenseClaims = accountingApi.getExpenseClaims(accessToken, xeroTenantId, + ifModifiedSince, where, order); + messages.add("Get all Expense Claim - Total : " + expenseClaims.getExpenseClaims().size()); + + // Get One Expense Claim + ExpenseClaims oneExpenseClaim = accountingApi.getExpenseClaim(accessToken, xeroTenantId, + expenseClaims.getExpenseClaims().get(0).getExpenseClaimID()); + messages.add( + "Get one Expense Claim - Total : " + oneExpenseClaim.getExpenseClaims().get(0).getStatus()); + + // VOID EXPENSE CLAIM + createExpenseClaims.getExpenseClaims().get(0) + .setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.VOIDED); + ExpenseClaims voidExpenseClaims = accountingApi.updateExpenseClaim(accessToken, xeroTenantId, + expenseClaimID, createExpenseClaims); + messages.add("Void new Expense Claim - Status : " + + voidExpenseClaims.getExpenseClaims().get(0).getStatus()); + + // Get Invoice History + HistoryRecords history = accountingApi.getExpenseClaimHistory(accessToken, xeroTenantId, + expenseClaimID); + messages.add("History - count : " + history.getHistoryRecords().size()); + + // Create Invoice History + // Error: "The document with the supplied id was not found for this endpoint. + /* + * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord + * newHistoryRecord = new HistoryRecord(); + * newHistoryRecord.setDetails("Hello World"); + * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords + * newHistory = accountingApi.createExpenseClaimHistory(expenseClaimID, + * newHistoryRecords); messages.add("History - note added to : " + + * newHistory.getHistoryRecords().get(0).getDetails()); + */ + } else { + System.out.println("No User Found"); + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Invoices")) { + // INVOICE + + // GET Invoice As a PDF + Invoices myInvoicesForPDF = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, + order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + UUID invoiceIDForPDF = myInvoicesForPDF.getInvoices().get(0).getInvoiceID(); + ByteArrayInputStream InvoiceNoteInput = accountingApi.getInvoiceAsPdf(accessToken, xeroTenantId, + invoiceIDForPDF, "application/pdf"); + String InvoiceFileName = "InvoiceAsPDF.pdf"; + String InvoiceSaveFilePath = saveFile(InvoiceNoteInput, InvoiceFileName); + messages.add("Get Invoice attachment - save it here: " + InvoiceSaveFilePath); + + // Create Invoice + where = "Type==\"REVENUE\""; + Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); + String accountCodeForInvoice = accounts.getAccounts().get(0).getCode(); + where = null; + + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, ids, + null, includeArchived); + + UUID contactIDForInvoice = contacts.getContacts().get(0).getContactID(); + + for (int i = 0; i > contacts.getContacts().size(); i++) { + String email = contacts.getContacts().get(i).getEmailAddress().toString(); + + if (email != null && !email.isEmpty()) { + contactIDForInvoice = contacts.getContacts().get(i).getContactID(); + break; + } + } + + contactIDForInvoice = UUID.fromString("9f857fe0-4a14-408b-b526-4f742db3b079"); + Contact useContact = new Contact(); + useContact.setContactID(contactIDForInvoice); + + Invoices newInvoices = new Invoices(); + Invoice myInvoice = new Invoice(); + + LineItem li = new LineItem(); + li.setAccountCode(accountCodeForInvoice); + li.setDescription("Acme Tires"); + li.setQuantity(2.0); + li.setUnitAmount(20.00); + li.setLineAmount(40.00); + li.setTaxType("NONE"); + + myInvoice.addLineItemsItem(li); + myInvoice.setContact(useContact); + LocalDate dueDate = LocalDate.of(2018, Month.DECEMBER, 10); + myInvoice.setDueDate(dueDate); + LocalDate todayDate = LocalDate.now(); + myInvoice.setDate(todayDate); + myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); + myInvoice.setReference("One Fish, Two Fish"); + myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); + newInvoices.addInvoicesItem(myInvoice); + + Invoices newInvoice = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoices, summarizeErrors); + messages.add("Create invoice - Reference : " + newInvoice.getInvoices().get(0).getReference()); + UUID newInvoiceID = newInvoice.getInvoices().get(0).getInvoiceID(); + Invoices updateInvoices = new Invoices(); + Invoice updateInvoice = new Invoice(); + updateInvoice.setInvoiceID(newInvoiceID); + updateInvoice.setReference("Red Fish, Blue Fish"); + updateInvoices.addInvoicesItem(updateInvoice); + + Invoices updatedInvoice = accountingApi.updateInvoice(accessToken, xeroTenantId, newInvoiceID, + updateInvoices); + messages.add("Update invoice - Reference : " + updatedInvoice.getInvoices().get(0).getReference()); + + // Get All + Invoices invoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, order, ids, + invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + messages.add("Get all invoices - Total : " + invoices.getInvoices().size()); + + // Get Invoice If-Modified-Since + OffsetDateTime invModified = OffsetDateTime.of(LocalDateTime.of(2018, 12, 06, 15, 00), ZoneOffset.UTC); + Invoices invoicesSince = accountingApi.getInvoices(accessToken, xeroTenantId, invModified, where, order, + ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + messages.add("Get all invoices - Since Modfied Date - Total : " + invoicesSince.getInvoices().size()); + + // Get One + Invoices oneInvoice = accountingApi.getInvoice(accessToken, xeroTenantId, + invoices.getInvoices().get(0).getInvoiceID()); + messages.add("Get one invoice - total : " + oneInvoice.getInvoices().get(0).getTotal()); + LocalDate myDate = oneInvoice.getInvoices().get(0).getDate(); + OffsetDateTime myUTC = oneInvoice.getInvoices().get(0).getUpdatedDateUTC(); + + // Get Online Invoice + OnlineInvoices onlineInvoice = accountingApi.getOnlineInvoice(accessToken, xeroTenantId, newInvoiceID); + messages.add( + "Get Online invoice - URL : " + onlineInvoice.getOnlineInvoices().get(0).getOnlineInvoiceUrl()); + + // Email Invoice + RequestEmpty empty = new RequestEmpty(); + accountingApi.emailInvoice(accessToken, xeroTenantId, newInvoiceID, empty); + messages.add("Email invoice - no content in response"); + + // Get Invoice History + HistoryRecords history = accountingApi.getInvoiceHistory(accessToken, xeroTenantId, newInvoiceID); + messages.add("History - count : " + history.getHistoryRecords().size()); + + // Create Invoice History + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords newHistory = accountingApi.createInvoiceHistory(accessToken, xeroTenantId, newInvoiceID, + newHistoryRecords); + messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); + + // CREATE invoice attachment + statuses = "AUTHORISED"; + Invoices myInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); + + File requestBodyFile = new File( + "/Users/sid.maestre/eclipse-workspace/xero-sdk-oauth2-dev-01/resources/youngsid.jpg"); + String newFileName = requestBodyFile.getName(); + + Attachments createdAttachments = accountingApi.createInvoiceAttachmentByFileName(accessToken, xeroTenantId, + invoiceID, newFileName, requestBodyFile); + messages.add("Attachment to Invoice complete - ID: " + + createdAttachments.getAttachments().get(0).getAttachmentID()); + + // GET Invoice Attachment + System.out.println(invoiceID); + Attachments attachments = accountingApi.getInvoiceAttachments(accessToken, xeroTenantId, invoiceID); + System.out.println(attachments.getAttachments().get(0).getFileName()); + UUID attachementId = attachments.getAttachments().get(0).getAttachmentID(); + String contentType = attachments.getAttachments().get(0).getMimeType(); + ByteArrayInputStream InvoiceAttachmentInput = accountingApi.getInvoiceAttachmentById(accessToken, + xeroTenantId, invoiceID, attachementId, contentType); + + String InvoiceAttachmentFileName = attachments.getAttachments().get(0).getFileName(); + String InvoiceAttachmentSaveFilePath = saveFile(InvoiceAttachmentInput, InvoiceAttachmentFileName); + messages.add("Get Invoice attachment - save it here: " + InvoiceAttachmentSaveFilePath); + + } else if (object.equals("InvoiceReminders")) { + // INVOICE REMINDER + try { + InvoiceReminders invReminders = accountingApi.getInvoiceReminders(accessToken, xeroTenantId); + messages.add("Get a Invoice Reminder - Is Enabled: " + + invReminders.getInvoiceReminders().get(0).getEnabled()); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Items")) { + // ITEM + try { + // Create Items + Items myItems = new Items(); + Item myItem = new Item(); + myItem.setCode("abc" + loadRandomNum()); + myItem.setDescription("foobar"); + myItem.setName("Hello" + loadRandomNum()); + myItems.addItemsItem(myItem); + Items newItems = accountingApi.createItem(accessToken, xeroTenantId, myItems); + messages.add("Create new item - Description : " + newItems.getItems().get(0).getDescription()); + UUID newItemId = newItems.getItems().get(0).getItemID(); + + // Update Item + newItems.getItems().get(0).setDescription("Barfoo"); + Items updateItem = accountingApi.updateItem(accessToken, xeroTenantId, newItemId, newItems); + messages.add("Update item - Description : " + updateItem.getItems().get(0).getDescription()); + + // Get All Items + Items items = accountingApi.getItems(accessToken, xeroTenantId, ifModifiedSince, where, order, null); + messages.add("Get all items - Total : " + items.getItems().size()); + + // Get One Item + UUID itemId = items.getItems().get(0).getItemID(); + Items oneItem = accountingApi.getItem(accessToken, xeroTenantId, itemId); + messages.add("Get one item - Description : " + oneItem.getItems().get(0).getDescription()); + + // Get Invoice History + HistoryRecords history = accountingApi.getItemHistory(accessToken, xeroTenantId, itemId); + messages.add("History - count : " + history.getHistoryRecords().size()); + + // Create Invoice History + // Error: "The document with the supplied id was not found for this endpoint. + /* + * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord + * newHistoryRecord = new HistoryRecord(); + * newHistoryRecord.setDetails("Hello World"); + * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords + * createdHistory = accountingApi.createItemHistory(itemId,newHistoryRecords); + * messages.add("History - note added to : " + + * createdHistory.getHistoryRecords().get(0).getDetails()); + */ + + // Delete + accountingApi.deleteItem(accessToken, xeroTenantId, newItemId); + messages.add("Delete one item - no content in response"); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Journals")) { + // JOURNAL + try { + + boolean paymentsOnly = false; + // GET all Journals + Journals journals = accountingApi.getJournals(accessToken, xeroTenantId, ifModifiedSince, null, + paymentsOnly); + messages.add("Get Journals - total : " + journals.getJournals().size()); + + // GET Journal with offset + Journals journalsOffset = accountingApi.getJournals(accessToken, xeroTenantId, ifModifiedSince, null, + paymentsOnly); + messages.add("Get Journals offset - total : " + journalsOffset.getJournals().size()); + // 404 ERROR + /* + * // GET one Journal UUID journalId = + * journals.getJournals().get(0).getJournalID(); Journals oneJournal = + * accountingApi.getJournal(journalId); + * messages.add("Get one Journal - number : " + + * oneJournal.getJournals().get(0).getJournalNumber()); + */ + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("LinkedTransactions")) { + + /* LINKED TRANSACTION */ + try { + // Create Linked Transaction + where = "Type==\"EXPENSE\""; + Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); + where = null; + + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + Invoices newInvoices = new Invoices(); + Invoice myInvoice = new Invoice(); + + LineItem li = new LineItem(); + li.setAccountCode(accounts.getAccounts().get(0).getCode()); + li.setDescription("Acme Tires"); + li.setQuantity(2.0); + li.setUnitAmount(20.00); + li.setLineAmount(40.00); + li.setTaxType("NONE"); + + myInvoice.addLineItemsItem(li); + myInvoice.setContact(useContact); + LocalDate dueDate = LocalDate.of(2018, Month.OCTOBER, 10); + myInvoice.setDueDate(dueDate); + LocalDate todayDate = LocalDate.now(); + myInvoice.setDate(todayDate); + myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCPAY); + myInvoice.setReference("One Fish, Two Fish"); + myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); + newInvoices.addInvoicesItem(myInvoice); + + Invoices newInvoice = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoices, + summarizeErrors); + + UUID sourceTransactionID1 = newInvoice.getInvoices().get(0).getInvoiceID(); + UUID sourceLineItemID1 = newInvoice.getInvoices().get(0).getLineItems().get(0).getLineItemID(); + LinkedTransactions newLinkedTransactions = new LinkedTransactions(); + LinkedTransaction newLinkedTransaction = new LinkedTransaction(); + newLinkedTransaction.setSourceTransactionID(sourceTransactionID1); + newLinkedTransaction.setSourceLineItemID(sourceLineItemID1); + newLinkedTransactions.addLinkedTransactionsItem(newLinkedTransaction); + + LinkedTransactions createdLinkedTransaction = accountingApi.createLinkedTransaction(accessToken, + xeroTenantId, newLinkedTransactions); + messages.add("Create LinkedTransaction - Status : " + + createdLinkedTransaction.getLinkedTransactions().get(0).getStatus()); + + // Created Linked Transaction 2 + Contact contact = new Contact(); + contact.setName("Foo" + loadRandomNum()); + contact.setEmailAddress("sid" + loadRandomNum() + "@blah.com"); + Contacts newContact = accountingApi.createContact(accessToken, xeroTenantId, contact); + UUID newContactID = newContact.getContacts().get(0).getContactID(); + + Invoices newInvoice2 = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoices, + summarizeErrors); + + UUID sourceTransactionID2 = newInvoice2.getInvoices().get(0).getInvoiceID(); + UUID sourceLineItemID2 = newInvoice2.getInvoices().get(0).getLineItems().get(0).getLineItemID(); + LinkedTransactions newLinkedTransactions2 = new LinkedTransactions(); + LinkedTransaction newLinkedTransaction2 = new LinkedTransaction(); + newLinkedTransaction2.setSourceTransactionID(sourceTransactionID2); + newLinkedTransaction2.setSourceLineItemID(sourceLineItemID2); + newLinkedTransaction2.setContactID(newContactID); + newLinkedTransactions2.addLinkedTransactionsItem(newLinkedTransaction2); + + LinkedTransactions createdLinkedTransaction2 = accountingApi.createLinkedTransaction(accessToken, + xeroTenantId, newLinkedTransactions2); + messages.add("Create LinkedTransaction 2 - Status : " + + createdLinkedTransaction2.getLinkedTransactions().get(0).getStatus()); + + // Created Linked Transaction 3 + Invoices newInvoicesAccRec = new Invoices(); + Invoice myInvoiceAccRec = new Invoice(); + + myInvoiceAccRec.addLineItemsItem(li); + myInvoiceAccRec.setContact(useContact); + + myInvoiceAccRec.setDueDate(dueDate); + myInvoiceAccRec.setDate(todayDate); + + myInvoiceAccRec.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); + myInvoiceAccRec.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); + newInvoicesAccRec.addInvoicesItem(myInvoiceAccRec); + + Invoices newInvoiceAccRec = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoicesAccRec, + summarizeErrors); + UUID sourceTransactionID4 = newInvoiceAccRec.getInvoices().get(0).getInvoiceID(); + UUID sourceLineItemID4 = newInvoiceAccRec.getInvoices().get(0).getLineItems().get(0).getLineItemID(); + + Invoices newInvoice3 = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoices, + summarizeErrors); + + UUID sourceTransactionID3 = newInvoice3.getInvoices().get(0).getInvoiceID(); + UUID sourceLineItemID3 = newInvoice3.getInvoices().get(0).getLineItems().get(0).getLineItemID(); + LinkedTransactions newLinkedTransactions3 = new LinkedTransactions(); + LinkedTransaction newLinkedTransaction3 = new LinkedTransaction(); + newLinkedTransaction3.setSourceTransactionID(sourceTransactionID3); + newLinkedTransaction3.setSourceLineItemID(sourceLineItemID3); + newLinkedTransaction3.setContactID(useContact.getContactID()); + newLinkedTransaction3.setTargetTransactionID(sourceTransactionID4); + newLinkedTransaction3.setTargetLineItemID(sourceLineItemID4); + newLinkedTransactions3.addLinkedTransactionsItem(newLinkedTransaction3); + + LinkedTransactions createdLinkedTransaction3 = accountingApi.createLinkedTransaction(accessToken, + xeroTenantId, newLinkedTransactions3); + messages.add("Create LinkedTransaction 3 - Status : " + + createdLinkedTransaction3.getLinkedTransactions().get(0).getStatus()); + + // GET all Link Transactions + + int page = 1; + String linkedTransactionID = null; + String sourceTransactionID = null; + String targetTransactionID = null; + String status = null; + String contactID = null; + LinkedTransactions linkTransactions = accountingApi.getLinkedTransactions(accessToken, xeroTenantId, + page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); + messages.add("Get Link Transactions - total : " + linkTransactions.getLinkedTransactions().size()); + + // GET all Link Transactions + UUID linkedTransactionID2 = linkTransactions.getLinkedTransactions().get(0).getLinkedTransactionID(); + LinkedTransactions oneLinkTransaction = accountingApi.getLinkedTransaction(accessToken, xeroTenantId, + linkedTransactionID2); + messages.add("Get one Link Transaction - Status : " + + oneLinkTransaction.getLinkedTransactions().get(0).getStatus()); + // 500 Error + /* + * // DELETE LINKEDTRANSACTION UUID newLinkedTransactionID = + * createdLinkedTransaction.getLinkedTransactions().get(0). + * getLinkedTransactionID(); + * accountingApi.deleteLinkedTransaction(newLinkedTransactionID); + * messages.add("Delete LinkedTransaction - no content in response"); + */ + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("ManualJournals")) { + // MANUAL JOURNAL + try { + // Create Manual Journal + where = "Type==\"EXPENSE\" && Status ==\"ACTIVE\""; + Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); + String accountCode = accounts.getAccounts().get(0).getCode(); + where = null; + ManualJournals manualJournals = new ManualJournals(); + ManualJournal manualJournal = new ManualJournal(); + LocalDate currDate = LocalDate.now(); + manualJournal.setDate(currDate); + manualJournal.setNarration("Foo bar"); + + ManualJournalLine credit = new ManualJournalLine(); + credit.setDescription("Hello there"); + credit.setAccountCode(accountCode); + credit.setLineAmount(100.00); + manualJournal.addJournalLinesItem(credit); + + ManualJournalLine debit = new ManualJournalLine(); + debit.setDescription("Goodbye"); + debit.setAccountCode(accountCode); + debit.setLineAmount(-100.00); + manualJournal.addJournalLinesItem(debit); + manualJournals.addManualJournalsItem(manualJournal); + ManualJournals createdManualJournals = accountingApi.createManualJournal(accessToken, xeroTenantId, + manualJournals); + UUID newManualJournalId = createdManualJournals.getManualJournals().get(0).getManualJournalID(); + messages.add("Create Manual Journal - Narration : " + + createdManualJournals.getManualJournals().get(0).getNarration()); + + // GET all Manual Journal + ManualJournals getManualJournals = accountingApi.getManualJournals(accessToken, xeroTenantId, + ifModifiedSince, where, order, null); + messages.add("Get Manual Journal - total : " + getManualJournals.getManualJournals().size()); + + // GET one Manual Journal + UUID manualJournalId = getManualJournals.getManualJournals().get(0).getManualJournalID(); + ManualJournals oneManualJournal = accountingApi.getManualJournal(accessToken, xeroTenantId, + manualJournalId); + messages.add("Get one Manual Journal - Narration : " + + oneManualJournal.getManualJournals().get(0).getNarration()); + + // Update Manual Journal + ManualJournals updateManualJournals = new ManualJournals(); + ManualJournal updateManualJournal = new ManualJournal(); + updateManualJournal.setManualJournalID(newManualJournalId); + updateManualJournal.setNarration("Hello Xero"); + updateManualJournals.addManualJournalsItem(updateManualJournal); + ManualJournals updatedManualJournal = accountingApi.updateManualJournal(accessToken, xeroTenantId, + newManualJournalId, updateManualJournals); + messages.add("Update Manual Journal - Narration : " + + updatedManualJournal.getManualJournals().get(0).getNarration()); + + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } } else if (object.equals("Organisations")) { - // Organisation - try { - Organisations organisations = accountingApi.getOrganisations(accessToken,xeroTenantId); - messages.add("Get a Organisation - Name : " + organisations.getOrganisations().get(0).getName()); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Overpayments")) { - // OVERPAYMENT - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - Account bankAccount = new Account(); - bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); - where = null; - - where = "SystemAccount==\"DEBTORS\""; - Accounts arAccounts = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - Account arAccount = arAccounts.getAccounts().get(0); - where = null; - - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // Maker sure we have at least 2 banks - if(accountsWhere.getAccounts().size() > 0) { - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode(arAccount.getCode()); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setUnitAmount(20.00); - lineItems.add(li); - - BankTransaction bt = new BankTransaction(); - bt.setBankAccount(bankAccount); - bt.setContact(useContact); - bt.setLineitems(lineItems); - bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_OVERPAYMENT); - BankTransactions bts = new BankTransactions(); - bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(accessToken,xeroTenantId,bts, summarizeErrors); - - Overpayments overpayments = accountingApi.getOverpayments(accessToken,xeroTenantId,ifModifiedSince, where, order, null, null); - messages.add("Get a Overpayments - Count : " + overpayments.getOverpayments().size()); - - if(overpayments.getOverpayments().size() > 0) { - UUID overpaymentId = overpayments.getOverpayments().get(2).getOverpaymentID(); - Overpayments oneOverpayment = accountingApi.getOverpayment(accessToken,xeroTenantId,overpaymentId); - messages.add("Get one Overpayment - Total : " + oneOverpayment.getOverpayments().get(0).getTotal()); - - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - where = null; - - Allocations allocations = new Allocations(); - Allocation allocation = new Allocation(); - allocation.setAmount(1.0); - LocalDate currDate = LocalDate.now(); - allocation.setDate(currDate); - allocation.setInvoice(inv); - allocations.addAllocationsItem(allocation); - - Allocations newAllocation = accountingApi.createOverpaymentAllocation(accessToken,xeroTenantId,overpaymentId, allocations); - messages.add("Create OverPayment allocation - Amt : " + newAllocation.getAllocations().get(0).getAmount()); - - // Get History - HistoryRecords history = accountingApi.getOverpaymentHistory(accessToken,xeroTenantId,overpaymentId); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords createdHistory = accountingApi.createOverpaymentHistory(overpaymentId,newHistoryRecords); - messages.add("History - note added to : " + createdHistory.getHistoryRecords().get(0).getDetails()); - */ - } - } - - } else if (object.equals("Payments")) { - /* Payment */ - try { - - - // CREATE payment - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - where = null; - - where = "EnablePaymentsToAccount==true"; - Accounts accountsWhere = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - Account paymentAccount = new Account(); - paymentAccount.setCode(accountsWhere.getAccounts().get(0).getCode()); - where = null; - - Payments createPayments = new Payments(); - Payment createPayment = new Payment(); - createPayment.setAccount(paymentAccount); - createPayment.setInvoice(inv); - createPayment.setAmount(1.00); - - LocalDate currDate = LocalDate.now(); - createPayment.setDate(currDate); - createPayments.addPaymentsItem(createPayment); - - Payments newPayments = accountingApi.createPayment(accessToken,xeroTenantId,createPayments); - messages.add("Create Payments - Amt : " + newPayments.getPayments().get(0).getAmount()); - - // GET all Payments - Payments payments = accountingApi.getPayments(accessToken,xeroTenantId,ifModifiedSince, where, order); - messages.add("Get Payments - Total : " + payments.getPayments().size()); - - // GET one Payment - UUID paymentID = payments.getPayments().get(0).getPaymentID(); - Payments onePayment = accountingApi.getPayment(accessToken,xeroTenantId,paymentID); - messages.add("Get Payments - Amount : " + onePayment.getPayments().get(0).getAmount()); - - // Get History - HistoryRecords allHistory = accountingApi.getPaymentHistory(accessToken,xeroTenantId,paymentID); - messages.add("History - count : " + allHistory.getHistoryRecords().size() ); - - // Create History - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createPaymentHistory(paymentID,newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - */ - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("PaymentServices")) { - // Payment Services - try { - // CREATE PaymentService - PaymentServices newPaymentServices = new PaymentServices(); - PaymentService newPaymentService = new PaymentService(); - newPaymentService.setPaymentServiceName("PayUp"+ loadRandomNum()); - newPaymentService.setPaymentServiceUrl("https://www.payupnow.com/"); - newPaymentService.setPayNowText("Time To PayUp"); - newPaymentServices.addPaymentServicesItem(newPaymentService); - PaymentServices createdPaymentService = accountingApi.createPaymentService(accessToken,xeroTenantId,newPaymentServices); - messages.add("Create PaymentServices - name : " + createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); - - // GET all Payments - PaymentServices paymentServices = accountingApi.getPaymentServices(accessToken,xeroTenantId); - messages.add("Get PaymentServices - Total : " + paymentServices.getPaymentServices().size()); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Prepayments")) { - /* PREPAYMENT */ - try { - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - Account bankAccount = new Account(); - bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); - where = null; - - where = "Type==\"EXPENSE\""; - Accounts arAccounts = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - Account arAccount = arAccounts.getAccounts().get(0); - where = null; - - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // Maker sure we have at least 2 banks - if(accountsWhere.getAccounts().size() > 0) { - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode(arAccount.getCode()); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setTaxType("NONE"); - li.setUnitAmount(20.00); - lineItems.add(li); - - BankTransaction bt = new BankTransaction(); - bt.setBankAccount(bankAccount); - bt.setContact(useContact); - bt.setLineitems(lineItems); - bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_PREPAYMENT); - BankTransactions bts = new BankTransactions(); - bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(accessToken,xeroTenantId,bts, summarizeErrors); - where = "Status==\"AUTHORISED\" && TYPE==\"RECEIVE-PREPAYMENT\""; - Prepayments prepayments = accountingApi.getPrepayments(accessToken,xeroTenantId,ifModifiedSince, where, order, null, null); - messages.add("Get a Prepayments - Count : " + prepayments.getPrepayments().size()); - where = null; - if(prepayments.getPrepayments().size() > 0) { - UUID prepaymentId = prepayments.getPrepayments().get(0).getPrepaymentID(); - Prepayments onePrepayment = accountingApi.getPrepayment(accessToken,xeroTenantId,prepaymentId); - messages.add("Get one Prepayment - Total : " + onePrepayment.getPrepayments().get(0).getTotal()); - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - where = null; - - Allocations allocations = new Allocations(); - Allocation allocation = new Allocation(); - allocation.setAmount(1.0); - LocalDate currDate = LocalDate.now(); - allocation.setDate(currDate); - allocation.setInvoice(inv); - allocations.addAllocationsItem(allocation); - - //Allocations newAllocation = accountingApi.createPrepaymentAllocation(prepaymentId, allocations); - //messages.add("Create PrePayment allocation - Amt : " + newAllocation.getAllocations().get(0).getAmount()); - - // Get History - HistoryRecords history = accountingApi.getPrepaymentHistory(accessToken,xeroTenantId,prepaymentId); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create History - // Error: "The document with the supplied id was not found for this end point. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords createdHistory = accountingApi.createPrepaymentHistory(prepaymentId,newHistoryRecords); - messages.add("History - note added to : " + createdHistory.getHistoryRecords().get(0).getDetails()); - */ - } - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("PurchaseOrders")) { - // PURCHASE ORDERS - try { - // CREATE Purchase Order - where = "Type==\"EXPENSE\""; - Accounts arAccounts = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - Account arAccount = arAccounts.getAccounts().get(0); - where = null; - - PurchaseOrders purchaseOrders = new PurchaseOrders(); - PurchaseOrder purchaseOrder = new PurchaseOrder(); - LocalDate currDate = LocalDate.now(); - purchaseOrder.setDate(currDate); - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - purchaseOrder.setContact(useContact); - - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode(arAccount.getCode()); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setUnitAmount(20.00); - lineItems.add(li); - purchaseOrder.setLineItems(lineItems); - purchaseOrders.addPurchaseOrdersItem(purchaseOrder); - PurchaseOrders createdPurchaseOrders = accountingApi.createPurchaseOrder(accessToken,xeroTenantId,purchaseOrders, summarizeErrors); - messages.add("Create Purchase order - total : " + createdPurchaseOrders.getPurchaseOrders().get(0).getTotal()); - - // UPDATE Purchase Orders - UUID newPurchaseOrderID = createdPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); - createdPurchaseOrders.getPurchaseOrders().get(0).setAttentionTo("Jimmy"); - PurchaseOrders updatePurchaseOrders = accountingApi.updatePurchaseOrder(accessToken,xeroTenantId,newPurchaseOrderID, createdPurchaseOrders); - messages.add("Update Purchase order - attn : " + updatePurchaseOrders.getPurchaseOrders().get(0).getAttentionTo()); - - // GET Purchase Orders - String status = null; - String dateFrom = null; - String dateTo = null; - PurchaseOrders allPurchaseOrders = accountingApi.getPurchaseOrders(accessToken,xeroTenantId,ifModifiedSince, status, dateFrom, dateTo, order, null); - messages.add("Get Purchase orders - Count : " + allPurchaseOrders.getPurchaseOrders().size()); - - // GET one Purchase Order - UUID purchaseOrderID = allPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); - PurchaseOrders onePurchaseOrder = accountingApi.getPurchaseOrder(accessToken,xeroTenantId,purchaseOrderID); - messages.add("Get one Purchase order - Total : " + onePurchaseOrder.getPurchaseOrders().get(0).getTotal()); - - // DELETE Purchase Orders - createdPurchaseOrders.getPurchaseOrders().get(0).setStatus(com.xero.models.accounting.PurchaseOrder.StatusEnum.DELETED); - PurchaseOrders deletePurchaseOrders = accountingApi.updatePurchaseOrder(accessToken,xeroTenantId,newPurchaseOrderID, createdPurchaseOrders); - messages.add("Delete Purchase order - Status : " + deletePurchaseOrders.getPurchaseOrders().get(0).getStatus()); - - // Get History - HistoryRecords history = accountingApi.getInvoiceHistory(accessToken,xeroTenantId,purchaseOrderID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createPurchaseOrderHistory(accessToken,xeroTenantId,purchaseOrderID,newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Receipts")) { - /* RECEIPTS */ - try { - //Create -// where = "IsSubscriber==true"; - Users users = accountingApi.getUsers(accessToken,xeroTenantId,ifModifiedSince, where, order); - where = null; - - where = "ShowInExpenseClaims==true && Status==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(accessToken,xeroTenantId,ifModifiedSince, where, order); - where = null; - - User useUser = new User(); - useUser.setUserID(users.getUsers().get(0).getUserID()); - - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // CREATE NEW RECEIPT - Receipts receipts = new Receipts(); - Receipt receipt = new Receipt(); - - LineItem li = new LineItem(); - li.setAccountCode(accounts.getAccounts().get(0).getCode()); - li.setDescription("Foobar"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - receipt.addLineitemsItem(li); - receipt.setUser(useUser); - receipt.lineAmountTypes(LineAmountTypes.NOTAX); - receipt.contact(useContact); - receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); - receipts.addReceiptsItem(receipt); - Receipts newReceipts = accountingApi.createReceipt(accessToken,xeroTenantId,receipts); - messages.add("Create Receipts - Total : " + newReceipts.getReceipts().get(0).getTotal()); - - // UPDATE Receipts - UUID newReceiptId = newReceipts.getReceipts().get(0).getReceiptID(); - newReceipts.getReceipts().get(0).setReference("Foobar"); - Receipts updateReceipts = accountingApi.updateReceipt(accessToken,xeroTenantId,newReceiptId, newReceipts); - messages.add("Create Receipts - Ref : " + updateReceipts.getReceipts().get(0).getReference()); - - // GET all Receipts - Receipts allReceipts = accountingApi.getReceipts(accessToken,xeroTenantId,ifModifiedSince, where, order, null); - messages.add("Create Receipts - Count : " + allReceipts.getReceipts().size()); - - // GET one Receipts - UUID receiptID = allReceipts.getReceipts().get(0).getReceiptID(); - Receipts oneReceipts = accountingApi.getReceipt(accessToken,xeroTenantId,receiptID); - messages.add("Create Receipts - Total : " + oneReceipts.getReceipts().get(0).getTotal()); - - // Get History - HistoryRecords history = accountingApi.getReceiptHistory(accessToken,xeroTenantId,receiptID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createReceiptHistory(receiptID, newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - */ - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("RepeatingInvoices")) { - /* REPEATING INVOICE */ - try { - // GET all Repeating Invoices - RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(accessToken,xeroTenantId,where, order); - if ( repeatingInvoices.getRepeatingInvoices().size() > 0) { - messages.add("Repeating Invoice - count : " + repeatingInvoices.getRepeatingInvoices().size() ); - - // GET one Repeating Invoices - UUID repeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - RepeatingInvoices repeatingInvoice = accountingApi.getRepeatingInvoice(accessToken,xeroTenantId,repeatingInvoiceID); - messages.add("Repeating Invoice - total : " + repeatingInvoice.getRepeatingInvoices().get(0).getTotal()); - - // Get History - HistoryRecords history = accountingApi.getRepeatingInvoiceHistory(accessToken,xeroTenantId,repeatingInvoiceID); - messages.add("History - count : " + history.getHistoryRecords().size() ); - - // Create History - // Error: "The document with the supplied id was not found for this endpoint. - /* - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createRepeatingInvoiceHistory(repeatingInvoiceID, newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - */ - } else { - messages.add("Zero repeating Invoices found" ); - - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Reports")) { - - /* REPORTS */ - try { - - - /* - // TenNinetyNine - US Only - String reportYear = null; - Reports reports = accountingApi.getReportTenNinetyNine(reportYear); - System.out.println(reports.toString()); - */ - // AgedPayablesByContact - String date = null; - String fromDate = null; - String toDate = null; - String profitLossTimeframe = null; - String trackingOptionID1 = null; - String trackingOptionID2 = null; - boolean standardLayout = false; - boolean paymentsOnly = false; - String trackingCategoryID = null; - String trackingCategoryID2 = null; - String trackingOptionID = null; - - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); - UUID contactId = contacts.getContacts().get(0).getContactID(); - LocalDate xDate = LocalDate.now(); - LocalDate xFromDate = LocalDate.now(); - LocalDate xToDate = LocalDate.now(); - - ReportWithRows reportAgedPayablesByContact = accountingApi.getReportAgedPayablesByContact(accessToken,xeroTenantId,contactId, xDate, xFromDate, xToDate); - messages.add("Get a Reports - Name:" + reportAgedPayablesByContact.getReports().get(0).getReportName()); - - // AgedReceivablesByContact - ReportWithRows reportAgedReceivablesByContact = accountingApi.getReportAgedReceivablesByContact(accessToken,xeroTenantId,contactId, xDate, xFromDate, xToDate); - messages.add("Get a Reports - Name:" + reportAgedReceivablesByContact.getReports().get(0).getReportName()); - - // reportBalanceSheet - ReportWithRows reportBalanceSheet = accountingApi.getReportBalanceSheet(accessToken,xeroTenantId,toDate, 3, "MONTH", trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); - messages.add("Get a Reports - Name:" + reportBalanceSheet.getReports().get(0).getReportName()); - - // reportBankSummary - ReportWithRows reportBankSummary = accountingApi.getReportBankSummary(accessToken,xeroTenantId,xToDate, null, null); - messages.add("Get a Reports - Name:" + reportBankSummary.getReports().get(0).getReportName()); - - // reportBASorGSTlist - AU and NZ only - ReportWithRows reportTax = accountingApi.getReportBASorGSTList(accessToken,xeroTenantId); - System.out.println(reportTax.toString()); - - // reportBudgetSummary - int budgetPeriod = 1; - int budgetTimeframe = 3; - ReportWithRows reportBudgetSummary = accountingApi.getReportBudgetSummary(accessToken,xeroTenantId,xToDate, budgetPeriod, budgetTimeframe); - messages.add("Get a Reports - Name:" + reportBudgetSummary.getReports().get(0).getReportName()); - - // reportExecutiveSummary - ReportWithRows reportExecutiveSummary = accountingApi.getReportExecutiveSummary(accessToken,xeroTenantId,xToDate); - messages.add("Get a Reports - Name:" + reportExecutiveSummary.getReports().get(0).getReportName()); - - // reportProfitandLoss - fromDate = "2018-01-01"; - toDate = "2018-12-31"; - profitLossTimeframe = "MONTH"; - standardLayout = true; - paymentsOnly = false; - ReportWithRows reportProfitLoss = accountingApi.getReportProfitAndLoss(accessToken,xeroTenantId,xFromDate, xToDate, null, profitLossTimeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); - messages.add("Get a Reports - Name:" + reportProfitLoss.getReports().get(0).getReportName()); - fromDate = null; - toDate = null; - - // reportTrialBalance - ReportWithRows reportTrialBalance = accountingApi.getReportTrialBalance(accessToken,xeroTenantId,xToDate, paymentsOnly); - messages.add("Get a Reports - Name:" + reportTrialBalance.getReports().get(0).getReportName()); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("TrackingCategories")) { - // TRACKING CATEGORIES - try { - // GET Tracking Categories - TrackingCategories trackingCategories = accountingApi.getTrackingCategories(accessToken,xeroTenantId,where, order, includeArchived); - int count = trackingCategories.getTrackingCategories().size(); - - if (count == 2) { - //DELETE Tracking Categories - UUID trackingCategoryID = trackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); - TrackingCategories deletedTrackingCategories = accountingApi.deleteTrackingCategory(accessToken,xeroTenantId,trackingCategoryID); - messages.add("DELETED tracking categories - status : " + deletedTrackingCategories.getTrackingCategories().get(0).getStatus()); - } - - // CREATE Tracking Categories - TrackingCategory newTrackingCategory = new TrackingCategory(); - newTrackingCategory.setName("Foo"+ loadRandomNum()); - TrackingCategories createdTrackingCategories = accountingApi.createTrackingCategory(accessToken,xeroTenantId,newTrackingCategory); - messages.add("CREATED tracking categories - name : " + createdTrackingCategories.getTrackingCategories().get(0).getName()); - - // UPDATE Tracking Categories - UUID newTrackingCategoryID = createdTrackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); - newTrackingCategory.setName("Foo"+ loadRandomNum()); - TrackingCategories updatedTrackingCategories = accountingApi.updateTrackingCategory(accessToken,xeroTenantId,newTrackingCategoryID,newTrackingCategory); - messages.add("UPDATED tracking categories - name : " + updatedTrackingCategories.getTrackingCategories().get(0).getName()); - - // GET one Tracking Categories - if (count > 0) - { - UUID oneTrackingCategoryID = trackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); - TrackingCategories oneTrackingCategories = accountingApi.getTrackingCategory(accessToken,xeroTenantId,oneTrackingCategoryID); - messages.add("GET ONE tracking categories - name : " + oneTrackingCategories.getTrackingCategories().get(0).getName()); - - // Create one Option - TrackingOption option = new TrackingOption(); - option.setName("Bar"+ loadRandomNum()); - TrackingOptions newTrackingOptions = accountingApi.createTrackingOptions(accessToken,xeroTenantId,oneTrackingCategoryID,option); - messages.add("CREATE option - name : " + newTrackingOptions.getOptions().get(0).getName()); - - // DELETE All options - //UUID newOptionId = newTrackingOptions.getOptions().get(0).getTrackingOptionID(); - //TrackingOptions deleteOptions = accountingApi.deleteTrackingOptions(oneTrackingCategoryID, newOptionId); - //messages.add("DELETE one option - Status : " + deleteOptions.getOptions().get(0).getStatus()); - } - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("TaxRates")) { - // TAX RATE - try { - // CREATE Tax Rate - TaxRates newTaxRates = new TaxRates(); - TaxRate newTaxRate = new TaxRate(); - TaxComponent rate01 = new TaxComponent(); - rate01.setName("State Tax"); - rate01.setRate(2.25); - newTaxRate.setName("SDKTax"+ loadRandomNum()); - newTaxRate.addTaxComponentsItem(rate01); - newTaxRates.addTaxRatesItem(newTaxRate); - - TaxRates createdTaxRate = accountingApi.createTaxRate(accessToken,xeroTenantId,newTaxRates); - messages.add("CREATE TaxRate - name : " + createdTaxRate.getTaxRates().get(0).getName()); - - // UDPATE Tax Rate - newTaxRates.getTaxRates().get(0).setStatus(com.xero.models.accounting.TaxRate.StatusEnum.DELETED); - TaxRates updatedTaxRate = accountingApi.updateTaxRate(accessToken,xeroTenantId,newTaxRates); - messages.add("UPDATED TaxRate - status : " + updatedTaxRate.getTaxRates().get(0).getStatus()); - - // GET Tax Rate - String taxType = null; - TaxRates taxRates = accountingApi.getTaxRates(accessToken,xeroTenantId,where, order, taxType); - messages.add("GET TaxRate - cnt : " + taxRates.getTaxRates().size()); - - // GET Tax Rate - taxType = "CAPEXINPUT2"; - TaxRates taxRatesByType = accountingApi.getTaxRates(accessToken,xeroTenantId,where, order, taxType); - messages.add("GET TaxRate by Cap Purchase Type : " + taxRatesByType.getTaxRates().size()); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Users")) { - // USER - try { - // GET Users - Users users = accountingApi.getUsers(accessToken,xeroTenantId,ifModifiedSince, where, order); - messages.add("GET Users - cnt : " + users.getUsers().size()); - - //GET One User - UUID userID = users.getUsers().get(0).getUserID(); - Users user = accountingApi.getUser(accessToken,xeroTenantId,userID); - messages.add("GET Users - First Name : " + user.getUsers().get(0).getFirstName()); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Errors")) { - - try { - Contact contact = new Contact(); - contact.setName("Sidney Maestre"); - Contacts createContact1 = accountingApi.createContact(accessToken,xeroTenantId, contact); - Contacts createContact2 = accountingApi.createContact(accessToken,xeroTenantId, contact); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - Contacts contacts = accountingApi.getContacts(accessToken,xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - Invoices newInvoices = new Invoices(); - Invoice myInvoice = new Invoice(); - - LineItem li = new LineItem(); - li.setAccountCode("123456789"); - li.setDescription("Acme Tires"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - myInvoice.addLineItemsItem(li); - myInvoice.setContact(useContact); - myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); - myInvoice.setReference("One Fish, Two Fish"); - myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.SUBMITTED); - newInvoices.addInvoicesItem(myInvoice); - - Invoices newInvoice = accountingApi.createInvoice(accessToken,xeroTenantId, newInvoices, true); - messages.add("Create invoice - Reference : " + newInvoice.getInvoices().get(0).getReference()); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - UUID badContactId = UUID.fromString("bd2270c3-0000-4c11-9cfb-000b551c3f51"); - Contacts badContacts = accountingApi.getContact(accessToken,xeroTenantId, badContactId); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - Contacts ContactList = accountingApi.getContacts(accessToken,xeroTenantId, ifModifiedSince, where, order, ids, null, includeArchived); - int num4 = findRandomNum(ContactList.getContacts().size()); - UUID contactId = ContactList.getContacts().get(num4).getContactID(); - try { - for(int i=80; i>1; i--){ - Contacts allMyContacts = accountingApi.getContact(accessToken,xeroTenantId, contactId); - } - messages.add("Congrats - you made over 60 calls without hitting rate limit"); - } catch (XeroApiException xe) { - this.addError(xe,messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } - - for (int i = 0; i < messages.size(); i++) { - System.out.println(messages.get(i)); - respWriter.println("

" + messages.get(i) + "

"); - } - - respWriter.println("
end processing request
"); - respWriter.println("
"); - } - - protected void addToMapIfNotNull(Map map, String key, Object value) { + // Organisation + try { + Organisations organisations = accountingApi.getOrganisations(accessToken, xeroTenantId); + messages.add("Get a Organisation - Name : " + organisations.getOrganisations().get(0).getName()); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Overpayments")) { + // OVERPAYMENT + where = "Status==\"ACTIVE\"&&Type==\"BANK\""; + Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, + order); + Account bankAccount = new Account(); + bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); + where = null; + + where = "SystemAccount==\"DEBTORS\""; + Accounts arAccounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); + Account arAccount = arAccounts.getAccounts().get(0); + where = null; + + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, ids, + null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + // Maker sure we have at least 2 banks + if (accountsWhere.getAccounts().size() > 0) { + List lineItems = new ArrayList<>(); + LineItem li = new LineItem(); + li.setAccountCode(arAccount.getCode()); + li.setDescription("Foobar"); + li.setQuantity(1.0); + li.setUnitAmount(20.00); + lineItems.add(li); + + BankTransaction bt = new BankTransaction(); + bt.setBankAccount(bankAccount); + bt.setContact(useContact); + bt.setLineitems(lineItems); + bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_OVERPAYMENT); + BankTransactions bts = new BankTransactions(); + bts.addBankTransactionsItem(bt); + BankTransactions newBankTransaction = accountingApi.createBankTransaction(accessToken, xeroTenantId, + bts, summarizeErrors); + + Overpayments overpayments = accountingApi.getOverpayments(accessToken, xeroTenantId, ifModifiedSince, + where, order, null, null); + messages.add("Get a Overpayments - Count : " + overpayments.getOverpayments().size()); + + if (overpayments.getOverpayments().size() > 0) { + UUID overpaymentId = overpayments.getOverpayments().get(2).getOverpaymentID(); + Overpayments oneOverpayment = accountingApi.getOverpayment(accessToken, xeroTenantId, + overpaymentId); + messages.add("Get one Overpayment - Total : " + oneOverpayment.getOverpayments().get(0).getTotal()); + + where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; + Invoices allInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, + order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, + null); + Invoice inv = new Invoice(); + inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); + where = null; + + Allocations allocations = new Allocations(); + Allocation allocation = new Allocation(); + allocation.setAmount(1.0); + LocalDate currDate = LocalDate.now(); + allocation.setDate(currDate); + allocation.setInvoice(inv); + allocations.addAllocationsItem(allocation); + + Allocations newAllocation = accountingApi.createOverpaymentAllocation(accessToken, xeroTenantId, + overpaymentId, allocations); + messages.add("Create OverPayment allocation - Amt : " + + newAllocation.getAllocations().get(0).getAmount()); + + // Get History + HistoryRecords history = accountingApi.getOverpaymentHistory(accessToken, xeroTenantId, + overpaymentId); + messages.add("History - count : " + history.getHistoryRecords().size()); + + // Create History + // Error: "The document with the supplied id was not found for this endpoint. + /* + * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord + * newHistoryRecord = new HistoryRecord(); + * newHistoryRecord.setDetails("Hello World"); + * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords + * createdHistory = + * accountingApi.createOverpaymentHistory(overpaymentId,newHistoryRecords); + * messages.add("History - note added to : " + + * createdHistory.getHistoryRecords().get(0).getDetails()); + */ + } + } + + } else if (object.equals("Payments")) { + /* Payment */ + try { + + // CREATE payment + where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; + Invoices allInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, + order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); + Invoice inv = new Invoice(); + inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); + where = null; + + where = "EnablePaymentsToAccount==true"; + Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, + order); + Account paymentAccount = new Account(); + paymentAccount.setCode(accountsWhere.getAccounts().get(0).getCode()); + where = null; + + Payments createPayments = new Payments(); + Payment createPayment = new Payment(); + createPayment.setAccount(paymentAccount); + createPayment.setInvoice(inv); + createPayment.setAmount(1.00); + + LocalDate currDate = LocalDate.now(); + createPayment.setDate(currDate); + createPayments.addPaymentsItem(createPayment); + + Payments newPayments = accountingApi.createPayment(accessToken, xeroTenantId, createPayments); + messages.add("Create Payments - Amt : " + newPayments.getPayments().get(0).getAmount()); + + // GET all Payments + Payments payments = accountingApi.getPayments(accessToken, xeroTenantId, ifModifiedSince, where, order); + messages.add("Get Payments - Total : " + payments.getPayments().size()); + + // GET one Payment + UUID paymentID = payments.getPayments().get(0).getPaymentID(); + Payments onePayment = accountingApi.getPayment(accessToken, xeroTenantId, paymentID); + messages.add("Get Payments - Amount : " + onePayment.getPayments().get(0).getAmount()); + + // Get History + HistoryRecords allHistory = accountingApi.getPaymentHistory(accessToken, xeroTenantId, paymentID); + messages.add("History - count : " + allHistory.getHistoryRecords().size()); + + // Create History + /* + * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord + * newHistoryRecord = new HistoryRecord(); + * newHistoryRecord.setDetails("Hello World"); + * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords + * newHistory = accountingApi.createPaymentHistory(paymentID,newHistoryRecords); + * messages.add("History - note added to : " + + * newHistory.getHistoryRecords().get(0).getDetails()); + */ + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("PaymentServices")) { + // Payment Services + try { + // CREATE PaymentService + PaymentServices newPaymentServices = new PaymentServices(); + PaymentService newPaymentService = new PaymentService(); + newPaymentService.setPaymentServiceName("PayUp" + loadRandomNum()); + newPaymentService.setPaymentServiceUrl("https://www.payupnow.com/"); + newPaymentService.setPayNowText("Time To PayUp"); + newPaymentServices.addPaymentServicesItem(newPaymentService); + PaymentServices createdPaymentService = accountingApi.createPaymentService(accessToken, xeroTenantId, + newPaymentServices); + messages.add("Create PaymentServices - name : " + + createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); + + // GET all Payments + PaymentServices paymentServices = accountingApi.getPaymentServices(accessToken, xeroTenantId); + messages.add("Get PaymentServices - Total : " + paymentServices.getPaymentServices().size()); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Prepayments")) { + /* PREPAYMENT */ + try { + where = "Status==\"ACTIVE\"&&Type==\"BANK\""; + Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, + order); + Account bankAccount = new Account(); + bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); + where = null; + + where = "Type==\"EXPENSE\""; + Accounts arAccounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, + order); + Account arAccount = arAccounts.getAccounts().get(0); + where = null; + + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + // Maker sure we have at least 2 banks + if (accountsWhere.getAccounts().size() > 0) { + List lineItems = new ArrayList<>(); + LineItem li = new LineItem(); + li.setAccountCode(arAccount.getCode()); + li.setDescription("Foobar"); + li.setQuantity(1.0); + li.setTaxType("NONE"); + li.setUnitAmount(20.00); + lineItems.add(li); + + BankTransaction bt = new BankTransaction(); + bt.setBankAccount(bankAccount); + bt.setContact(useContact); + bt.setLineitems(lineItems); + bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_PREPAYMENT); + BankTransactions bts = new BankTransactions(); + bts.addBankTransactionsItem(bt); + BankTransactions newBankTransaction = accountingApi.createBankTransaction(accessToken, xeroTenantId, + bts, summarizeErrors); + where = "Status==\"AUTHORISED\" && TYPE==\"RECEIVE-PREPAYMENT\""; + Prepayments prepayments = accountingApi.getPrepayments(accessToken, xeroTenantId, ifModifiedSince, + where, order, null, null); + messages.add("Get a Prepayments - Count : " + prepayments.getPrepayments().size()); + where = null; + if (prepayments.getPrepayments().size() > 0) { + UUID prepaymentId = prepayments.getPrepayments().get(0).getPrepaymentID(); + Prepayments onePrepayment = accountingApi.getPrepayment(accessToken, xeroTenantId, + prepaymentId); + messages.add( + "Get one Prepayment - Total : " + onePrepayment.getPrepayments().get(0).getTotal()); + where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; + Invoices allInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, + where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, + createdByMyApp, null); + Invoice inv = new Invoice(); + inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); + where = null; + + Allocations allocations = new Allocations(); + Allocation allocation = new Allocation(); + allocation.setAmount(1.0); + LocalDate currDate = LocalDate.now(); + allocation.setDate(currDate); + allocation.setInvoice(inv); + allocations.addAllocationsItem(allocation); + + // Allocations newAllocation = + // accountingApi.createPrepaymentAllocation(prepaymentId, allocations); + // messages.add("Create PrePayment allocation - Amt : " + + // newAllocation.getAllocations().get(0).getAmount()); + + // Get History + HistoryRecords history = accountingApi.getPrepaymentHistory(accessToken, xeroTenantId, + prepaymentId); + messages.add("History - count : " + history.getHistoryRecords().size()); + + // Create History + // Error: "The document with the supplied id was not found for this end point. + /* + * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord + * newHistoryRecord = new HistoryRecord(); + * newHistoryRecord.setDetails("Hello World"); + * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords + * createdHistory = + * accountingApi.createPrepaymentHistory(prepaymentId,newHistoryRecords); + * messages.add("History - note added to : " + + * createdHistory.getHistoryRecords().get(0).getDetails()); + */ + } + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("PurchaseOrders")) { + // PURCHASE ORDERS + try { + // CREATE Purchase Order + where = "Type==\"EXPENSE\""; + Accounts arAccounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, + order); + Account arAccount = arAccounts.getAccounts().get(0); + where = null; + + PurchaseOrders purchaseOrders = new PurchaseOrders(); + PurchaseOrder purchaseOrder = new PurchaseOrder(); + LocalDate currDate = LocalDate.now(); + purchaseOrder.setDate(currDate); + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + purchaseOrder.setContact(useContact); + + List lineItems = new ArrayList<>(); + LineItem li = new LineItem(); + li.setAccountCode(arAccount.getCode()); + li.setDescription("Foobar"); + li.setQuantity(1.0); + li.setUnitAmount(20.00); + lineItems.add(li); + purchaseOrder.setLineItems(lineItems); + purchaseOrders.addPurchaseOrdersItem(purchaseOrder); + PurchaseOrders createdPurchaseOrders = accountingApi.createPurchaseOrder(accessToken, xeroTenantId, + purchaseOrders, summarizeErrors); + messages.add("Create Purchase order - total : " + + createdPurchaseOrders.getPurchaseOrders().get(0).getTotal()); + + // UPDATE Purchase Orders + UUID newPurchaseOrderID = createdPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); + createdPurchaseOrders.getPurchaseOrders().get(0).setAttentionTo("Jimmy"); + PurchaseOrders updatePurchaseOrders = accountingApi.updatePurchaseOrder(accessToken, xeroTenantId, + newPurchaseOrderID, createdPurchaseOrders); + messages.add("Update Purchase order - attn : " + + updatePurchaseOrders.getPurchaseOrders().get(0).getAttentionTo()); + + // GET Purchase Orders + String status = null; + String dateFrom = null; + String dateTo = null; + PurchaseOrders allPurchaseOrders = accountingApi.getPurchaseOrders(accessToken, xeroTenantId, + ifModifiedSince, status, dateFrom, dateTo, order, null); + messages.add("Get Purchase orders - Count : " + allPurchaseOrders.getPurchaseOrders().size()); + + // GET one Purchase Order + UUID purchaseOrderID = allPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); + PurchaseOrders onePurchaseOrder = accountingApi.getPurchaseOrder(accessToken, xeroTenantId, + purchaseOrderID); + messages.add( + "Get one Purchase order - Total : " + onePurchaseOrder.getPurchaseOrders().get(0).getTotal()); + + // DELETE Purchase Orders + createdPurchaseOrders.getPurchaseOrders().get(0) + .setStatus(com.xero.models.accounting.PurchaseOrder.StatusEnum.DELETED); + PurchaseOrders deletePurchaseOrders = accountingApi.updatePurchaseOrder(accessToken, xeroTenantId, + newPurchaseOrderID, createdPurchaseOrders); + messages.add("Delete Purchase order - Status : " + + deletePurchaseOrders.getPurchaseOrders().get(0).getStatus()); + + // Get History + HistoryRecords history = accountingApi.getInvoiceHistory(accessToken, xeroTenantId, purchaseOrderID); + messages.add("History - count : " + history.getHistoryRecords().size()); + + // Create History + HistoryRecords newHistoryRecords = new HistoryRecords(); + HistoryRecord newHistoryRecord = new HistoryRecord(); + newHistoryRecord.setDetails("Hello World"); + newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); + HistoryRecords newHistory = accountingApi.createPurchaseOrderHistory(accessToken, xeroTenantId, + purchaseOrderID, newHistoryRecords); + messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Receipts")) { + /* RECEIPTS */ + try { + // Create + // where = "IsSubscriber==true"; + Users users = accountingApi.getUsers(accessToken, xeroTenantId, ifModifiedSince, where, order); + where = null; + + where = "ShowInExpenseClaims==true && Status==\"ACTIVE\""; + Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); + where = null; + + User useUser = new User(); + useUser.setUserID(users.getUsers().get(0).getUserID()); + + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + // CREATE NEW RECEIPT + Receipts receipts = new Receipts(); + Receipt receipt = new Receipt(); + + LineItem li = new LineItem(); + li.setAccountCode(accounts.getAccounts().get(0).getCode()); + li.setDescription("Foobar"); + li.setQuantity(2.0); + li.setUnitAmount(20.00); + li.setLineAmount(40.00); + li.setTaxType("NONE"); + + receipt.addLineitemsItem(li); + receipt.setUser(useUser); + receipt.lineAmountTypes(LineAmountTypes.NOTAX); + receipt.contact(useContact); + receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); + receipts.addReceiptsItem(receipt); + Receipts newReceipts = accountingApi.createReceipt(accessToken, xeroTenantId, receipts); + messages.add("Create Receipts - Total : " + newReceipts.getReceipts().get(0).getTotal()); + + // UPDATE Receipts + UUID newReceiptId = newReceipts.getReceipts().get(0).getReceiptID(); + newReceipts.getReceipts().get(0).setReference("Foobar"); + Receipts updateReceipts = accountingApi.updateReceipt(accessToken, xeroTenantId, newReceiptId, + newReceipts); + messages.add("Create Receipts - Ref : " + updateReceipts.getReceipts().get(0).getReference()); + + // GET all Receipts + Receipts allReceipts = accountingApi.getReceipts(accessToken, xeroTenantId, ifModifiedSince, where, + order, null); + messages.add("Create Receipts - Count : " + allReceipts.getReceipts().size()); + + // GET one Receipts + UUID receiptID = allReceipts.getReceipts().get(0).getReceiptID(); + Receipts oneReceipts = accountingApi.getReceipt(accessToken, xeroTenantId, receiptID); + messages.add("Create Receipts - Total : " + oneReceipts.getReceipts().get(0).getTotal()); + + // Get History + HistoryRecords history = accountingApi.getReceiptHistory(accessToken, xeroTenantId, receiptID); + messages.add("History - count : " + history.getHistoryRecords().size()); + + // Create History + // Error: "The document with the supplied id was not found for this endpoint. + /* + * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord + * newHistoryRecord = new HistoryRecord(); + * newHistoryRecord.setDetails("Hello World"); + * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords + * newHistory = accountingApi.createReceiptHistory(receiptID, + * newHistoryRecords); messages.add("History - note added to : " + + * newHistory.getHistoryRecords().get(0).getDetails()); + */ + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("RepeatingInvoices")) { + /* REPEATING INVOICE */ + try { + // GET all Repeating Invoices + RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(accessToken, xeroTenantId, + where, order); + if (repeatingInvoices.getRepeatingInvoices().size() > 0) { + messages.add("Repeating Invoice - count : " + repeatingInvoices.getRepeatingInvoices().size()); + + // GET one Repeating Invoices + UUID repeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); + RepeatingInvoices repeatingInvoice = accountingApi.getRepeatingInvoice(accessToken, xeroTenantId, + repeatingInvoiceID); + messages.add( + "Repeating Invoice - total : " + repeatingInvoice.getRepeatingInvoices().get(0).getTotal()); + + // Get History + HistoryRecords history = accountingApi.getRepeatingInvoiceHistory(accessToken, xeroTenantId, + repeatingInvoiceID); + messages.add("History - count : " + history.getHistoryRecords().size()); + + // Create History + // Error: "The document with the supplied id was not found for this endpoint. + /* + * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord + * newHistoryRecord = new HistoryRecord(); + * newHistoryRecord.setDetails("Hello World"); + * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords + * newHistory = accountingApi.createRepeatingInvoiceHistory(repeatingInvoiceID, + * newHistoryRecords); messages.add("History - note added to : " + + * newHistory.getHistoryRecords().get(0).getDetails()); + */ + } else { + messages.add("Zero repeating Invoices found"); + + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Reports")) { + + /* REPORTS */ + try { + + /* + * // TenNinetyNine - US Only String reportYear = null; Reports reports = + * accountingApi.getReportTenNinetyNine(reportYear); + * System.out.println(reports.toString()); + */ + // AgedPayablesByContact + String date = null; + String fromDate = null; + String toDate = null; + String profitLossTimeframe = null; + String trackingOptionID1 = null; + String trackingOptionID2 = null; + boolean standardLayout = false; + boolean paymentsOnly = false; + String trackingCategoryID = null; + String trackingCategoryID2 = null; + String trackingOptionID = null; + + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, null, includeArchived); + UUID contactId = contacts.getContacts().get(0).getContactID(); + LocalDate xDate = LocalDate.now(); + LocalDate xFromDate = LocalDate.now(); + LocalDate xToDate = LocalDate.now(); + + ReportWithRows reportAgedPayablesByContact = accountingApi.getReportAgedPayablesByContact(accessToken, + xeroTenantId, contactId, xDate, xFromDate, xToDate); + messages.add("Get a Reports - Name:" + reportAgedPayablesByContact.getReports().get(0).getReportName()); + + // AgedReceivablesByContact + ReportWithRows reportAgedReceivablesByContact = accountingApi.getReportAgedReceivablesByContact( + accessToken, xeroTenantId, contactId, xDate, xFromDate, xToDate); + messages.add( + "Get a Reports - Name:" + reportAgedReceivablesByContact.getReports().get(0).getReportName()); + + // reportBalanceSheet + ReportWithRows reportBalanceSheet = accountingApi.getReportBalanceSheet(accessToken, xeroTenantId, + toDate, 3, "MONTH", trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); + messages.add("Get a Reports - Name:" + reportBalanceSheet.getReports().get(0).getReportName()); + + // reportBankSummary + ReportWithRows reportBankSummary = accountingApi.getReportBankSummary(accessToken, xeroTenantId, + xToDate, null, null); + messages.add("Get a Reports - Name:" + reportBankSummary.getReports().get(0).getReportName()); + + // reportBASorGSTlist - AU and NZ only + ReportWithRows reportTax = accountingApi.getReportBASorGSTList(accessToken, xeroTenantId); + System.out.println(reportTax.toString()); + + // reportBudgetSummary + int budgetPeriod = 1; + int budgetTimeframe = 3; + ReportWithRows reportBudgetSummary = accountingApi.getReportBudgetSummary(accessToken, xeroTenantId, + xToDate, budgetPeriod, budgetTimeframe); + messages.add("Get a Reports - Name:" + reportBudgetSummary.getReports().get(0).getReportName()); + + // reportExecutiveSummary + ReportWithRows reportExecutiveSummary = accountingApi.getReportExecutiveSummary(accessToken, + xeroTenantId, xToDate); + messages.add("Get a Reports - Name:" + reportExecutiveSummary.getReports().get(0).getReportName()); + + // reportProfitandLoss + fromDate = "2018-01-01"; + toDate = "2018-12-31"; + profitLossTimeframe = "MONTH"; + standardLayout = true; + paymentsOnly = false; + ReportWithRows reportProfitLoss = accountingApi.getReportProfitAndLoss(accessToken, xeroTenantId, + xFromDate, xToDate, null, profitLossTimeframe, trackingCategoryID, trackingCategoryID2, + trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); + messages.add("Get a Reports - Name:" + reportProfitLoss.getReports().get(0).getReportName()); + fromDate = null; + toDate = null; + + // reportTrialBalance + ReportWithRows reportTrialBalance = accountingApi.getReportTrialBalance(accessToken, xeroTenantId, + xToDate, paymentsOnly); + messages.add("Get a Reports - Name:" + reportTrialBalance.getReports().get(0).getReportName()); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("TrackingCategories")) { + // TRACKING CATEGORIES + try { + // GET Tracking Categories + TrackingCategories trackingCategories = accountingApi.getTrackingCategories(accessToken, xeroTenantId, + where, order, includeArchived); + int count = trackingCategories.getTrackingCategories().size(); + + if (count == 2) { + // DELETE Tracking Categories + UUID trackingCategoryID = trackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); + TrackingCategories deletedTrackingCategories = accountingApi.deleteTrackingCategory(accessToken, + xeroTenantId, trackingCategoryID); + messages.add("DELETED tracking categories - status : " + + deletedTrackingCategories.getTrackingCategories().get(0).getStatus()); + } + + // CREATE Tracking Categories + TrackingCategory newTrackingCategory = new TrackingCategory(); + newTrackingCategory.setName("Foo" + loadRandomNum()); + TrackingCategories createdTrackingCategories = accountingApi.createTrackingCategory(accessToken, + xeroTenantId, newTrackingCategory); + messages.add("CREATED tracking categories - name : " + + createdTrackingCategories.getTrackingCategories().get(0).getName()); + + // UPDATE Tracking Categories + UUID newTrackingCategoryID = createdTrackingCategories.getTrackingCategories().get(0) + .getTrackingCategoryID(); + newTrackingCategory.setName("Foo" + loadRandomNum()); + TrackingCategories updatedTrackingCategories = accountingApi.updateTrackingCategory(accessToken, + xeroTenantId, newTrackingCategoryID, newTrackingCategory); + messages.add("UPDATED tracking categories - name : " + + updatedTrackingCategories.getTrackingCategories().get(0).getName()); + + // GET one Tracking Categories + if (count > 0) { + UUID oneTrackingCategoryID = trackingCategories.getTrackingCategories().get(0) + .getTrackingCategoryID(); + TrackingCategories oneTrackingCategories = accountingApi.getTrackingCategory(accessToken, + xeroTenantId, oneTrackingCategoryID); + messages.add("GET ONE tracking categories - name : " + + oneTrackingCategories.getTrackingCategories().get(0).getName()); + + // Create one Option + TrackingOption option = new TrackingOption(); + option.setName("Bar" + loadRandomNum()); + TrackingOptions newTrackingOptions = accountingApi.createTrackingOptions(accessToken, xeroTenantId, + oneTrackingCategoryID, option); + messages.add("CREATE option - name : " + newTrackingOptions.getOptions().get(0).getName()); + + // DELETE All options + // UUID newOptionId = + // newTrackingOptions.getOptions().get(0).getTrackingOptionID(); + // TrackingOptions deleteOptions = + // accountingApi.deleteTrackingOptions(oneTrackingCategoryID, newOptionId); + // messages.add("DELETE one option - Status : " + + // deleteOptions.getOptions().get(0).getStatus()); + } + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("TaxRates")) { + // TAX RATE + try { + // CREATE Tax Rate + TaxRates newTaxRates = new TaxRates(); + TaxRate newTaxRate = new TaxRate(); + TaxComponent rate01 = new TaxComponent(); + rate01.setName("State Tax"); + rate01.setRate(2.25); + newTaxRate.setName("SDKTax" + loadRandomNum()); + newTaxRate.addTaxComponentsItem(rate01); + newTaxRates.addTaxRatesItem(newTaxRate); + + TaxRates createdTaxRate = accountingApi.createTaxRate(accessToken, xeroTenantId, newTaxRates); + messages.add("CREATE TaxRate - name : " + createdTaxRate.getTaxRates().get(0).getName()); + + // UDPATE Tax Rate + newTaxRates.getTaxRates().get(0).setStatus(com.xero.models.accounting.TaxRate.StatusEnum.DELETED); + TaxRates updatedTaxRate = accountingApi.updateTaxRate(accessToken, xeroTenantId, newTaxRates); + messages.add("UPDATED TaxRate - status : " + updatedTaxRate.getTaxRates().get(0).getStatus()); + + // GET Tax Rate + String taxType = null; + TaxRates taxRates = accountingApi.getTaxRates(accessToken, xeroTenantId, where, order, taxType); + messages.add("GET TaxRate - cnt : " + taxRates.getTaxRates().size()); + + // GET Tax Rate + taxType = "CAPEXINPUT2"; + TaxRates taxRatesByType = accountingApi.getTaxRates(accessToken, xeroTenantId, where, order, taxType); + messages.add("GET TaxRate by Cap Purchase Type : " + taxRatesByType.getTaxRates().size()); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Users")) { + // USER + try { + // GET Users + Users users = accountingApi.getUsers(accessToken, xeroTenantId, ifModifiedSince, where, order); + messages.add("GET Users - cnt : " + users.getUsers().size()); + + // GET One User + UUID userID = users.getUsers().get(0).getUserID(); + Users user = accountingApi.getUser(accessToken, xeroTenantId, userID); + messages.add("GET Users - First Name : " + user.getUsers().get(0).getFirstName()); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } else if (object.equals("Errors")) { + + try { + Contact contact = new Contact(); + contact.setName("Sidney Maestre"); + Contacts createContact1 = accountingApi.createContact(accessToken, xeroTenantId, contact); + Contacts createContact2 = accountingApi.createContact(accessToken, xeroTenantId, contact); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + try { + Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, null, includeArchived); + Contact useContact = new Contact(); + useContact.setContactID(contacts.getContacts().get(0).getContactID()); + + Invoices newInvoices = new Invoices(); + Invoice myInvoice = new Invoice(); + + LineItem li = new LineItem(); + li.setAccountCode("123456789"); + li.setDescription("Acme Tires"); + li.setQuantity(2.0); + li.setUnitAmount(20.00); + li.setLineAmount(40.00); + li.setTaxType("NONE"); + + myInvoice.addLineItemsItem(li); + myInvoice.setContact(useContact); + myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); + myInvoice.setReference("One Fish, Two Fish"); + myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.SUBMITTED); + newInvoices.addInvoicesItem(myInvoice); + + Invoices newInvoice = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoices, true); + messages.add("Create invoice - Reference : " + newInvoice.getInvoices().get(0).getReference()); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + try { + UUID badContactId = UUID.fromString("bd2270c3-0000-4c11-9cfb-000b551c3f51"); + Contacts badContacts = accountingApi.getContact(accessToken, xeroTenantId, badContactId); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + Contacts ContactList = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, + ids, null, includeArchived); + int num4 = findRandomNum(ContactList.getContacts().size()); + UUID contactId = ContactList.getContacts().get(num4).getContactID(); + try { + for (int i = 80; i > 1; i--) { + Contacts allMyContacts = accountingApi.getContact(accessToken, xeroTenantId, contactId); + } + messages.add("Congrats - you made over 60 calls without hitting rate limit"); + } catch (XeroApiException xe) { + this.addError(xe, messages); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + + for (int i = 0; i < messages.size(); i++) { + System.out.println(messages.get(i)); + respWriter.println("

" + messages.get(i) + "

"); + } + + respWriter.println("
end processing request
"); + respWriter.println("
"); + } + + protected void addToMapIfNotNull(Map map, String key, Object value) { if (value != null) { map.put(key, value.toString()); } } - - protected void addError(XeroApiException xe, ArrayList messages) - { - messages.add("Xero Exception: " + xe.getResponseCode()); - for(Element item : xe.getError().getElements()){ - for(ValidationError err : item.getValidationErrors()){ - messages.add("Error Msg: " + err.getMessage()); - } - } - } - - protected String saveFile(ByteArrayInputStream input, String fileName) { - String saveFilePath = null; - File f = new File("./"); - String dirPath; - try { - dirPath = f.getCanonicalPath(); - - FileOutputStream output = new FileOutputStream(fileName); - - int DEFAULT_BUFFER_SIZE = 1024; - byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; - int n = 0; - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - while (n >= 0) { - output.write(buffer, 0, n); - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - } - input.close(); - output.close(); - - saveFilePath = dirPath + File.separator + fileName; - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return saveFilePath; - } - - public static int loadRandomNum() { - Random randomGenerator = new Random(); - int randomInt = randomGenerator.nextInt(100000); - return randomInt; - } - - public static int findRandomNum(int total) { - Random randomGenerator = new Random(); - int randomInt = randomGenerator.nextInt(total); - return randomInt; - } + + protected void addError(XeroApiException xe, ArrayList messages) { + messages.add("Xero Exception: " + xe.getResponseCode()); + for (Element item : xe.getError().getElements()) { + for (ValidationError err : item.getValidationErrors()) { + messages.add("Error Msg: " + err.getMessage()); + } + } + } + + protected String saveFile(ByteArrayInputStream input, String fileName) { + String saveFilePath = null; + File f = new File("./"); + String dirPath; + try { + dirPath = f.getCanonicalPath(); + + FileOutputStream output = new FileOutputStream(fileName); + + int DEFAULT_BUFFER_SIZE = 1024; + byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; + int n = 0; + n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); + while (n >= 0) { + output.write(buffer, 0, n); + n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); + } + input.close(); + output.close(); + + saveFilePath = dirPath + File.separator + fileName; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return saveFilePath; + } + + public static int loadRandomNum() { + Random randomGenerator = new Random(); + int randomInt = randomGenerator.nextInt(100000); + return randomInt; + } + + public static int findRandomNum(int total) { + Random randomGenerator = new Random(); + int randomInt = randomGenerator.nextInt(total); + return randomInt; + } } diff --git a/src/main/java/com/xero/example/Authorization.java b/src/main/java/com/xero/example/Authorization.java index 35664bda..beaddb53 100644 --- a/src/main/java/com/xero/example/Authorization.java +++ b/src/main/java/com/xero/example/Authorization.java @@ -3,11 +3,13 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Random; + import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import com.google.api.client.auth.oauth2.AuthorizationCodeFlow; import com.google.api.client.auth.oauth2.BearerToken; import com.google.api.client.auth.oauth2.ClientParametersAuthentication; @@ -20,20 +22,30 @@ @WebServlet("/Authorization") public class Authorization extends HttpServlet { - private static final long serialVersionUID = 1L; - final String clientId = "--YOUR_CLIENT_ID--"; + private static final long serialVersionUID = 1L; + final String clientId = "--YOUR_CLIENT_ID--"; final String clientSecret = "--YOUR_CLIENT_SECRET--"; - final String redirectURI = "--YOUR_REDIRECT_URI--";final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; + final String redirectURI = "--YOUR_REDIRECT_URI--"; + + final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; final String AUTHORIZATION_SERVER_URL = "https://login.xero.com/identity/connect/authorize"; - final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport(); + final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport(); final JsonFactory JSON_FACTORY = new JacksonFactory(); final String secretState = "secret" + new Random().nextInt(999_999); - + + /** + * @see HttpServlet#HttpServlet() + */ public Authorization() { super(); } - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse + * response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { ArrayList scopeList = new ArrayList(); scopeList.add("openid"); scopeList.add("email"); @@ -46,23 +58,16 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t scopeList.add("accounting.reports.read"); scopeList.add("accounting.attachments"); scopeList.add("paymentservices"); - - DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory(); - AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(), - HTTP_TRANSPORT, - JSON_FACTORY, - new GenericUrl(TOKEN_SERVER_URL), - new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL) - .setScopes(scopeList) - .setDataStoreFactory(DATA_STORE_FACTORY) - .build(); - - String url = flow.newAuthorizationUrl() - .setClientId(clientId) - .setScopes(scopeList) - .setState(secretState) - .setRedirectUri(redirectURI).build(); - - response.sendRedirect(url); - } -} \ No newline at end of file + + DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory(); + AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(), + HTTP_TRANSPORT, JSON_FACTORY, new GenericUrl(TOKEN_SERVER_URL), + new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL) + .setScopes(scopeList).setDataStoreFactory(DATA_STORE_FACTORY).build(); + + String url = flow.newAuthorizationUrl().setClientId(clientId).setScopes(scopeList).setState(secretState) + .setRedirectUri(redirectURI).build(); + + response.sendRedirect(url); + } +} diff --git a/src/main/java/com/xero/example/Callback.java b/src/main/java/com/xero/example/Callback.java index d4798e2b..5ef4abf9 100644 --- a/src/main/java/com/xero/example/Callback.java +++ b/src/main/java/com/xero/example/Callback.java @@ -29,71 +29,79 @@ @WebServlet("/Callback") public class Callback extends HttpServlet { - private static final long serialVersionUID = 1L; - final String clientId = "--YOUR_CLIENT_ID--"; - final String clientSecret = "--YOUR_CLIENT_SECRET--"; - final String redirectURI = "--YOUR_REDIRECT_URI--"; + private static final long serialVersionUID = 1L; + final String clientId = "--YOUR_CLIENT_ID--"; + final String clientSecret = "--YOUR_CLIENT_SECRET--"; + final String redirectURI = "--YOUR_REDIRECT_URI--"; final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; final String AUTHORIZATION_SERVER_URL = "https://login.xero.com/identity/connect/authorize"; - final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport(); + final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport(); final JsonFactory JSON_FACTORY = new JacksonFactory(); + /** + * @see HttpServlet#HttpServlet() + */ public Callback() { super(); } - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - String code = "123"; - if (request.getParameter("code") != null) { - code = request.getParameter("code"); - } - - ArrayList scopeList = new ArrayList(); - scopeList.add("openid"); - scopeList.add("email"); - scopeList.add("profile"); - scopeList.add("offline_access"); - scopeList.add("accounting.settings"); - scopeList.add("accounting.transactions"); - scopeList.add("accounting.contacts"); - scopeList.add("accounting.journals.read"); - scopeList.add("accounting.reports.read"); - scopeList.add("accounting.attachments"); - scopeList.add("paymentservices"); - - DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory(); - - AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(), - HTTP_TRANSPORT, - JSON_FACTORY, - new GenericUrl(TOKEN_SERVER_URL), - new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL).setScopes(scopeList).setDataStoreFactory(DATA_STORE_FACTORY).build(); - - TokenResponse tokenResponse = flow.newTokenRequest(code).setRedirectUri(redirectURI).execute(); - - HttpTransport httpTransport = new NetHttpTransport(); - JsonFactory jsonFactory = new JacksonFactory(); - GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory).setClientSecrets(clientId, clientSecret).build(); - credential.setAccessToken(tokenResponse.getAccessToken()); - credential.setRefreshToken(tokenResponse.getRefreshToken()); - credential.setExpiresInSeconds(tokenResponse.getExpiresInSeconds()); - - // Create requestFactory with credentials - HttpTransport transport = new NetHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - - // Init IdentityApi client - ApiClient defaultClient = new ApiClient("https://api.xero.com",null,null,null,requestFactory); - IdentityApi idApi = new IdentityApi(defaultClient); - List connection = idApi.getConnections(); - - TokenStorage store = new TokenStorage(); - store.saveItem(response, "jwt_token", tokenResponse.toPrettyString()); - store.saveItem(response, "access_token", tokenResponse.getAccessToken()); - store.saveItem(response, "refresh_token", tokenResponse.getRefreshToken()); - store.saveItem(response, "expires_in_seconds", tokenResponse.getExpiresInSeconds().toString()); - store.saveItem(response, "xero_tenant_id", connection.get(0).getTenantId().toString()); - - response.sendRedirect("./AuthenticatedResource"); - } -} \ No newline at end of file + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse + * response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + String code = "123"; + if (request.getParameter("code") != null) { + code = request.getParameter("code"); + } + + ArrayList scopeList = new ArrayList(); + scopeList.add("openid"); + scopeList.add("email"); + scopeList.add("profile"); + scopeList.add("offline_access"); + scopeList.add("accounting.settings"); + scopeList.add("accounting.transactions"); + scopeList.add("accounting.contacts"); + scopeList.add("accounting.journals.read"); + scopeList.add("accounting.reports.read"); + scopeList.add("accounting.attachments"); + scopeList.add("paymentservices"); + + DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory(); + + AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(), + HTTP_TRANSPORT, JSON_FACTORY, new GenericUrl(TOKEN_SERVER_URL), + new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL) + .setScopes(scopeList).setDataStoreFactory(DATA_STORE_FACTORY).build(); + + TokenResponse tokenResponse = flow.newTokenRequest(code).setRedirectUri(redirectURI).execute(); + + HttpTransport httpTransport = new NetHttpTransport(); + JsonFactory jsonFactory = new JacksonFactory(); + GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport) + .setJsonFactory(jsonFactory).setClientSecrets(clientId, clientSecret).build(); + credential.setAccessToken(tokenResponse.getAccessToken()); + credential.setRefreshToken(tokenResponse.getRefreshToken()); + credential.setExpiresInSeconds(tokenResponse.getExpiresInSeconds()); + + // Create requestFactory with credentials + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + // Init IdentityApi client + ApiClient defaultClient = new ApiClient("https://api.xero.com", null, null, null, requestFactory); + IdentityApi idApi = new IdentityApi(defaultClient); + List connection = idApi.getConnections(); + + TokenStorage store = new TokenStorage(); + store.saveItem(response, "jwt_token", tokenResponse.toPrettyString()); + store.saveItem(response, "access_token", tokenResponse.getAccessToken()); + store.saveItem(response, "refresh_token", tokenResponse.getRefreshToken()); + store.saveItem(response, "expires_in_seconds", tokenResponse.getExpiresInSeconds().toString()); + store.saveItem(response, "xero_tenant_id", connection.get(0).getTenantId().toString()); + + response.sendRedirect("./AuthenticatedResource"); + } +} diff --git a/src/main/java/com/xero/example/TokenRefresh.java b/src/main/java/com/xero/example/TokenRefresh.java index 841e5d70..9bf791ce 100644 --- a/src/main/java/com/xero/example/TokenRefresh.java +++ b/src/main/java/com/xero/example/TokenRefresh.java @@ -19,81 +19,84 @@ import com.google.api.client.json.jackson2.JacksonFactory; public class TokenRefresh { - final static Logger logger = LogManager.getLogger(AuthenticatedResource.class); - final String clientId = "--YOUR_CLIENT_ID--"; - final String clientSecret = "--YOUR_CLIENT_SECRET--"; - final String redirectURI = "--YOUR_REDIRECT_URI--"; - final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; - - public TokenRefresh() - { - super(); - } - - public String checkToken(String accessToken, String refreshToken, HttpServletResponse response) throws IOException - { - String currToken =null; + final static Logger logger = LogManager.getLogger(AuthenticatedResource.class); + final String clientId = "--YOUR_CLIENT_ID--"; + final String clientSecret = "--YOUR_CLIENT_SECRET--"; + final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; - try { - DecodedJWT jwt = JWT.decode(accessToken); + public TokenRefresh() { + super(); + } - if (jwt.getExpiresAt().getTime() > System.currentTimeMillis()) { - if(logger.isDebugEnabled()){ - logger.debug("------------------ Refresh Token : NOT NEEDED - return current token -------------------"); - } - currToken = accessToken; - } else { - if(logger.isDebugEnabled()){ - logger.debug("------------------ Refresh Token : BEGIN -------------------"); - } - try { - TokenResponse tokenResponse = new RefreshTokenRequest(new NetHttpTransport(), new JacksonFactory(), new GenericUrl( - TOKEN_SERVER_URL), refreshToken) - .setClientAuthentication(new BasicAuthentication(this.clientId, this.clientSecret)).execute(); - if(logger.isDebugEnabled()){ - logger.debug("------------------ Refresh Token : SUCCESS -------------------"); - } - - // DEMO PURPOSE ONLY - You'll need to implement your own token storage solution - TokenStorage store = new TokenStorage(); - store.saveItem(response, "jwt_token", tokenResponse.toPrettyString()); - store.saveItem(response, "access_token", tokenResponse.getAccessToken()); - store.saveItem(response, "refresh_token", tokenResponse.getRefreshToken()); - store.saveItem(response, "expires_in_seconds", tokenResponse.getExpiresInSeconds().toString()); - - currToken = tokenResponse.getAccessToken(); - } catch (TokenResponseException e) { - if(logger.isDebugEnabled()){ - logger.debug("------------------ Refresh Token : EXCEPTION -------------------"); - } - if (e.getDetails() != null) { - if(logger.isDebugEnabled()){ - logger.debug("Error: " + e.getDetails().getError()); - } - if (e.getDetails().getErrorDescription() != null) { - if(logger.isDebugEnabled()){ - logger.debug(e.getDetails().getErrorDescription()); - } - } - if (e.getDetails().getErrorUri() != null) { - if(logger.isDebugEnabled()){ - logger.debug(e.getDetails().getErrorUri()); - } - } - } else { - if(logger.isDebugEnabled()){ - logger.debug("------------------ Refresh Token : EXCEPTION -------------------"); - logger.debug(e.getMessage()); - } - } - } - } - } catch (JWTDecodeException exception){ - if(logger.isDebugEnabled()){ - logger.debug("------------------ Refresh Token : INVALID TOKEN -------------------"); - logger.debug(exception.getMessage()); - } - } - return currToken; - } -} \ No newline at end of file + public String checkToken(String accessToken, String refreshToken, HttpServletResponse response) throws IOException { + String currToken = null; + + try { + DecodedJWT jwt = JWT.decode(accessToken); + + if (jwt.getExpiresAt().getTime() > System.currentTimeMillis()) { + if (logger.isDebugEnabled()) { + logger.debug( + "------------------ Refresh Token : NOT NEEDED - return current token -------------------"); + } + currToken = accessToken; + } else { + if (logger.isDebugEnabled()) { + logger.debug("------------------ Refresh Token : BEGIN -------------------"); + } + try { + TokenResponse tokenResponse = new RefreshTokenRequest(new NetHttpTransport(), new JacksonFactory(), + new GenericUrl(TOKEN_SERVER_URL), refreshToken) + .setClientAuthentication(new BasicAuthentication(this.clientId, this.clientSecret)) + .execute(); + if (logger.isDebugEnabled()) { + logger.debug("------------------ Refresh Token : SUCCESS -------------------"); + } + + // DEMO PURPOSE ONLY - You'll need to implement your own token storage solution + TokenStorage store = new TokenStorage(); + store.saveItem(response, "jwt_token", tokenResponse.toPrettyString()); + store.saveItem(response, "access_token", tokenResponse.getAccessToken()); + store.saveItem(response, "refresh_token", tokenResponse.getRefreshToken()); + store.saveItem(response, "expires_in_seconds", tokenResponse.getExpiresInSeconds().toString()); + + currToken = tokenResponse.getAccessToken(); + } catch (TokenResponseException e) { + if (logger.isDebugEnabled()) { + logger.debug("------------------ Refresh Token : EXCEPTION -------------------"); + } + if (e.getDetails() != null) { + if (logger.isDebugEnabled()) { + logger.debug("Error: " + e.getDetails().getError()); + } + if (e.getDetails().getErrorDescription() != null) { + if (logger.isDebugEnabled()) { + logger.debug(e.getDetails().getErrorDescription()); + } + } + if (e.getDetails().getErrorUri() != null) { + + if (logger.isDebugEnabled()) { + logger.debug(e.getDetails().getErrorUri()); + } + } + } else { + if (logger.isDebugEnabled()) { + logger.debug("------------------ Refresh Token : EXCEPTION -------------------"); + logger.debug(e.getMessage()); + } + } + } + } + + } catch (JWTDecodeException exception) { + if (logger.isDebugEnabled()) { + logger.debug("------------------ Refresh Token : INVALID TOKEN -------------------"); + logger.debug(exception.getMessage()); + } + } + + return currToken; + } + +} diff --git a/src/main/java/com/xero/example/TokenStorage.java b/src/main/java/com/xero/example/TokenStorage.java index 58941f03..27252d67 100644 --- a/src/main/java/com/xero/example/TokenStorage.java +++ b/src/main/java/com/xero/example/TokenStorage.java @@ -10,58 +10,51 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -public class TokenStorage -{ - - public TokenStorage() - { - super(); - } - - public String get(HttpServletRequest request,String key) - { - String item = null; - Cookie[] cookies = request.getCookies(); - if (cookies != null) { - for (int i = 0; i < cookies.length; i++) - { - if (cookies[i].getName().equals(key)) - { - item = cookies[i].getValue(); - } - } - } - return item; - } - - public void clear(HttpServletResponse response) - { - HashMap map = new HashMap(); - map.put("accessToken",""); - map.put("refreshToken",""); - map.put("xeroTenantId",""); - - save(response,map); - } - - public void saveItem(HttpServletResponse response,String key, String value) - { - Cookie t = new Cookie(key,value); - response.addCookie(t); - } - - public void save(HttpServletResponse response,HashMap map) - { - Set> set = map.entrySet(); - Iterator> iterator = set.iterator(); - - while(iterator.hasNext()) { - Map.Entry mentry = iterator.next(); - String key = (String)mentry.getKey(); - String value = (String)mentry.getValue(); - - Cookie t = new Cookie(key,value); - response.addCookie(t); - } - } +public class TokenStorage { + + public TokenStorage() { + super(); + } + + public String get(HttpServletRequest request, String key) { + String item = null; + Cookie[] cookies = request.getCookies(); + if (cookies != null) { + for (int i = 0; i < cookies.length; i++) { + if (cookies[i].getName().equals(key)) { + item = cookies[i].getValue(); + } + } + } + return item; + } + + public void clear(HttpServletResponse response) { + HashMap map = new HashMap(); + map.put("tempToken", ""); + map.put("tempTokenSecret", ""); + map.put("sessionHandle", ""); + map.put("tokenTimestamp", ""); + + save(response, map); + } + + public void saveItem(HttpServletResponse response, String key, String value) { + Cookie t = new Cookie(key, value); + response.addCookie(t); + } + + public void save(HttpServletResponse response, HashMap map) { + Set> set = map.entrySet(); + Iterator> iterator = set.iterator(); + + while (iterator.hasNext()) { + Map.Entry mentry = iterator.next(); + String key = (String) mentry.getKey(); + String value = (String) mentry.getValue(); + + Cookie t = new Cookie(key, value); + response.addCookie(t); + } + } } \ No newline at end of file From 1cde8841a1c4d7562128a525a3923a9ea394de14 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Mon, 19 Aug 2019 20:26:28 -0700 Subject: [PATCH 42/76] add code of conduct and contributing --- CODE_OF_CONDUCT.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..b0fa5845 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at api@xero.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..7bb3e01d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,60 @@ +# Contributing to Xero-Java +We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: + +- Reporting a bug +- Discussing the current state of the code +- Submitting a fix +- Proposing new features +- Becoming a maintainer + +## We Develop with Github +We use github to host code, to track issues and feature requests, as well as accept pull requests. + +## We Use OpenAPI Generator +The best way to propose changes to the codebase is to open an [issue](https://github.com/XeroAPI/Xero-Java/issues) to discuss. + +We are using [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) and [our OpenAPI specs](https://github.com/XeroAPI/Xero-OpenAPI), to create and update our models and client classes. Improvements may require updates to our OAS or our customized mustache templates. + +We welcome your feedback and will work with you to incorporate them. (via generated code or pull request): + +Sometimes, a pull request is the best way to communicate a change. + +1. Fork the repo and create your branch from `master`. +2. If you've added code that should be tested, add tests. +3. If you've changed implementation, update the documentation. +4. Ensure the test suite passes. +5. Issue that pull request! + +## Any contributions you make will be under the MIT Software License +In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. + +## Report bugs using Github's [issues](https://github.com/XeroAPI/Xero-Java/issues) +We use GitHub issues to track public bugs. Report a bug by [opening a new issue](); it's that easy! + +## General Support inquires +[Submit requests for support](https://developer.xero.com/contact-xero-developer-platform-support/) using this SDK or Xero's developer platform and APIs to our API Support team. + +Please don't open GitHub issues for general support - we will be closing these and directing you to submit via the developer platform support form. + +## Write bug reports with detail, background, and sample code + +- A quick summary and/or background +- Steps to reproduce + - Be specific! + - Give sample code if you can. +- What you expected would happen +- What actually happens +- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) + +## Use a Consistent Coding Style + +* 4 spaces for indentation rather than tabs + +How to indent a Java source file in Eclipse: +* Open the file in Eclipse's text editor. +* Ctrl+A to select all text. +* Ctrl+I to indent the text (or right click > Source > Indent). +* Ctrl+S to save the file. + +## License +By contributing, you agree that your contributions will be licensed under its MIT License. \ No newline at end of file From c8e7c14000a5095c779ec5e0dce7b4ab85bd1608 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 08:37:17 -0700 Subject: [PATCH 43/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 88 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7bb3e01d..05c4b598 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,7 @@ # Contributing to Xero-Java -We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: +:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: + +We want to make contributing to this project as easy and transparent as possible, whether it's: - Reporting a bug - Discussing the current state of the code @@ -7,36 +9,47 @@ We love your input! We want to make contributing to this project as easy and tra - Proposing new features - Becoming a maintainer -## We Develop with Github -We use github to host code, to track issues and feature requests, as well as accept pull requests. +The following is a set of guidelines for contributing to Xero and its projects, which are hosted in the [XeroAPI Organization](https://github.com/XeroAPI) on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. + +### Table Of Contents +[Code of Conduct](#code-of-conduct) + +[I don't want to read this whole thing, I just have a question!!!](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question) + +[How Can I Contribute?](#how-can-i-contribute) + * [Reporting Bugs](#reporting-bugs) + * [Suggesting Enhancements](#suggesting-enhancements) + * [Pull Requests](#pull-requests) + -## We Use OpenAPI Generator -The best way to propose changes to the codebase is to open an [issue](https://github.com/XeroAPI/Xero-Java/issues) to discuss. +## Code of Conduct +Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. -We are using [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) and [our OpenAPI specs](https://github.com/XeroAPI/Xero-OpenAPI), to create and update our models and client classes. Improvements may require updates to our OAS or our customized mustache templates. +## I don't want to read this whole thing I just have a question!!! -We welcome your feedback and will work with you to incorporate them. (via generated code or pull request): +> **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below. -Sometimes, a pull request is the best way to communicate a change. +We have an official message board and detailed FAQs and where the community chimes in with helpful advice if you have questions. -1. Fork the repo and create your branch from `master`. -2. If you've added code that should be tested, add tests. -3. If you've changed implementation, update the documentation. -4. Ensure the test suite passes. -5. Issue that pull request! +* [API Documentation](https://developer.xero.com/documentation/) +* [Xero FAQ](https://developer.xero.com/faq) +* [Community, the official Xero message board](https://community.xero.com/developer) +* [Submit requests for support](https://developer.xero.com/contact-xero-developer-platform-support/) using this SDK or Xero's developer platform and APIs to our API Support team. -## Any contributions you make will be under the MIT Software License -In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. +# How Can I Contribute? -## Report bugs using Github's [issues](https://github.com/XeroAPI/Xero-Java/issues) -We use GitHub issues to track public bugs. Report a bug by [opening a new issue](); it's that easy! +You can contribute by reporting bugs, suggesting enhancements, improving documentation i.e. [README](https://github.com/XeroAPI/Xero-Java/blob/oauth2/README.md) or submitting a pull request. -## General Support inquires -[Submit requests for support](https://developer.xero.com/contact-xero-developer-platform-support/) using this SDK or Xero's developer platform and APIs to our API Support team. +## Reporting Bugs -Please don't open GitHub issues for general support - we will be closing these and directing you to submit via the developer platform support form. +Bugs are tracked as issues in this repository. -## Write bug reports with detail, background, and sample code +Before opening a new issue: +* **check [the README](https://github.com/XeroAPI/Xero-Java/blob/oauth2/README.md)** to see if the behavior you observed might be expected and if configuration options are available to provide you with the desired behavior. + +* **perform a cursory search** to see if there's [an existing issue](https://github.com/XeroAPI/Xero-Java/issues) covering your feedback. If there is one and the issue is still open, **add a :+1: reaction** on the issue to express interest in the issue being resolved. That will help the team gauge interest without the noise of comments which trigger notifications to all watchers. Comments should be used only if you have new and useful information to share. + +### Write bug reports with detail, background, and sample code - A quick summary and/or background - Steps to reproduce @@ -46,7 +59,38 @@ Please don't open GitHub issues for general support - we will be closing these a - What actually happens - Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) -## Use a Consistent Coding Style +## Suggesting Enhancements + +When opening an issue for a feature request: +* **use a clear and descriptive title** for the issue to identify the problem. +* **include as many details as possible in the body**. Explain your use-case, the problems you're hitting and the solutions you'd like to see to address those problems. + +## Pull requests + +We welcome your feedback and pull requests. Be aware some code is generated and pull requests may not be the best solution - see below. + +### We Use OpenAPI Generator +The best way to propose changes to the codebase is to open an [issue](https://github.com/XeroAPI/Xero-Java/issues) and discuss with our team. + +We are using [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) and [our OpenAPI specs](https://github.com/XeroAPI/Xero-OpenAPI), to create and update our models and client classes. Improvements may require updates to our OAS or our customized mustache templates instead of modifying via pull request. + +### Submit a pull request + +1. [Fork][fork] and clone the repository +1. Create a new branch: `git checkout -b my-branch-name` +1. Make your change, add tests if needed +1. Make sure the tests pass on your machine: `mvn test` +1. Push to your fork and [submit a pull request][pr] +1. Pat your self on the back and wait for your pull request to be reviewed and merged. + +Here are a few things you can do that will increase the likelihood of your pull request being accepted: + +- Follow the [style guide][style-guide]. +- Write tests. +- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. +- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). + +### Style Guide * 4 spaces for indentation rather than tabs From c605215a32c8aa1cc5c2c8601ec627d8f28cc29c Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 08:39:30 -0700 Subject: [PATCH 44/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 05c4b598..bee6ca3d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,13 +23,13 @@ The following is a set of guidelines for contributing to Xero and its projects, ## Code of Conduct -Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. +Please note that this project is released with a [Contributor Code of Conduct][https://github.com/XeroAPI/Xero-Java/blob/oauth2/CODE_OF_CONDUCT.md]. By participating in this project you agree to abide by its terms. ## I don't want to read this whole thing I just have a question!!! > **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below. -We have an official message board and detailed FAQs and where the community chimes in with helpful advice if you have questions. +We have an official message board where Xero API support and the community chimes in with helpful advice if you have questions. * [API Documentation](https://developer.xero.com/documentation/) * [Xero FAQ](https://developer.xero.com/faq) From 689dc7265798b32a9fb18436d78ec563678c5720 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 10:35:09 -0700 Subject: [PATCH 45/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bee6ca3d..1cd62409 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ The following is a set of guidelines for contributing to Xero and its projects, ## Code of Conduct -Please note that this project is released with a [Contributor Code of Conduct][https://github.com/XeroAPI/Xero-Java/blob/oauth2/CODE_OF_CONDUCT.md]. By participating in this project you agree to abide by its terms. +Please note that this project is released with a [Contributor Code of Conduct](https://github.com/XeroAPI/Xero-Java/blob/oauth2/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms. ## I don't want to read this whole thing I just have a question!!! From 7e74407b16ea1a2285155fce04cbbcaf535fa306 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 10:38:40 -0700 Subject: [PATCH 46/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1cd62409..dd806e27 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,11 +29,12 @@ Please note that this project is released with a [Contributor Code of Conduct](h > **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below. -We have an official message board where Xero API support and the community chimes in with helpful advice if you have questions. +We have an official [message board](https://community.xero.com/developer) where Xero API support and the community chimes in with helpful advice if you have questions. * [API Documentation](https://developer.xero.com/documentation/) * [Xero FAQ](https://developer.xero.com/faq) * [Community, the official Xero message board](https://community.xero.com/developer) +* [Stackoverflow - Xero related](https://stackoverflow.com/questions/tagged/xero-api?sort=Newest) * [Submit requests for support](https://developer.xero.com/contact-xero-developer-platform-support/) using this SDK or Xero's developer platform and APIs to our API Support team. # How Can I Contribute? From b7602a8fb413ecfd718801a741f8282c66924d80 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 10:42:36 -0700 Subject: [PATCH 47/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dd806e27..ec609e43 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,7 +35,7 @@ We have an official [message board](https://community.xero.com/developer) where * [Xero FAQ](https://developer.xero.com/faq) * [Community, the official Xero message board](https://community.xero.com/developer) * [Stackoverflow - Xero related](https://stackoverflow.com/questions/tagged/xero-api?sort=Newest) -* [Submit requests for support](https://developer.xero.com/contact-xero-developer-platform-support/) using this SDK or Xero's developer platform and APIs to our API Support team. +* [Submit requests for support](https://developer.xero.com/contact-xero-developer-platform-support/) to our API Support team. # How Can I Contribute? @@ -77,16 +77,16 @@ We are using [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generat ### Submit a pull request -1. [Fork][fork] and clone the repository +1. Fork and clone the repository 1. Create a new branch: `git checkout -b my-branch-name` 1. Make your change, add tests if needed 1. Make sure the tests pass on your machine: `mvn test` -1. Push to your fork and [submit a pull request][pr] +1. Push to your fork and submit a pull request 1. Pat your self on the back and wait for your pull request to be reviewed and merged. Here are a few things you can do that will increase the likelihood of your pull request being accepted: -- Follow the [style guide][style-guide]. +- Follow the [style guide](#style-guide). - Write tests. - Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). From 62bab245fa32fbf8877c09140dfc160616de7ac9 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 10:50:50 -0700 Subject: [PATCH 48/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec609e43..c4661561 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,6 +17,7 @@ The following is a set of guidelines for contributing to Xero and its projects, [I don't want to read this whole thing, I just have a question!!!](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question) [How Can I Contribute?](#how-can-i-contribute) + * [What version of SDK are you using?](#what-version-of-the-sdk-are-you-using) * [Reporting Bugs](#reporting-bugs) * [Suggesting Enhancements](#suggesting-enhancements) * [Pull Requests](#pull-requests) @@ -41,6 +42,16 @@ We have an official [message board](https://community.xero.com/developer) where You can contribute by reporting bugs, suggesting enhancements, improving documentation i.e. [README](https://github.com/XeroAPI/Xero-Java/blob/oauth2/README.md) or submitting a pull request. + +## What version of the SDK are your using? + +As of Sept 2019, support for oAuth 2 will be generally available for developers. During this transition period from oAuth 1.0a to oAuth 2, we will be supporting two versions of the SDK. + +* 2.x supports oAuth 1.0a +* 3.x supports oAuth 2 + +Bugs and enhancements for version 3.x will be prioritized over 2.x. + ## Reporting Bugs Bugs are tracked as issues in this repository. From 47f4c09b6b8527e463ce6ffdea15161bc713a6fe Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 10:53:10 -0700 Subject: [PATCH 49/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c4661561..b635d3bc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,8 +47,9 @@ You can contribute by reporting bugs, suggesting enhancements, improving documen As of Sept 2019, support for oAuth 2 will be generally available for developers. During this transition period from oAuth 1.0a to oAuth 2, we will be supporting two versions of the SDK. -* 2.x supports oAuth 1.0a -* 3.x supports oAuth 2 + +* 2.x code resides in `master` and supports oAuth 1.0a +* 3.x code resides in the `oauth2` branch and supports oAuth 2 Bugs and enhancements for version 3.x will be prioritized over 2.x. @@ -63,6 +64,7 @@ Before opening a new issue: ### Write bug reports with detail, background, and sample code +- Which version of the SDK are you using? - A quick summary and/or background - Steps to reproduce - Be specific! From f0e278144c113ef966f351c96bb9f024ad77af54 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 10:53:54 -0700 Subject: [PATCH 50/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b635d3bc..93bc4d7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ We have an official [message board](https://community.xero.com/developer) where You can contribute by reporting bugs, suggesting enhancements, improving documentation i.e. [README](https://github.com/XeroAPI/Xero-Java/blob/oauth2/README.md) or submitting a pull request. -## What version of the SDK are your using? +## Which version of the SDK are your using? As of Sept 2019, support for oAuth 2 will be generally available for developers. During this transition period from oAuth 1.0a to oAuth 2, we will be supporting two versions of the SDK. From a2efc98203e3c8999c36c1f7f7a31afde4866b02 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 10:54:45 -0700 Subject: [PATCH 51/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 93bc4d7c..2e7e5a67 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ The following is a set of guidelines for contributing to Xero and its projects, [I don't want to read this whole thing, I just have a question!!!](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question) [How Can I Contribute?](#how-can-i-contribute) - * [What version of SDK are you using?](#what-version-of-the-sdk-are-you-using) + * [Which version of SDK are you using?](#which-version-of-the-sdk-are-you-using?) * [Reporting Bugs](#reporting-bugs) * [Suggesting Enhancements](#suggesting-enhancements) * [Pull Requests](#pull-requests) From a6eda6037ba4a4163954a0ebe321f0e8e0e3726e Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 10:55:22 -0700 Subject: [PATCH 52/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2e7e5a67..68e013c4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ We have an official [message board](https://community.xero.com/developer) where You can contribute by reporting bugs, suggesting enhancements, improving documentation i.e. [README](https://github.com/XeroAPI/Xero-Java/blob/oauth2/README.md) or submitting a pull request. -## Which version of the SDK are your using? +## Which version of the SDK are you using? As of Sept 2019, support for oAuth 2 will be generally available for developers. During this transition period from oAuth 1.0a to oAuth 2, we will be supporting two versions of the SDK. From 2b289ec4ed5c4acd6cb6c9a30803f7fcf450ce8d Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 10:56:32 -0700 Subject: [PATCH 53/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 68e013c4..2aeb9705 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ The following is a set of guidelines for contributing to Xero and its projects, [I don't want to read this whole thing, I just have a question!!!](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question) [How Can I Contribute?](#how-can-i-contribute) - * [Which version of SDK are you using?](#which-version-of-the-sdk-are-you-using?) + * [Which version of SDK are you using?](#Which-version-of-the-SDK-are-you-using?) * [Reporting Bugs](#reporting-bugs) * [Suggesting Enhancements](#suggesting-enhancements) * [Pull Requests](#pull-requests) From 2645aa4570c6b713f9524cbc5bb74f0a17b0be5c Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 10:57:25 -0700 Subject: [PATCH 54/76] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2aeb9705..272d2050 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ The following is a set of guidelines for contributing to Xero and its projects, [I don't want to read this whole thing, I just have a question!!!](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question) [How Can I Contribute?](#how-can-i-contribute) - * [Which version of SDK are you using?](#Which-version-of-the-SDK-are-you-using?) + * [Which version of SDK are you using?](#Which-version-of-the-SDK-are-you-using) * [Reporting Bugs](#reporting-bugs) * [Suggesting Enhancements](#suggesting-enhancements) * [Pull Requests](#pull-requests) From 5cc80516d8aa9b4c760785b24b264b66c94a3c21 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 20 Aug 2019 20:09:05 -0700 Subject: [PATCH 55/76] Update Type ENUM on Organisation model --- .../com/xero/models/accounting/Organisation.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/xero/models/accounting/Organisation.java b/src/main/java/com/xero/models/accounting/Organisation.java index 07c93238..3da80067 100644 --- a/src/main/java/com/xero/models/accounting/Organisation.java +++ b/src/main/java/com/xero/models/accounting/Organisation.java @@ -123,15 +123,21 @@ public enum OrganisationTypeEnum { CHARITY("CHARITY"), - CLUBSOCIETY("CLUBSOCIETY"), + CLUB_OR_SOCIETY("CLUB_OR_SOCIETY"), + + LOOK_THROUGH_COMPANY("LOOK_THROUGH_COMPANY"), + + NOT_FOR_PROFIT("NOT_FOR_PROFIT"), PARTNERSHIP("PARTNERSHIP"), - PRACTICE("PRACTICE"), + S_CORPORATION("S_CORPORATION"), - PERSON("PERSON"), + SELF_MANAGED_SUPERANNUATION_FUND("SELF_MANAGED_SUPERANNUATION_FUND"), - SOLETRADER("SOLETRADER"), + SOLE_TRADER("SOLE_TRADER"), + + SUPERANNUATION_FUND("SUPERANNUATION_FUND"), TRUST("TRUST"); From 72ec70a6bc1faf6e149f5b823916235cb5af2f3a Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Wed, 21 Aug 2019 07:59:04 -0700 Subject: [PATCH 56/76] Update Organisation.java --- .../com/xero/models/accounting/Organisation.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/xero/models/accounting/Organisation.java b/src/main/java/com/xero/models/accounting/Organisation.java index 3da80067..3eaf32e5 100644 --- a/src/main/java/com/xero/models/accounting/Organisation.java +++ b/src/main/java/com/xero/models/accounting/Organisation.java @@ -350,15 +350,21 @@ public enum OrganisationEntityTypeEnum { CHARITY("CHARITY"), - CLUBSOCIETY("CLUBSOCIETY"), + CLUB_OR_SOCIETY("CLUB_OR_SOCIETY"), + + LOOK_THROUGH_COMPANY("LOOK_THROUGH_COMPANY"), + + NOT_FOR_PROFIT("NOT_FOR_PROFIT"), PARTNERSHIP("PARTNERSHIP"), - PRACTICE("PRACTICE"), + S_CORPORATION("S_CORPORATION"), - PERSON("PERSON"), + SELF_MANAGED_SUPERANNUATION_FUND("SELF_MANAGED_SUPERANNUATION_FUND"), - SOLETRADER("SOLETRADER"), + SOLE_TRADER("SOLE_TRADER"), + + SUPERANNUATION_FUND("SUPERANNUATION_FUND"), TRUST("TRUST"); From 26b26deaa53bf02048d850763496e0b2e37298d6 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Thu, 22 Aug 2019 11:11:23 -0700 Subject: [PATCH 57/76] fix create currency requestBody change from array currencies to object currency --- .../java/com/xero/api/client/AccountingApi.java | 17 +++++++++-------- .../com/xero/example/AuthenticatedResource.java | 13 ++++--------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index c218385d..e933e574 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -17,6 +17,7 @@ import com.xero.models.accounting.Contacts; import com.xero.models.accounting.CreditNotes; import com.xero.models.accounting.Currencies; +import com.xero.models.accounting.Currency; import com.xero.models.accounting.Employees; import com.xero.models.accounting.Error; import com.xero.models.accounting.ExpenseClaims; @@ -1476,15 +1477,15 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String accessToken, /** *

200 - Unsupported - return response incorrect exception, API is not able to create new Currency * @param xeroTenantId Xero identifier for Tenant - * @param currencies The currencies parameter + * @param currency The currency parameter * @param accessToken Authorization token for user set in header of each request * @return Currencies * @throws IOException if an error occurs while attempting to invoke the API **/ - public Currencies createCurrency(String accessToken, String xeroTenantId, Currencies currencies) throws IOException { + public Currencies createCurrency(String accessToken, String xeroTenantId, Currency currency) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createCurrencyForHttpResponse(accessToken, xeroTenantId, currencies); + HttpResponse response = createCurrencyForHttpResponse(accessToken, xeroTenantId, currency); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1495,13 +1496,13 @@ public Currencies createCurrency(String accessToken, String xeroTenantId, Curre return null; } - public HttpResponse createCurrencyForHttpResponse(String accessToken, String xeroTenantId, Currencies currencies) throws IOException { + public HttpResponse createCurrencyForHttpResponse(String accessToken, String xeroTenantId, Currency currency) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCurrency"); - }// verify the required parameter 'currencies' is set - if (currencies == null) { - throw new IllegalArgumentException("Missing the required parameter 'currencies' when calling createCurrency"); + }// verify the required parameter 'currency' is set + if (currency == null) { + throw new IllegalArgumentException("Missing the required parameter 'currency' when calling createCurrency"); } if (accessToken == null) { throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createCurrency"); @@ -1520,7 +1521,7 @@ public HttpResponse createCurrencyForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(currencies); + content = apiClient.new JacksonJsonHttpContent(currency); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); diff --git a/src/main/java/com/xero/example/AuthenticatedResource.java b/src/main/java/com/xero/example/AuthenticatedResource.java index 14fd6df8..2f148213 100755 --- a/src/main/java/com/xero/example/AuthenticatedResource.java +++ b/src/main/java/com/xero/example/AuthenticatedResource.java @@ -1116,21 +1116,16 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } else if (object.equals("Currencies")) { /* CURRENCY */ - // JSON - incomplete try { // Get All Currencies currencies = accountingApi.getCurrencies(accessToken, xeroTenantId, where, order); messages.add("Get all Currencies - Total : " + currencies.getCurrencies().size()); // Create New - // Error: 400 - /* - * Currency curr = new Currency(); curr.setCode(CurrencyCode.SGD); Currencies - * currs = new Currencies(); currs.addCurrenciesItem(curr); Currencies - * newCurrency = accountingApi.createCurrency(currs); - * messages.add("New Currencies - Code : " + - * newCurrency.getCurrencies().get(0).getCode()); - */ + Currency curr = new Currency(); + curr.setCode(CurrencyCode.SGD); + curr.setDescription("Singapore Dollar"); + Currencies newCurrency = accountingApi.createCurrency(curr); } catch (XeroApiException xe) { this.addError(xe, messages); } catch (Exception e) { From 452bb6b95773df3f3191278fc995f98a409c9555 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Thu, 22 Aug 2019 13:55:26 -0700 Subject: [PATCH 58/76] fix new currency example --- pom.xml | 2 +- .../java/com/xero/example/AuthenticatedResource.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index eaf6c9eb..df6ee3b6 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.xeroapi xero-java jar - 3.0.0-beta-9 + 3.0.0-beta-10 Xero-Java SDK This is the official Java SDK for Xero API https://github.com/XeroAPI/Xero-Java diff --git a/src/main/java/com/xero/example/AuthenticatedResource.java b/src/main/java/com/xero/example/AuthenticatedResource.java index 2f148213..b75e7157 100755 --- a/src/main/java/com/xero/example/AuthenticatedResource.java +++ b/src/main/java/com/xero/example/AuthenticatedResource.java @@ -682,7 +682,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) BankTransaction bt = new BankTransaction(); bt.setBankAccount(bankAcct); bt.setContact(useContact); - bt.setLineitems(lineItems); + bt.setLineItems(lineItems); bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.SPEND); BankTransactions bts = new BankTransactions(); bts.addBankTransactionsItem(bt); @@ -1125,7 +1125,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) Currency curr = new Currency(); curr.setCode(CurrencyCode.SGD); curr.setDescription("Singapore Dollar"); - Currencies newCurrency = accountingApi.createCurrency(curr); + Currencies newCurrency = accountingApi.createCurrency(accessToken, xeroTenantId, curr); } catch (XeroApiException xe) { this.addError(xe, messages); } catch (Exception e) { @@ -1206,7 +1206,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) li.setLineAmount(40.00); li.setTaxType("NONE"); - receipt.addLineitemsItem(li); + receipt.addLineItemsItem(li); receipt.setUser(user); receipt.lineAmountTypes(LineAmountTypes.NOTAX); receipt.contact(useContact); @@ -1759,7 +1759,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) BankTransaction bt = new BankTransaction(); bt.setBankAccount(bankAccount); bt.setContact(useContact); - bt.setLineitems(lineItems); + bt.setLineItems(lineItems); bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_OVERPAYMENT); BankTransactions bts = new BankTransactions(); bts.addBankTransactionsItem(bt); @@ -1935,7 +1935,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) BankTransaction bt = new BankTransaction(); bt.setBankAccount(bankAccount); bt.setContact(useContact); - bt.setLineitems(lineItems); + bt.setLineItems(lineItems); bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_PREPAYMENT); BankTransactions bts = new BankTransactions(); bts.addBankTransactionsItem(bt); @@ -2111,7 +2111,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) li.setLineAmount(40.00); li.setTaxType("NONE"); - receipt.addLineitemsItem(li); + receipt.addLineItemsItem(li); receipt.setUser(useUser); receipt.lineAmountTypes(LineAmountTypes.NOTAX); receipt.contact(useContact); From 6e3580319efcbdee0ee2bc18896a1001cbefa7d1 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Fri, 6 Sep 2019 13:25:14 -0700 Subject: [PATCH 59/76] Update for GA release Removed example app (now in separate repo) Added create methods where singular/plural appropriate - createBankTransaction (requestBody: BankTransactions) - createBankTransactions (requestBody: BankTransaction) - createContact (requestBody: Contact) - createContacts (requestBody: Contacts) - createCreditNote (requestBody: CreditNote) - createCreditNotes (requestBody: CreditNotes) - createEmployee (requestBody: Employee) - createEmployees (requestBody: Employees) - createInvoice (requestBody: Invoice) - createInvoices (requestBody: Invoices) - createItem (requestBody: Item) - createItems (requestBody: Items) - createPurchaseOrder (requestBody: PurchaseOrder) - createPurchaseOrders (requestBody: PurchaseOrders) Change filters for GET INVOICE from String to List so Array of IDs, Numbers, Statuses can be passed. Added new CISDeduction number to Invoces Adding new "Types" to - Invoices - Overpayment - Prepayment - Receipt - User Fixed UUID on Reports --- README.md | 9 +- example/README.md | 1194 -------- .../java/example-spring/SpringConfig.java | 155 - .../resources/certs/public_privatekey.txt | 12 - .../src/main/resources/config-partner.json | 16 - .../src/main/resources/config-private.json | 11 - example/src/main/resources/config-public.json | 14 - example/src/main/resources/config.json | 7 - example/src/main/resources/helo-heros.jpg | Bin 40053 -> 0 bytes example/src/main/resources/log4j.properties | 16 - example/src/main/webapp/WEB-INF/web.xml | 42 - example/src/main/webapp/callback.jsp | 19 - .../images/connect_xero_button_blue1.png | Bin 21007 -> 0 bytes example/src/main/webapp/index.jsp | 13 - images/sdk-configuration.png | Bin 47343 -> 0 bytes pom.xml | 2 +- .../com/xero/api/client/AccountingApi.java | 648 ++++- .../xero/example/AuthenticatedResource.java | 2537 ----------------- .../java/com/xero/example/Authorization.java | 73 - src/main/java/com/xero/example/Callback.java | 107 - .../java/com/xero/example/TokenRefresh.java | 102 - .../java/com/xero/example/TokenStorage.java | 60 - .../com/xero/models/accounting/Invoice.java | 23 +- .../xero/models/accounting/Overpayment.java | 4 +- .../xero/models/accounting/Prepayment.java | 6 +- .../com/xero/models/accounting/Receipt.java | 2 +- .../com/xero/models/accounting/Report.java | 9 +- .../xero/models/accounting/ReportFields.java | 9 +- .../xero/models/accounting/ReportWithRow.java | 9 +- .../java/com/xero/models/accounting/User.java | 4 +- 30 files changed, 587 insertions(+), 4516 deletions(-) delete mode 100644 example/README.md delete mode 100644 example/src/main/java/example-spring/SpringConfig.java delete mode 100644 example/src/main/resources/certs/public_privatekey.txt delete mode 100644 example/src/main/resources/config-partner.json delete mode 100644 example/src/main/resources/config-private.json delete mode 100644 example/src/main/resources/config-public.json delete mode 100644 example/src/main/resources/config.json delete mode 100644 example/src/main/resources/helo-heros.jpg delete mode 100644 example/src/main/resources/log4j.properties delete mode 100644 example/src/main/webapp/WEB-INF/web.xml delete mode 100644 example/src/main/webapp/callback.jsp delete mode 100644 example/src/main/webapp/images/connect_xero_button_blue1.png delete mode 100644 example/src/main/webapp/index.jsp delete mode 100644 images/sdk-configuration.png delete mode 100755 src/main/java/com/xero/example/AuthenticatedResource.java delete mode 100644 src/main/java/com/xero/example/Authorization.java delete mode 100644 src/main/java/com/xero/example/Callback.java delete mode 100644 src/main/java/com/xero/example/TokenRefresh.java delete mode 100644 src/main/java/com/xero/example/TokenStorage.java diff --git a/README.md b/README.md index 09be2f94..209cf480 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,11 @@ Codebase, samples and setup instructions located in [oauth1 branch](https://gith ### Create a Xero App Follow these steps to create your Xero app -* Create a free Xero user account (if you don't have one) -* Use this URL for beta access to oAuth2 [https://developer.xero.com/myapps?code=oauth2create](https://developer.xero.com/myapps?code=oauth2create) -* Click "or Try oAuth2" link -* Enter your App name, company url, privacy policy url, and redirect URI (this is your callback url - localhost, etc) +* Create a [free Xero user account](https://www.xero.com/us/signup/api/) (if you don't have one) +* Login to [Xero developer center](https://developer.xero.com/myapps) +* Click "Try oAuth2" link +* Enter your App name, company url, privacy policy url. +* Enter the redirect URI (this is your callback url - localhost, etc) * Agree to terms and condition and click "Create App". * Click "Generate a secret" button. * Copy your client id and client secret and save for use later. diff --git a/example/README.md b/example/README.md deleted file mode 100644 index a02df63d..00000000 --- a/example/README.md +++ /dev/null @@ -1,1194 +0,0 @@ -# Deprecated Sample Code for XML request/response - - -## HELLO ORGANISATION EXAMPLE -This is the code we used in our video walking through how to create a new Eclipse project, add your dependencies and make your first API call. -[Watch this video](https://youtu.be/V9SJ8zK0x6I). - -For Public & Partner Apps, you'll implement 3 legged oAuth - Private Apps can skip down to the Data Endpoints (your Consumer Key is your long lived Access Token) - -*RequestTokenServlet.java* -```java -package com.xero.example; - -import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.xero.api.Config; -import com.xero.api.JsonConfig; -import com.xero.api.OAuthAuthorizeToken; -import com.xero.api.OAuthRequestToken; - -@WebServlet("/RequestTokenServlet") -public class RequestTokenServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - public RequestTokenServlet() { - super(); - } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - try { - Config config = JsonConfig.getInstance(); - - OAuthRequestToken requestToken = new OAuthRequestToken(config); - requestToken.execute(); - - TokenStorage storage = new TokenStorage(); - storage.save(response,requestToken.getAll()); - - OAuthAuthorizeToken authToken = new OAuthAuthorizeToken(config, requestToken.getTempToken()); - response.sendRedirect(authToken.getAuthUrl()); - } catch(Exception e) { - System.out.println(e.getMessage()); - } - - } -} -``` - -In your callback Servlet you'll read the query params and swap your temporary for your 30 min access token. - -*CallbackServlet.java* -```java -package com.xero.example; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.xero.api.OAuthAccessToken; -import com.xero.api.XeroClient; -import com.xero.model.Organisation; -import com.xero.api.Config; -import com.xero.api.JsonConfig; - -@WebServlet("/CallbackServlet") -public class CallbackServlet extends HttpServlet -{ - private static final long serialVersionUID = 1L; - - public CallbackServlet() - { - super(); - } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - TokenStorage storage = new TokenStorage(); - String verifier = request.getParameter("oauth_verifier"); - - try { - Config config = JsonConfig.getInstance(); - - OAuthAccessToken accessToken = new OAuthAccessToken(config); - - accessToken.build(verifier,storage.get(request,"tempToken"),storage.get(request,"tempTokenSecret")).execute(); - - if(!accessToken.isSuccess()) { - storage.clear(response); - request.getRequestDispatcher("index.jsp").forward(request, response); - } else { - storage.save(response,accessToken.getAll()); - - XeroClient client = new XeroClient(); - client.setOAuthToken(accessToken.getToken(), accessToken.getTokenSecret()); - - List newOrganisation = client.getOrganisations(); - System.out.println("Get a Organisation - Name : " + newOrganisation.get(0).getName()); - } - } catch(Exception e) { - System.out.println(e.getMessage()); - } - } -} -``` - -The TokenStorage class uses cookies to store your temporary token & secret so they can be swapped for 30 min access token & secret. Of course, you'd want to create your own implementation to store this user information in a database. This class is merely for demo purposes so you can trying out the SDK. - -*TokenStorage.java* -```java -package com.xero.example; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class TokenStorage -{ - - public TokenStorage() - { - super(); - } - - public String get(HttpServletRequest request,String key) - { - String item = null; - Cookie[] cookies = request.getCookies(); - if (cookies != null) { - for (int i = 0; i < cookies.length; i++) - { - if (cookies[i].getName().equals(key)) - { - item = cookies[i].getValue(); - } - } - } - return item; - } - - public boolean tokenIsNull(String token) { - if (token != null && !token.isEmpty()) { - return false; - } else { - return true; - } - } - - public void clear(HttpServletResponse response) - { - HashMap map = new HashMap(); - map.put("tempToken",""); - map.put("tempTokenSecret",""); - map.put("sessionHandle",""); - map.put("tokenTimestamp",""); - - save(response,map); - } - - public void save(HttpServletResponse response,HashMap map) - { - Set> set = map.entrySet(); - Iterator> iterator = set.iterator(); - - while(iterator.hasNext()) { - Map.Entry mentry = iterator.next(); - String key = (String)mentry.getKey(); - String value = (String)mentry.getValue(); - - Cookie t = new Cookie(key,value); - response.addCookie(t); - } - } -} -``` - - -## INIT XEROCLIENT -```java - XeroClient client = new XeroClient(); - client.setOAuthToken(accessToken.getToken(), accessToken.getTokenSecret()); -``` - -## ACCOUNTS -```java -try { - List newAccount = client.createAccounts(SampleData.loadAccount().getAccount()); - messages.add("Create a new Account - Name : " + newAccount.get(0).getName() - + " Description : " + newAccount.get(0).getDescription() + ""); - - List accountWhere = client.getAccounts(null,"Type==\"BANK\"",null); - if(accountWhere.size() > 0) { - - messages.add("Get a Account with WHERE clause - Name : " + accountWhere.get(0).getName() + ""); - } else { - messages.add("Get a Account with WHERE clause - No Acccounts of Type BANK found"); - } - - List accountList = client.getAccounts(); - int num = SampleData.findRandomNum(accountList.size()); - messages.add("Get a random Account - Name : " + accountList.get(num).getName() + ""); - - Account accountOne = client.getAccount(accountList.get(num).getAccountID()); - messages.add("Get a single Account - Name : " + accountOne.getName() + ""); - - newAccount.get(0).setDescription("Monsters Inc."); - newAccount.get(0).setStatus(null); - List updateAccount = client.updateAccount(newAccount); - messages.add("Update Account - Name : " + updateAccount.get(0).getName() - + " Description : " + updateAccount.get(0).getDescription() + ""); - - String status = client.deleteAccount(newAccount.get(0).getAccountID()); - messages.add("Delete Account - Name : " + newAccount.get(0).getName() - + " result : " + status + ""); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - - -## ATTACHMENTS -```java -try { - - List newInvoice = client.createInvoices(SampleData.loadInvoice().getInvoice()); - messages.add("Create a new Invoice ID : " + newInvoice.get(0).getInvoiceID()); - - InputStream inputStream = JsonConfig.class.getResourceAsStream("/helo-heros.jpg"); - byte[] bytes = IOUtils.toByteArray(inputStream); - - String fileName = "sample.jpg"; - Attachment invoiceAttachment = client.createAttachment("Invoices",newInvoice.get(0).getInvoiceID(), fileName, "application/jpeg", bytes,true); - messages.add("Attachment to Invoice complete - ID: " + invoiceAttachment.getAttachmentID()); - - List getInvoiceAttachment = client.getAttachments("Invoices", newInvoice.get(0).getInvoiceID()); - messages.add("Get Attachment for Invoice - complete -attachment ID: " + getInvoiceAttachment.get(0).getAttachmentID()); - - System.out.println(getInvoiceAttachment.get(0).getFileName() + " --- " +getInvoiceAttachment.get(0).getMimeType()); - - File f = new File("./"); - String fileName1 = getInvoiceAttachment.get(0).getFileName(); - String dirPath = f.getCanonicalPath(); - String saveFilePath = dirPath + File.separator + fileName1; - - InputStream in = client.getAttachmentContentById("Invoices",newInvoice.get(0).getInvoiceID(),getInvoiceAttachment.get(0).getAttachmentID(),getInvoiceAttachment.get(0).getMimeType()); - - OutputStream out = new FileOutputStream(saveFilePath); - - // Transfer bytes from in to out - byte[] buf = new byte[1024]; - int len; - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - in.close(); - out.close(); - messages.add("Get Attachment content - save to server - location: " + saveFilePath ); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - - -## BANK TRANSACTIONS -```java -try { - List accountWhere = client.getAccounts(null,"Type==\"BANK\"",null); - if(accountWhere.size() > 0) { - - List newBankTransaction = client.createBankTransactions(SampleData.loadBankTransaction().getBankTransaction()); - messages.add("Create a new Bank Transaction - ID : " +newBankTransaction.get(0).getBankTransactionID() + ""); - - List BankTransactionWhere = client.getBankTransactions(null,"Status==\"AUTHORISED\"",null,null); - messages.add("Get a BankTransaction with WHERE clause - ID : " + BankTransactionWhere.get(0).getBankTransactionID() + ""); - - List BankTransactionList = client.getBankTransactions(); - int num = SampleData.findRandomNum(BankTransactionList.size()); - messages.add("Get a random BankTransaction - ID : " + BankTransactionList.get(num).getBankTransactionID() + ""); - - BankTransaction BankTransactionOne = client.getBankTransaction(BankTransactionList.get(num).getBankTransactionID()); - messages.add("Get a single BankTransaction - ID : " + BankTransactionOne.getBankTransactionID()); - - newBankTransaction.get(0).setReference("My Updated Reference"); - List updatedBankTransaction = client.updateBankTransactions(newBankTransaction); - messages.add("Updated a new Bank Transaction - ID : " +updatedBankTransaction.get(0).getBankTransactionID() + ""); - - } else { - messages.add("Please create a Bank Acccount before using the BankTransaction Endpoint"); - } - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## BANK TRANSFERS -```java -try { - List accountWhere = client.getAccounts(null,"Type==\"BANK\"",null); - if(accountWhere.size() > 0) { - - List bts = SampleData.loadBankTransfer().getBankTransfer(); - if (bts.size() > 0) { - List newBankTransfer = client.createBankTransfers(SampleData.loadBankTransfer().getBankTransfer()); - messages.add("Create a new Bank Transfer - ID : " +newBankTransfer.get(0).getBankTransferID()); - } else { - messages.add("Can not create a new Bank Transfer without 2 Bank Accounts"); - } - - List BankTransferWhere = client.getBankTransfers(null,"Amount>Decimal(1.00)",null); - if(BankTransferWhere.size() > 0) { - messages.add("Get a BankTransfer with WHERE clause - ID : " + BankTransferWhere.get(0).getBankTransferID()); - } - - List BankTransferList = client.getBankTransfers(); - if(BankTransferList.size() > 0) { - int num3 = SampleData.findRandomNum(BankTransferList.size()); - messages.add("Get a random BankTransfer - ID : " + BankTransferList.get(num3).getBankTransferID()); - - BankTransfer BankTransferOne = client.getBankTransfer(BankTransferList.get(num3).getBankTransferID()); - messages.add("Get a single BankTransfer - ID : " + BankTransferOne.getBankTransferID()); - } else { - messages.add("No Bank Transfers Found "); - } - } else { - messages.add("Please create a Bank Acccount before using the BankTransfer Endpoint"); - } -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## BRANDING THEMES -```java -try { - List newBrandingTheme = client.getBrandingThemes(); - messages.add("Get a Branding Theme - Name : " + newBrandingTheme.get(0).getName()); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## CONTACTS -```java -try { - List newContact = client.createContact(SampleData.loadContact().getContact()); - messages.add("Create a new Contact - Name : " + newContact.get(0).getName() + " Email : " + newContact.get(0).getEmailAddress()); - - List ContactWhere = client.getContacts(null,"ContactStatus==\"ACTIVE\"",null,null); - messages.add("Get a Contact with WHERE clause - ID : " + ContactWhere.get(0).getContactID()); - - List ContactList = client.getContacts(); - int num4 = SampleData.findRandomNum(ContactList.size()); - messages.add("Get a random Contact - ID : " + ContactList.get(num4).getContactID()); - - Contact ContactOne = client.getContact(ContactList.get(num4).getContactID()); - messages.add("Get a single Contact - ID : " + ContactOne.getContactID()); - - newContact.get(0).setEmailAddress("sid.maestre+barney@xero.com"); - List updateContact = client.updateContact(newContact); - messages.add("Update Contact - Name : " + updateContact.get(0).getName() + " email : " + updateContact.get(0).getEmailAddress()); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## CONTACT GROUP -```java -try { - List newContactGroup = client.createContactGroups(SampleData.loadContactGroup().getContactGroup()); - messages.add("Create a new Contact Group - ID : " + newContactGroup.get(0).getContactGroupID()); - - List newContactGroup2 = client.createContactGroups(SampleData.loadContactGroup().getContactGroup()); - messages.add("Create a new Contact Group 2 - ID : " + newContactGroup2.get(0).getContactGroupID()); - - List ContactGroupWhere = client.getContactGroups(null,"Status==\"ACTIVE\"",null); - messages.add("Get a ContactGroup with WHERE clause - ID : " + ContactGroupWhere.get(0).getContactGroupID()); - - List ContactGroupList = client.getContactGroups(); - int num = SampleData.findRandomNum(ContactGroupList.size()); - messages.add("Get a random ContactGroup - ID : " + ContactGroupList.get(num).getContactGroupID()); - - ContactGroup ContactGroupOne = client.getContactGroup(ContactGroupList.get(num).getContactGroupID()); - messages.add("Get a single ContactGroup - ID : " + ContactGroupOne.getContactGroupID()); - - newContactGroup.get(0).setName("My Updated Group-" + SampleData.loadRandomNum()); - List updateContactGroup = client.updateContactGroup(newContactGroup); - messages.add("Update Contact Group - ID : " + updateContactGroup.get(0).getContactGroupID() + " - Name: " + updateContactGroup.get(0).getName()); - - List deleteContactGroup = client.deleteContactGroup(ContactGroupList.get(num)); - messages.add("Delete Contact Group - Deleted : " + deleteContactGroup.get(0).getContactGroupID()); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## CONTACT GROUP CONTACTS -```java -try { - List newContactGroup = client.createContactGroups(SampleData.loadContactGroup().getContactGroup()); - messages.add("Create a new Contact Group - ID : " + newContactGroup.get(0).getContactGroupID()); - - ArrayOfContact arrayContact = new ArrayOfContact(); - arrayContact.getContact().add(SampleData.loadSingleContact()); - List newContactGroupContacts = client.createContactGroupContacts(arrayContact.getContact(),newContactGroup.get(0).getContactGroupID()); - messages.add("Add Contacts to Contact Group = ContactId : " + newContactGroupContacts.get(0).getContactID()); - - String deleteSingleContactStatus = client.deleteSingleContactFromContactGroup(newContactGroup.get(0).getContactGroupID(),arrayContact.getContact().get(0).getContactID()); - messages.add("Delete Single Contact from Group - Deleted Status: " + deleteSingleContactStatus); - -} catch (XeroApiException e) { - System.out.println("ERROR"); - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## CREDIT NOTES -```java -try { - List newCreditNote = client.createCreditNotes(SampleData.loadCreditNote().getCreditNote()); - messages.add("Create a new CreditNote ID : " + newCreditNote.get(0).getCreditNoteID() ); - - List newAllocation = client.createCreditNoteAllocations(SampleData.loadCreditNoteAllocation().getAllocation(),newCreditNote.get(0).getCreditNoteID()); - messages.add("Create a new Overpayment and Allocate - Applied Amount : " + newAllocation.get(0).getAppliedAmount()); - - List newCreditNote4dp = client.createCreditNotes(SampleData.loadCreditNote4dp().getCreditNote(),"4"); - messages.add("Create a new CreditNote ID 4dp: " + newCreditNote4dp.get(0).getCreditNoteID() ); - - List CreditNoteWhere = client.getCreditNotes(null,"Status==\"DRAFT\"",null); - if(CreditNoteWhere.size() > 0) { - messages.add("Get a CreditNote with WHERE clause - ID: " + CreditNoteWhere.get(0).getCreditNoteID()); - } - - List CreditNotePage = client.getCreditNotes(null,"Status==\"DRAFT\"",null,"1"); - if(CreditNotePage.size() > 0) { - messages.add("Get a CreditNote with PAGE=1 clause - ID: " + CreditNoteWhere.get(0).getCreditNoteID()); - } - - List CreditNoteList = client.getCreditNotes(); - int num = SampleData.findRandomNum(CreditNoteList.size()); - messages.add("Get a random CreditNote - ID : " + CreditNoteList.get(num).getCreditNoteID()); - - CreditNote CreditNoteOne = client.getCreditNote(CreditNoteList.get(num).getCreditNoteID()); - messages.add("Get a single CreditNote - ID : " + CreditNoteOne.getCreditNoteID()); - - newCreditNote.get(0).setReference("My updated Credit Note"); - List updateCreditNote = client.updateCreditNote(newCreditNote); - messages.add("Update CreditNote - ID: " + updateCreditNote.get(0).getCreditNoteID() + " - Reference: " + updateCreditNote.get(0).getReference()); - - List CreditNoteListForPdf = client.getCreditNotes(); - - // GET PDF of CREDIT NOTE - File f = new File("./"); - String dirPath = f.getCanonicalPath(); - ByteArrayInputStream input = client.getCreditNotePdfContent(CreditNoteListForPdf.get(0).getCreditNoteID()); - - String fileName = "creditnote.pdf"; - - FileOutputStream output = new FileOutputStream(fileName); - - int DEFAULT_BUFFER_SIZE = 1024; - byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; - int n = 0; - - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - - while (n >= 0) { - output.write(buffer, 0, n); - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - } - - input.close(); - output.close(); - - String saveFilePath = dirPath + File.separator + fileName; - messages.add("Get a PDF copy of CreditNote - save it here: " + saveFilePath); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## CURRENCIES -```java -try { - List newCurrency = client.getCurrencies(); - messages.add("GET a Currency - Description: " + newCurrency.get(0).getDescription()); - - List currency = client.createCurrencies(SampleData.loadCurrency().getCurrency()); - messages.add("Create a new Currency : " + currency.get(0).getDescription()); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - - -## EMPLOYEES -```java -try { - List newEmployee = client.createEmployees(SampleData.loadEmployee().getEmployee()); - messages.add("Create a new Employee - ID: " + newEmployee.get(0).getEmployeeID()); - - List EmployeeWhere = client.getEmployees(null,"Status==\"ACTIVE\"",null); - messages.add("Get a Employee with WHERE clause - FirstName : " + EmployeeWhere.get(0).getFirstName()); - - List EmployeeList = client.getEmployees(); - int num6 = SampleData.findRandomNum(EmployeeList.size()); - messages.add("Get a random Employee - FirstName : " + EmployeeList.get(num6).getFirstName()); - - Employee EmployeeOne = client.getEmployee(EmployeeList.get(num6).getEmployeeID()); - messages.add("Get a single Employee - FirstName : " + EmployeeOne.getFirstName()); - - newEmployee.get(0).setFirstName("David"); - newEmployee.get(0).setStatus(null); - List updateEmployee = client.updateEmployee(newEmployee); - messages.add("Update the Employee - FirstName : " + updateEmployee.get(0).getFirstName() + " - LastName : " + updateEmployee.get(0).getLastName()); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## EXPENSE CLAIMS -```java -try { - - List newExpenseClaim = client.createExpenseClaims(SampleData.loadExpenseClaim().getExpenseClaim()); - messages.add("Create a new Expense Claim - ID : " + newExpenseClaim.get(0).getExpenseClaimID() + " Status : " + newExpenseClaim.get(0).getStatus()); - - List ExpenseClaimWhere = client.getExpenseClaims(null,"AmountDue>Decimal(1.00)",null); - messages.add("Get a ExpenseClaim with WHERE clause - ID" + ExpenseClaimWhere.get(0).getExpenseClaimID()); - - List ExpenseClaimList = client.getExpenseClaims(); - int num = SampleData.findRandomNum(ExpenseClaimList.size()); - messages.add("Get a random ExpenseClaim - ID : " + ExpenseClaimList.get(num).getExpenseClaimID()); - - ExpenseClaim ExpenseClaimOne = client.getExpenseClaim(ExpenseClaimList.get(num).getExpenseClaimID()); - messages.add("Get a single ExpenseClaim - ID : " + ExpenseClaimOne.getExpenseClaimID()); - - newExpenseClaim.get(0).setStatus(ExpenseClaimStatus.AUTHORISED);; - List updateExpenseClaim = client.updateExpenseClaim(newExpenseClaim); - messages.add("Update the ExpenseClaim - ID : " + updateExpenseClaim.get(0).getExpenseClaimID() + " Status : " + updateExpenseClaim.get(0).getStatus()); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## INVOICES -```java -try { - - List newInvoice = client.createInvoices(SampleData.loadInvoice().getInvoice()); - newInvoice.get(0).setReference("Just Created my Ref."); - messages.add("Create a new Invoice ID : " + newInvoice.get(0).getInvoiceID()); - - List InvoiceWhere = client.getInvoices(null,"Status==\"DRAFT\"",null,null,null); - messages.add("Get a Invoice with WHERE clause - InvNum : " + InvoiceWhere.get(0).getInvoiceID()); - - // Set If Modified Since in last 24 hours - Date date = new Date(); - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.add(Calendar.DAY_OF_MONTH, -1); - - List InvoiceList24hour = client.getInvoices(cal.getTime(),null,null,null,null); - messages.add("How many invoices modified in last 24 hours?: " + InvoiceList24hour.size()); - - List InvoiceList = client.getInvoices(); - int num7 = SampleData.findRandomNum(InvoiceList.size()); - messages.add("Get a random Invoice - InvNum : " + InvoiceList.get(num7).getInvoiceID()); - - Invoice InvoiceOne = client.getInvoice(InvoiceList.get(num7).getInvoiceID()); - messages.add("Get a single Invoice - InvNum : " + InvoiceOne.getInvoiceID()); - - String ids = InvoiceList.get(0).getInvoiceID() + "," + InvoiceList.get(1).getInvoiceID(); - - List InvoiceMultiple = client.getInvoices(null,null,null,null,ids); - messages.add("Get a Muliple Invoices by ID filter : " + InvoiceMultiple.size()); - - String invNum ="%SIDNEY"; - Map filter = new HashMap<>(); - addToMapIfNotNull(filter, "invoicenumbers", invNum); - List InvoiceMultiple2 = client.getInvoices(null,"Type==\"ACCREC\"",null,null,"4",filter); - messages.add("Get a Muliple Invoices by ID filter : " + InvoiceMultiple2.size()); - - newInvoice.get(0).setReference("Just Updated APRIL my Ref."); - newInvoice.get(0).setStatus(null); - List updateInvoice = client.updateInvoice(newInvoice); - messages.add("Update the Invoice - InvNum : " + updateInvoice.get(0).getInvoiceID() + " - Reference : " + updateInvoice.get(0).getReference()); - - // GET PDF of Invoice - File f = new File("./"); - String dirPath = f.getCanonicalPath(); - ByteArrayInputStream input = client.getInvoicePdfContent(InvoiceList.get(0).getInvoiceID()); - - String fileName = "invoice.pdf"; - - FileOutputStream output = new FileOutputStream(fileName); - - int DEFAULT_BUFFER_SIZE = 1024; - byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; - int n = 0; - - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - - while (n >= 0) { - output.write(buffer, 0, n); - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - } - - input.close(); - output.close(); - - String saveFilePath = dirPath + File.separator + fileName; - messages.add("Get a PDF copy of Invoice - save it here: " + saveFilePath); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} - -try { - List InvoiceList = client.getInvoices(); - int num33 = SampleData.findRandomNum(InvoiceList.size()); - OnlineInvoice OnlineInvoice = client.getOnlineInvoice(InvoiceList.get(num33).getInvoiceID()); - messages.add("Get a Online Invoice - : " + OnlineInvoice.getOnlineInvoiceUrl()); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); - messages.add("Error - online invoice: " + e.getMessage()); -} -``` - -## INVOICE REMINDERS -```java -try { - List newInvoiceReminder = client.getInvoiceReminders(); - messages.add("Get a Invoice Reminder - Is Enabled: " + newInvoiceReminder.get(0).isEnabled() ); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## ITEMS -```java -try { - List newItem = client.createItems(SampleData.loadItem().getItem()); - messages.add("Create a new Item - ID : " + newItem.get(0).getItemID()); - - List ItemWhere = client.getItems(null,"IsSold==true",null); - messages.add("Get a Item with WHERE clause - Name : " + ItemWhere.get(0).getName()); - - List ItemList = client.getItems(); - int num = SampleData.findRandomNum(ItemList.size()); - messages.add("Get a random Item - Name : " + ItemList.get(num).getName()); - - Item ItemOne = client.getItem(ItemList.get(num).getItemID()); - messages.add("Get a single Item - Name : " + ItemOne.getName()); - - newItem.get(0).setDescription("My Updated Description"); - newItem.get(0).setStatus(null); - List updateItem = client.updateItem(newItem); - messages.add("Update the Item - Name : " + updateItem.get(0).getName() + " - Description : " + updateItem.get(0).getDescription()); - - String status = client.deleteItem(newItem.get(0).getItemID()); - messages.add("Delete a new Item - Delete result: " + status); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} - -``` - -## JOURNALS -```java -try { - List newJournal = client.getJournals(); - messages.add("Get a Journal - Number : " + newJournal.get(0).getJournalNumber() + " - ID: " + newJournal.get(0).getJournalID()); - - List newJournalOffset = client.getJournals(null,"10",true); - messages.add("Get a Journal - Number : " + newJournalOffset.get(0).getJournalNumber() + " - ID: " + newJournalOffset.get(0).getJournalID()); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} - -``` - -## LINKED TRANSACTIONS -```java -try { - List newLinkedTransaction = client.createLinkedTransactions(SampleData.loadLinkedTransaction().getLinkedTransaction()); - System.out.println(newLinkedTransaction.get(0).getLinkedTransactionID()); - messages.add("Create a new LinkedTransaction - Id:" + newLinkedTransaction.get(0).getContactID()); - - List LinkedTransactionWhere = client.getLinkedTransactions(null,"Status==\"BANK\"",null,null); - messages.add("Get a LinkedTransaction with WHERE clause - ID : " + LinkedTransactionWhere.get(0).getLinkedTransactionID()); - - List LinkedTransactionList = client.getLinkedTransactions(); - int num = SampleData.findRandomNum(LinkedTransactionList.size()); - messages.add("Get a random LinkedTransaction - ID : " + LinkedTransactionList.get(num).getLinkedTransactionID()); - - LinkedTransaction LinkedTransactionOne = client.getLinkedTransaction(LinkedTransactionList.get(num).getLinkedTransactionID()); - messages.add("Get a single LinkedTransaction - ID : " + LinkedTransactionOne.getLinkedTransactionID()); - - List ContactList2 = client.getContacts(); - int num2 = SampleData.findRandomNum(ContactList2.size()); - newLinkedTransaction.get(0).setContactID(ContactList2.get(num2).getContactID()); - List updateLinkedTransaction = client.updateLinkedTransaction(newLinkedTransaction); - messages.add("Update the LinkedTransaction - ID : " + updateLinkedTransaction.get(0).getLinkedTransactionID() + " - Status : " + updateLinkedTransaction.get(0).getStatus()); - - String status = client.deleteLinkedTransaction(newLinkedTransaction.get(0).getLinkedTransactionID()); - messages.add("Delete a new LinkedTransaction - Delete result: " + status); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## MANUAL JOURNALS -```java -try { - List newManualJournal = client.createManualJournals(SampleData.loadManualJournal().getManualJournal()); - messages.add("Create a new Manual Journal - ID : " + newManualJournal.get(0).getManualJournalID() + " - Narration : " + newManualJournal.get(0).getNarration()); - - List ManualJournalWhere = client.getManualJournals(null,"Status==\"DRAFT\"",null,null); - if (ManualJournalWhere.size() > 0) { - messages.add("Get a ManualJournal with WHERE clause - Narration : " + ManualJournalWhere.get(0).getNarration()); - } else { - messages.add("Get a ManualJournal with WHERE clause - No Manual Journal DRAFT found"); - } - - List ManualJournalList = client.getManualJournals(); - int num8 = SampleData.findRandomNum(ManualJournalList.size()); - messages.add("Get a random ManualJournal - Narration : " + ManualJournalList.get(num8).getNarration()); - - ManualJournal ManualJournalOne = client.getManualJournal(ManualJournalList.get(num8).getManualJournalID()); - messages.add("Get a single ManualJournal - Narration : " + ManualJournalOne.getNarration()); - - newManualJournal.get(0).setNarration("My Updated Narration"); - newManualJournal.get(0).setStatus(null); - List updateManualJournal = client.updateManualJournal(newManualJournal); - messages.add("Update the ManualJournal - ID : " + updateManualJournal.get(0).getManualJournalID() + " - Narration : " + updateManualJournal.get(0).getNarration()); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} - -``` - -## ORGANISATION -```java -try { - List newOrganisation = client.getOrganisations(); - messages.add("Get a Organisation - Name : " + newOrganisation.get(0).getName()); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## OVERPAYMENT -```java -try { - List accountWhere = client.getAccounts(null,"Type==\"BANK\"",null); - if(accountWhere.size() > 0) { - BankTransaction bt = SampleData.loadNewlyCreatedOverpayment(); - List newOverpayment = client.getOverpayments(); - if (newOverpayment.size() > 0) { - messages.add("Get a Overpayment - ID" + newOverpayment.get(0).getOverpaymentID()); - } - - List newAllocation = client.createOverpaymentAllocations(SampleData.loadAllocation().getAllocation(),bt.getOverpaymentID()); - messages.add("Create a new Overpayment and Allocate - Applied Amount : " + newAllocation.get(0).getAppliedAmount()); - } else { - messages.add("Please create a Bank Acccount before using the Overpayment Endpoint"); - } - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## PAYMENT -```java -try { - List accountWhere = client.getAccounts(null,"Type==\"BANK\"",null); - if(accountWhere.size() > 0) { - - List newPayment = client.createPayments(SampleData.loadPayment().getPayment()); - messages.add("Create a new Payment - ID : " + newPayment.get(0).getPaymentID() + " : " + newPayment.get(0).getAmount()); - - List PaymentWhere = client.getPayments(null,"Status==\"AUTHORISED\"",null); - messages.add("Get a Payment with WHERE clause - ID : " + PaymentWhere.get(0).getPaymentID()); - - List PaymentList = client.getPayments(); - int num = SampleData.findRandomNum(PaymentList.size()); - messages.add("Get a random Payment - ID : " + PaymentList.get(num).getPaymentID()); - - Payment PaymentOne = client.getPayment(PaymentList.get(num).getPaymentID()); - messages.add("Get a single Payment - ID : " + PaymentOne.getPaymentID()); - - Payment deletePayment = new Payment(); - deletePayment.setPaymentID(newPayment.get(0).getPaymentID()); - deletePayment.setStatus(PaymentStatus.DELETED); - ArrayOfPayment aPayment = new ArrayOfPayment(); - aPayment.getPayment().add(deletePayment); - List removedPayment = client.deletePayment(aPayment.getPayment()); - messages.add("Delete the Payment - ID : " + removedPayment.get(0).getPaymentID()); - } else { - messages.add("Please create a Bank Acccount before trying to Apply a Payment to Account Type Bank"); - } - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## PREPAYMENT -```java -try { - List accountWhere = client.getAccounts(null,"Type==\"BANK\"",null); - if(accountWhere.size() > 0) { - BankTransaction bt = SampleData.loadNewlyCreatedPrepayment(); - - List newPrepayment = client.getPrepayments(); - messages.add("Get a existing Prepayment - ID : " + newPrepayment.get(0).getPrepaymentID() + " : " + newPrepayment.get(0).getTotal()); - - List newAllocation = client.createPrepaymentAllocations(SampleData.loadAllocation().getAllocation(),bt.getPrepaymentID()); - messages.add("Create a new Prepayment and Allocate - Applied Amount : " + newAllocation.get(0).getAppliedAmount()); - } else { - messages.add("Please create a Bank Acccount before using the Prepayment Endpoint"); - } -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## PURCHASE ORDERS -```java -try { - List newPurchaseOrder = client.createPurchaseOrders(SampleData.loadPurchaseOrder().getPurchaseOrder()); - messages.add("Create a new PurchaseOrder - ID : " + newPurchaseOrder.get(0).getPurchaseOrderID() + " - Reference :" + newPurchaseOrder.get(0).getReference()); - - List PurchaseOrderWhere = client.getPurchaseOrders(null,"Status==\"DRAFT\"",null,null); - messages.add("Get a PurchaseOrder with WHERE clause - ID : " + PurchaseOrderWhere.get(0).getPurchaseOrderID()); - - List PurchaseOrderList = client.getPurchaseOrders(); - int num = SampleData.findRandomNum(PurchaseOrderList.size()); - messages.add("Get a random PurchaseOrder - ID : " + PurchaseOrderList.get(num).getPurchaseOrderID()); - - PurchaseOrder PurchaseOrderOne = client.getPurchaseOrder(PurchaseOrderList.get(num).getPurchaseOrderID()); - messages.add("Get a single PurchaseOrder - ID : " + PurchaseOrderOne.getPurchaseOrderID()); - - newPurchaseOrder.get(0).setReference("My Updated Reference"); - newPurchaseOrder.get(0).setStatus(null); - List updatePurchaseOrder = client.updatePurchaseOrder(newPurchaseOrder); - messages.add("Update the PurchaseOrder - ID : " + updatePurchaseOrder.get(0).getPurchaseOrderID() + " - Reference:" + updatePurchaseOrder.get(0).getReference()); - - // GET PDF of Invoice - File f = new File("./"); - String dirPath = f.getCanonicalPath(); - ByteArrayInputStream input = client.getPurchaseOrderPdfContent(PurchaseOrderList.get(0).getPurchaseOrderID()); - - String fileName = "PurchaseOrder.pdf"; - - FileOutputStream output = new FileOutputStream(fileName); - - int DEFAULT_BUFFER_SIZE = 1024; - byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; - int n = 0; - - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - - while (n >= 0) { - output.write(buffer, 0, n); - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - } - - input.close(); - output.close(); - - String saveFilePath = dirPath + File.separator + fileName; - messages.add("Get a PDF copy of PurchaseOrder - save it here: " + saveFilePath); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## RECEIPTS -```java -try { - List newReceipt = client.createReceipts(SampleData.loadReceipt().getReceipt()); - messages.add("Create a new Receipt - ID : " + newReceipt.get(0).getReceiptID() + " - Reference:" + newReceipt.get(0).getReference()); - - List ReceiptWhere = client.getReceipts(null,"Status==\"DRAFT\"",null); - messages.add("Get a Receipt with WHERE clause - ID : " + ReceiptWhere.get(0).getReceiptID()); - - List ReceiptList = client.getReceipts(); - int num = SampleData.findRandomNum(ReceiptList.size()); - messages.add("Get a random Receipt - ID : " + ReceiptList.get(num).getReceiptID()); - - Receipt ReceiptOne = client.getReceipt(ReceiptList.get(num).getReceiptID()); - messages.add("Get a single Receipt - ID : " + ReceiptOne.getReceiptID()); - - newReceipt.get(0).setReference("You'll get the answer NEXT Saturday"); - newReceipt.get(0).setStatus(null); - List updateReceipt = client.updateReceipt(newReceipt); - messages.add("Update the Receipt - ID : " + updateReceipt.get(0).getReceiptID() + " - Reference:" + updateReceipt.get(0).getReference()); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} - -``` - -## REPEATING INVOICES -```java -try { - List newRepeatingInvoice = client.getRepeatingInvoices(); - if (newRepeatingInvoice.size() > 0 ){ - messages.add("Get a Repeating Invoice - ID " + newRepeatingInvoice.get(0).getRepeatingInvoiceID()); - } else { - messages.add("No Repeating Invoices Exists"); - } -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} - -``` - -## REPORTS -```java - - -try { - Report newReport = client.getReport("BalanceSheet",null,null); - messages.add("Get a Reports - " + newReport.getReportID() + " : " + newReport.getReportDate()); - - List AgedPayablesByContactList = client.getContacts(); - int num20 = SampleData.findRandomNum(AgedPayablesByContactList.size()); - - Report newReportAgedPayablesByContact = client.getReportAgedPayablesByContact(AgedPayablesByContactList.get(num20).getContactID(), null, null, null, "1/1/2016", "1/1/2017"); - messages.add("Get Aged Payables By Contact Reports for " + AgedPayablesByContactList.get(num20).getName() + " - Report ID " + newReportAgedPayablesByContact.getReportID() ); - - Report newReportAgedReceivablesByContact = client.getReportAgedReceivablesByContact(AgedPayablesByContactList.get(num20).getContactID(), null, null, null, "1/1/2016", "1/1/2017"); - messages.add("Get Aged Receivables By Contact Reports for " + AgedPayablesByContactList.get(num20).getName() + " - Report ID " + newReportAgedReceivablesByContact.getReportID() ); - - Report newReportBalanceSheet = client.getReportBalanceSheet(null, null, "3/3/2017", null, null, true, false, null, null); - messages.add("Get Balance Sheet Report on " + newReportBalanceSheet.getReportDate() + " - Name: " + newReportBalanceSheet.getReportTitles().getReportTitle().get(1).toString() ); - - Report newReportBudgetSummary = client.getReportBudgetSummary(null, null, "1/1/2017", 3, 1); - messages.add("Get Budget Summary Report on " + newReportBudgetSummary.getReportDate() + " - Name: " + newReportBudgetSummary.getReportName() ); - - Report newExecutiveSummary = client.getExecutiveSummary(null, null,"1/1/2017"); - messages.add("Get Executive Summary Report on " + newExecutiveSummary.getReportDate() + " - Name: " + newExecutiveSummary.getReportName() ); - - Report newReportProfitLoss = client.getReportProfitLoss(null,null, "9/1/2016", "1/1/2017", null, null, null, null, true, false, null, null); - messages.add("Get Profit Loss Report on " + newReportProfitLoss.getReportDate() + " - Name: " + newReportProfitLoss.getReportName() ); - - Report newTrialBalance = client.getReportTrialBalance("9/1/2016", true); - messages.add("Get Trial Balance Report on " + newTrialBalance.getReportDate() + " - Name: " + newTrialBalance.getReportName() ); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## TAX RATES -```java -try { - List newTaxRate = client.createTaxRates(SampleData.loadTaxRate().getTaxRate()); - messages.add("Create a new TaxRate - Name : " + newTaxRate.get(0).getName()); - - List TaxRateWhere = client.getTaxRates(null,"Status==\"ACTIVE\"",null); - messages.add("Get a TaxRate with WHERE clause - Name : " + TaxRateWhere.get(0).getName()); - - List TaxRateList = client.getTaxRates(); - int num11 = SampleData.findRandomNum(TaxRateList.size()); - messages.add("Get a random TaxRate - Name : " + TaxRateList.get(num11).getName()); - - newTaxRate.get(0).setName("Yet Another Tax Rate-" + SampleData.loadRandomNum()); - List updateTaxRate = client.updateTaxRate(newTaxRate); - messages.add("Update the TaxRate - Type : " + updateTaxRate.get(0).getTaxType() + " - Name : " + updateTaxRate.get(0).getName()); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - -## TRACKING CATEGORIES -```java -try { - List newTrackingCategory = client.createTrackingCategories(SampleData.loadTrackingCategory().getTrackingCategory()); - messages.add("Create a new TrackingCategory - ID : " + newTrackingCategory.get(0).getTrackingCategoryID() + " - Name : " + newTrackingCategory.get(0).getName()); - - // TRACKING OPTIONS - List newTrackingCategoryOption = client.createTrackingCategoryOption(SampleData.loadTrackingCategoryOption().getOption(),newTrackingCategory.get(0).getTrackingCategoryID()); - messages.add("Create a new TrackingCategory Option - Name : " + newTrackingCategoryOption.get(0).getName()); - - // MULTIPLE TRACKING OPTIONS - List newTrackingCategoryOption2 = client.createTrackingCategoryOption(SampleData.loadTrackingCategoryOptionMulti().getOption(),newTrackingCategory.get(0).getTrackingCategoryID(),false); - messages.add("Create a new TrackingCategory MULTI Option - Name : " + newTrackingCategoryOption2.get(0).getName()); - messages.add("Create a new TrackingCategory MULTI Option - Name : " + newTrackingCategoryOption2.get(1).getName()); - - - TrackingCategoryOption oneTrackingCategoryOption = new TrackingCategoryOption(); - oneTrackingCategoryOption.setName("Iron Man"); - TrackingCategoryOption updateTrackingCategoryOption = client.updateTrackingCategoryOption(oneTrackingCategoryOption,newTrackingCategory.get(0).getTrackingCategoryID(),newTrackingCategoryOption.get(0).getTrackingOptionID()); - messages.add("Update TrackingCategory Option - Name : " + updateTrackingCategoryOption.getName()); - - String deleteTrackingCategoryOption = client.deleteTrackingCategoryOption(newTrackingCategory.get(0).getTrackingCategoryID(),newTrackingCategoryOption.get(0).getTrackingOptionID()); - messages.add("Delete TrackingCategory Option - : " + deleteTrackingCategoryOption); - - List TrackingCategoryWhere = client.getTrackingCategories(null,"Status==\"ACTIVE\"",null, false); - messages.add("Get a TrackingCategory with WHERE clause - Name : " + TrackingCategoryWhere.get(0).getName()); - - List TrackingCategoryList = client.getTrackingCategories(); - int num10 = SampleData.findRandomNum(TrackingCategoryList.size()); - messages.add("Get a random TrackingCategory - Name : " + TrackingCategoryList.get(num10).getName()); - - TrackingCategory TrackingCategoryOne = client.getTrackingCategory(TrackingCategoryList.get(num10).getTrackingCategoryID()); - messages.add("Get a single TrackingCategory - Name : " + TrackingCategoryOne.getName()); - - newTrackingCategory.get(0).setName("Lord of the Rings-" + SampleData.loadRandomNum()); - List updateTrackingCategory = client.updateTrackingCategory(newTrackingCategory); - messages.add("Update the TrackingCategory - ID : " + updateTrackingCategory.get(0).getTrackingCategoryID() + " - Name : " + updateTrackingCategory.get(0).getName()); - - String status = client.deleteTrackingCategory(newTrackingCategory.get(0).getTrackingCategoryID()); - messages.add("Delete a new TrackingCategory - Delete result: " + status); - -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - - - -## USERS -```java -try { - List UserWhere = client.getUsers(null,"IsSubscriber==true",null); - if(UserWhere.size() > 0) { - messages.add("Get a User with WHERE clause - Email: " + UserWhere.get(0).getEmailAddress()); - } else { - messages.add("No User with IsSubscriber True found - must be Demo Company"); - } - - List UserList = client.getUsers(); - int num = SampleData.findRandomNum(UserList.size()); - messages.add("Get a random User - Email: " + UserList.get(num).getEmailAddress()); - - User UserOne = client.getUser(UserList.get(num).getUserID()); - messages.add("Get a single User - Email: " + UserOne.getEmailAddress()); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); -} -``` - - - -## ERRORS -```java - - -ArrayOfContact array = new ArrayOfContact(); -Contact contact = new Contact(); -contact.setName("Sidney Maestre"); -array.getContact().add(contact); - -// FORCE a 400 Error -try { - List duplicateContact = client.createContact(array.getContact()); - messages.add("Create a new Contact - Name : " + duplicateContact.get(0).getName()); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - - messages.add("Error Code : " + e.getResponseCode() ); - - List elements = e.getApiException().getElements(); - Elements element = elements.get(0); - List dataContractBase = element.getDataContractBase(); - for (Object dataContract : dataContractBase) { - Contact failedContact = (Contact) dataContract; - ArrayOfValidationError validationErrors = failedContact.getValidationErrors(); - - List validationErrorList= validationErrors.getValidationError(); - - System.out.println(failedContact.getContactID()); - System.out.println(validationErrorList.get(0).getMessage()); - messages.add("Failed Contact ID : " + failedContact.getContactID()); - messages.add("Validation Error : " + validationErrorList.get(0).getMessage()); - - } -} - -// FORCE a 404 Error -try { - Contact ContactOne = client.getContact("1234"); - messages.add("Get a single Contact - ID : " + ContactOne.getContactID()); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); - messages.add("Error Code : " + e.getResponseCode() + " Message: " + e.getMessage()); -} - -try { - List listOfInvoices = new ArrayList(); - listOfInvoices.add(SampleData.loadBadInvoice().getInvoice().get(0)); - listOfInvoices.add(SampleData.loadBadInvoice2().getInvoice().get(0)); - - List newInvoice = client.createInvoices(listOfInvoices,null,true); - messages.add("Create a new Invoice ID : " + newInvoice.get(0).getInvoiceID() + " - Reference : " +newInvoice.get(0).getReference()); - -} catch (XeroApiException e) { - int code = e.getResponseCode(); - - if (code == 400) { - List elements = e.getApiException().getElements(); - - if(e.getApiException().getElements().size() > 0) { - Elements element = elements.get(0); - List dataContractBase = element.getDataContractBase(); - for (Object dataContract : dataContractBase) { - Invoice failedInvoice = (Invoice) dataContract; - ArrayOfValidationError validationErrors = failedInvoice.getValidationErrors(); - List errors = validationErrors.getValidationError(); - - messages.add("Error Code:" + e.getResponseCode() + " message : " + errors.get(0).getMessage()); - messages.add("Error invoice Num : " + failedInvoice.getInvoiceNumber()); - } - } - } -} - -// FORCE a 503 Error -List ContactList = client.getContacts(); -int num4 = SampleData.findRandomNum(ContactList.size()); -try { - for(int i=65; i>1; i--){ - Contact ContactOne = client.getContact(ContactList.get(num4).getContactID()); - } - messages.add("Congrats - you made over 60 calls without hitting rate limit"); -} catch (XeroApiException e) { - System.out.println(e.getResponseCode()); - System.out.println(e.getMessage()); - messages.add("Error Code : " + e.getResponseCode() + " Message: " + e.getMessage()); -} -``` diff --git a/example/src/main/java/example-spring/SpringConfig.java b/example/src/main/java/example-spring/SpringConfig.java deleted file mode 100644 index f98303bd..00000000 --- a/example/src/main/java/example-spring/SpringConfig.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.xero.example; - -import com.xero.api.Config; -import org.springframework.core.env.Environment; - -public class SpringConfig implements Config { - - private String APP_TYPE = "Public"; - private String USER_AGENT = "Xero-Java-SDK-Default"; - private String ACCEPT = "application/xml"; - private String CONSUMER_KEY; - private String CONSUMER_SECRET; - private String API_BASE_URL = "https://api.xero.com"; - private String API_ENDPOINT_URL = "https://api.xero.com/api.xro/2.0/"; - private String REQUEST_TOKEN_URL = "https://api.xero.com/oauth/RequestToken"; - private String AUTHENTICATE_URL = "https://api.xero.com/oauth/Authorize"; - private String ACCESS_TOKEN_URL = "https://api.xero.com/oauth/AccessToken"; - private String CALLBACK_BASE_URL; - private String AUTH_CALLBACK_URL; - private String PATH_TO_PRIVATE_KEY_CERT; - private String PRIVATE_KEY_PASSWORD; - - private String prefix = ""; - private Environment environment; - - public SpringConfig(Environment environment) { - this("", environment); - } - - public SpringConfig(String prefix, Environment environment) { - this.prefix = prefix; - this.environment = environment; - load(); - } - - @Override - public String getAppType() { - return APP_TYPE; - } - - @Override - public String getPrivateKeyPassword() { - return PRIVATE_KEY_PASSWORD; - } - - @Override - public String getPathToPrivateKey() { - return PATH_TO_PRIVATE_KEY_CERT; - } - - @Override - public String getConsumerKey() { - return CONSUMER_KEY; - } - - @Override - public String getConsumerSecret() { - return CONSUMER_SECRET; - } - - @Override - public String getApiUrl() { - return API_ENDPOINT_URL; - } - - @Override - public String getRequestTokenUrl() { - return REQUEST_TOKEN_URL; - } - - @Override - public String getAuthorizeUrl() { - return AUTHENTICATE_URL; - } - - @Override - public String getAccessTokenUrl() { - return ACCESS_TOKEN_URL; - } - - @Override - public String getUserAgent() { - return USER_AGENT; - } - - @Override - public String getAccept() { - return ACCEPT; - } - - @Override - public String getRedirectUri() { - return AUTH_CALLBACK_URL; - } - - public void load() { - - if (environment.containsProperty(prefix + "AppType")) { - APP_TYPE = environment.getProperty(prefix + "AppType"); - } - - if (environment.containsProperty(prefix + "UserAgent")) { - USER_AGENT = environment.getProperty(prefix + "UserAgent"); - } - - if (environment.containsProperty(prefix + "Accept")) { - ACCEPT = environment.getProperty(prefix + "Accept"); - } - - if (environment.containsProperty(prefix + "ConsumerKey")) { - CONSUMER_KEY = environment.getProperty(prefix + "ConsumerKey"); - } - - if (environment.containsProperty(prefix + "ConsumerSecret")) { - CONSUMER_SECRET = environment.getProperty(prefix + "ConsumerSecret"); - } - - if (environment.containsProperty(prefix + "ApiBaseUrl")) { - API_BASE_URL = environment.getProperty(prefix + "ApiBaseUrl"); - if (environment.containsProperty(prefix + "ApiEndpointPath")) { - String endpointPath = environment.getProperty(prefix + "ApiEndpointPath"); - API_ENDPOINT_URL = API_BASE_URL + endpointPath; - } - - if (environment.containsProperty(prefix + "RequestTokenPath")) { - String requestPath = environment.getProperty(prefix + "RequestTokenPath"); - REQUEST_TOKEN_URL = API_BASE_URL + requestPath; - } - - if (environment.containsProperty(prefix + "AccessTokenPath")) { - String accessPath = environment.getProperty(prefix + "AccessTokenPath"); - ACCESS_TOKEN_URL = API_BASE_URL + accessPath; - } - - if (environment.containsProperty(prefix + "AuthenticateUrl")) { - String authenticatePath = environment.getProperty(prefix + "AuthenticateUrl"); - AUTHENTICATE_URL = API_BASE_URL + authenticatePath; - } - } - - if (environment.containsProperty(prefix + "CallbackBaseUrl")) { - CALLBACK_BASE_URL = environment.getProperty(prefix + "CallbackBaseUrl"); - if (environment.containsProperty(prefix + "CallbackPath")) { - String callbackPath = environment.getProperty(prefix + "CallbackPath"); - AUTH_CALLBACK_URL = CALLBACK_BASE_URL + callbackPath; - } - } - - if (environment.containsProperty(prefix + "PrivateKeyCert")) { - PATH_TO_PRIVATE_KEY_CERT = environment.getProperty(prefix + "PrivateKeyCert"); - PRIVATE_KEY_PASSWORD = environment.getProperty(prefix + "PrivateKeyPassword"); - } - } - -} diff --git a/example/src/main/resources/certs/public_privatekey.txt b/example/src/main/resources/certs/public_privatekey.txt deleted file mode 100644 index dce3032d..00000000 --- a/example/src/main/resources/certs/public_privatekey.txt +++ /dev/null @@ -1,12 +0,0 @@ -Public/Private Key is required for Xero Private and Partner Apps. - -You’ll use the private key for RSA-SHA1 oAuth signing and upload the public cert at app.xero.com. - -Creating your Public/Private Keys -https://developer.xero.com/documentation/advanced-docs/public-private-keypair/ - -Private App -https://developer.xero.com/documentation/getting-started/private-applications/ - -Partner App -https://developer.xero.com/documentation/getting-started/partner-applications/ \ No newline at end of file diff --git a/example/src/main/resources/config-partner.json b/example/src/main/resources/config-partner.json deleted file mode 100644 index cc82e648..00000000 --- a/example/src/main/resources/config-partner.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "AppType" : "PARTNER", - "UserAgent" : "YouAppName", - "Accept" : "application/xml", - "ConsumerKey" : "YOUR_CONSUMER_KEY", - "ConsumerSecret" : "YOUR_CONSUMER_SECRET", - "ApiBaseUrl" : "https://api.xero.com", - "ApiEndpointPath" : "/api.xro/2.0/", - "RequestTokenPath": "/oauth/RequestToken", - "AuthenticateUrl" : "/oauth/Authorize", - "AccessTokenPath" : "/oauth/AccessToken", - "CallbackBaseUrl" : "https://localhost", - "CallbackPath" : "/CallbackServlet", - "PrivateKeyCert" : "/certs/public_privatekey.pfx", - "PrivateKeyPassword" : "——YOUR-PRIVATE-KEY-PASSWORD—" -} diff --git a/example/src/main/resources/config-private.json b/example/src/main/resources/config-private.json deleted file mode 100644 index c9112fde..00000000 --- a/example/src/main/resources/config-private.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "AppType" : "PRIVATE", - "UserAgent" : "YouAppName", - "Accept" : "application/xml", - "ConsumerKey" : "YOUR_CONSUMER_KEY", - "ConsumerSecret" : "YOUR_CONSUMER_SECRET", - "ApiBaseUrl" : "https://api.xero.com", - "ApiEndpointPath" : "/api.xro/2.0/", - "PrivateKeyCert" : "/certs/public_privatekey.pfx", - "PrivateKeyPassword" : "——YOUR-PRIVATE-KEY-PASSWORD—" -} diff --git a/example/src/main/resources/config-public.json b/example/src/main/resources/config-public.json deleted file mode 100644 index 468c91ac..00000000 --- a/example/src/main/resources/config-public.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "AppType" : "PUBLIC", - "UserAgent" : "YouAppName", - "Accept" : "application/xml", - "ConsumerKey" : "YOUR_CONSUMER_KEY", - "ConsumerSecret" : "YOUR_CONSUMER_SECRET", - "ApiBaseUrl" : "https://api.xero.com", - "ApiEndpointPath" : "/api.xro/2.0/", - "RequestTokenPath": "/oauth/RequestToken", - "AuthenticateUrl" : "/oauth/Authorize", - "AccessTokenPath" : "/oauth/AccessToken", - "CallbackBaseUrl" : "https://localhost", - "CallbackPath" : "/CallbackServlet" -} diff --git a/example/src/main/resources/config.json b/example/src/main/resources/config.json deleted file mode 100644 index 13e5444e..00000000 --- a/example/src/main/resources/config.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "AppType" : "PUBLIC", - "ConsumerKey" : "YOUR_CONSUMER_KEY", - "ConsumerSecret" : "YOUR_CONSUMER_SECRET", - "CallbackBaseUrl" : "https://localhost", - "CallbackPath" : "/CallbackServlet" -} \ No newline at end of file diff --git a/example/src/main/resources/helo-heros.jpg b/example/src/main/resources/helo-heros.jpg deleted file mode 100644 index e67595465a8c6b1ee7fa19e3cc072df2d9e5a708..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40053 zcmeFZcUY6nvp*bq2WirKQ(EXX5ETUh0TJm;@J63<&h@*_x!&^c``xhFPd2l&Gqbz*J+t?Q^SSdCzy$+ceO&+v2>@`D z_yU}-l4sq3dbtAtMn(Wh002M@pe11fkP;CkF~^Zy_=9PQIE91-Kt?P{h%W#MH-O>~ z1^{wNc>cx3B$xiCA#xy*|Ci585`{mQjo79#-U~qfciZj+v41exD`Fks>VpS9ZUC>_ zo)AAbK_#=_RYWO&_xM+-Dl0E54^WVkSJIGE)sR;gBm#MP4LM~1Kp;B*A2~=hqKp2; z*Aj&POQr;gzp(-UkO2Tt5&4qKDJaNiko_YcsX+$$zt|y@MKRk=<-}>k*s=xUYEtN&{H@-l`wExm4WwHIKC)$8CD+~6Ae?JlDXJ!8Bms~+k z1(22XU-;QSa>~oeJtO&>CsB%Lr2p8CMEV)oKNzt3g5z%*;uw_tCI9d729%QiUH==C z{WnbUHx?n*Q~tMlg+DSAQ z|EUfDkntsw8v+0v^i)Q{XfSQ?uPecZ& zrtwFXKg;S5`rXHWPhbFjpb&uc+pB-ezimY%`eU>IW8MooJGpoZx;Xi|1vm*R$ttM% z`U<)O6=ao&^t43Hf3Hu{Kda-fc}SdXZ|I`yP zxdqV{zt`|@8VA5%>zwrN@3zeU(u4r`{_rG@2|00m{-n#q_ussj|0>Cdvm4+_%+-H= z2FU(Zvf%%&|9j2+;q$xQ@A3Uz66e+La{mgkVEC{3@%x%Y%kCKz^gsg$^b3@Aa)mg% z$+|#%fl#LhKzUg?AOHl0J|No1ElAMW&BM!2OL(uXOIXm$RZG}X*+|alfsUJ}*Uj(% zH?wf#yDs70F6yqrU~NGVR0Hb!z}GFvNf7Gm;}@s_)e`>0T!V;zR|ACw|BwWEYYAH! z-4@h=1h@$*%PPsr2@_ifxVmfHxvu+nTjD1z;lG6p4GonIRg{GUcmUG=jK# zxrhC)g#V2jB;YOt;-e+}=c+6$_;0TozZ?J6A8}Crx6Xh>s{;Qv>u>n)_-G6MC;i6) z|FOV-Ebt!-{Ko?SvB3ZTEbw0*o|_-hg9s)1Z-Db10F)RP{^j-vD$2?M)UN3pk^goh z0RS*Bi4A~^M@)~G=mL`hNO?)Y07`i!d3iZyUQ%rU^=}_UPE}r=msIt?e*pbM^cOF& zKfEqnDERJDM$)HrHi>q}xGlS$cLSKI0jng^WF*1>Qf3k|W|H%MfB?~Nr6Bo}{xl=L z{S!pc(9#hJ8i+nM2^kqFIT;1TZ!t+Ce@Btz%oHp_@>eNYO`WKO{n-?vGM`h6T&w9} zzcY>zRdf!BrlGya!O6ufCN6R5vZRu-imIBrhR*dHx_USD4b1METUc6I+qk&8xqEne z-46^34he;Zg~vRKjf+o6Ov=iBoRgdPK^aw)QlC-*$&zS9(&>kE%TU zIC+PAcki~Gl&`Kj!;Xz9PWDsOQM`gYZ{|{Gqk62Qzoq(*rJ)Z2Ub`4h7hS%sO6~yH z%9Nh%?=u*_67B2VLcFOBgWLQRS#u*w)VJym>v$H}8-U9fiiT z6jNROA@<2{1jZKgeb+0L{xJjLj76nYmA@6f&!#aR9OY0`cRGp3 zq#@!>zIcw8A{>QWh9L*looX|p)KBLxAMPL48BF+ne7B?q-5t(7QVB_T4T10)bjV3A zvRNW8tL%jarvDN;(Hb zClMyj0rmE~D9D;gBKHfNv#)`7vW)C|ic*zNTy_hCE;{wKH);%nooU9@_|sTritHT{ zn6~1NiivG&;2#9)8gi@LO17E=xY|R@cT<%ROrrw1uH>YsfOTE@!lJf!T9B;Eq zR=YSSy=0+#6C(5_T7zE$>*$E*JS**_fR8gn-u6CxNT$>LzK^tWg?!nSE zV_YO90naix$%r-qc`3K-k~;)FOd*+D@mT6eUS-;m#}2K;l>`Q30?|z=1m1Ii-@7=h z()V7m&pNUD%#SOWvs2R6EtD0Y%DZi}AI<^S?@O&Q;Ux0iJ(VPG z_B^1ZU~^@xcjeE?yn2J}Hp%~O)=|QCmzAoKzLjk_xb+LlS@qg!6C6wPj-ZTK>9Fb3 zKMhq*%)xg6S9deo44tlq?JewocTB2+eW<)Zngj*x2n@`0-R)Xw(b#f42lVKG0zT`i zI52#ACdzV?#Lo`<{q$q!Ar5o$=HY69+89{J(N-5*&e{3S$kbyOJuk4&2(Jk@yLh1OQ_Y1sv|q?8ZIb`dohsqbtCGR zbAerX8-f9ymfF1&Rnq3lvc zILY`1LFQ0L7L(TPbzUnnYP?9RC?Z8s_Mqp@%W`fa(bR&otpvG_6OeUza4K-EG7>Qr^JKWcV+qU(xj^4wRSgEq&D zF-@*TTH6)%*t;puc%n%Tw7h%s40DW~AE!;jIS;8Z6_Qz63=+D)Kvk7U4hXvPl6ju` zo^8mIpx#|3`SsaRy2wyS>dyd;eH#^mn5!UHSoQsNGFzbVde>4p7rh#T7$SQYAwAk^6N?EMq;j}FriMg`8yQ9$4 z`?W0o!K5%rGI1nUE|a89cpJz#3>#;?!h3Iw;cl+$ zaym0OG-55mO3}?*u1ZTECe)sWYM1E0$lh&54i;Nq`RLvK1LVOHRG9v{Y6IJ<;4((l zWV3(YHHY=nvVsGB?@=f@EMx)vvmLaTMB>cOiLTD(QqfuCn|PnTGOx3QlRDMp z%pVm>kYg)>L1gBZR9|}H`XhjZ1f)X%Q*etDj>GPmN@v+~`45I_4d>fiR**P|!Vtm_ z+y~rE*0P4g159RKs!N~LcD8)xCy45d&lI&p>TNm}IyL}zlBs@-U^*QI^j07ocuOq% z8D7I7eYJxQvY@QL;q$;YHkHzTq41I#`HJNxvJZumme`@G#O?Js(Bjfh$zl2!qo$<8 zWM4^N3kKb<-oDE2IWAshKp!??O6g^}RTJSv*NNpP&1jx)i0e!D5m08U+4<6tou+`b zZ3h5c%1fcB@noh*g;Co!R{iY0ItaorA{F-L^YOO1p|t+u+hAM021B&??SAIQiXn6< z)z@q)42n-%g5@%xkbgQy`3Xg4JM$4QlTPv8QIAPSApwE{OBrb-z`lr#zjKFEA( z@*-LnL0c2JmaGP<&$4pLb$MiQj}Gay)Kvh)NvEg4j4&UER^wBBU?Uw;)(vf+Ds33d zpS8a2aBBZh(Ue2Yk3pBCuI0Uum$U`i(N;bc#bGTLXgg`f-l4$QTACfp_o?bccZ zMpPOI;e_9Im`g@UCU)iYpJ#TZM+0rA`^jgc2+d9&;(h7~e8Ofh`{n)ooV;FjTeBv^aaK>WK|$%~(Q*2^E2U9|fsU16 zicS@MY{_bTytdGd(#3Bkm6bIe^|ewt(89qDgDjQ0%Tmka9)*+TJYL?BLvAp(*Rt;C z0PqySsB5Jz|3h9E<~A~wG0x(m4Ls9h$Ru}EK;Rckm&Dhuo83U+s5F4~@>%#Pl0Z9( zzN{>OyTq}hRBNC=*$||T`L*Otix@43S;v(e^jsTsp&_wipy^~pV6Qq`cq?4~zzhW)B@-Z+rQ zaf-D(PQYB)1NiI_v>O(omMfe6KsLLpE^Z|V53bL;JJ(D}FZLWsXyMp5$MLtZz-W*> zddH)WTO3*1us`qR=-bk)CpppjLh_YF*2a}FzU{@Jb3oiVph3Eh2gQL~>kF5I+vtM~ z-oAUv`!hKyAwpk5(%)}L+2-JN{hLwUv$17V6tZFS5u6V%i<#|xUb4kKltAFcg^%56 z%b(x+aup&iN8K${5TZcyy)by&Ap*GLkL4G)D#s?n+XcSMEpM?ptwAx2B5pHr!s!n*J=$f`6l>QWgr(i9hquU z+mFn36Yq4)9|8z54$haBoHHN2cxb3Q5@(o*3>8KQnxJ+OPH_IpE0(^ zsFCRGRW99lqf~uGbjLLNgf@>fY^*A;KUCi1_}9VL@^iqW&Vv-GEGdkkIdLKP!7kO$ z?$q0JbZaYNMJ?r(d%xIh<-2@UmfC02FDj7;U%APK>3cO0(bdC*yG+$5kXo$JghRaa z(gtFXNqakPZS^r`Ns4^vff(V+%(_btIQh!SANG5A4T%{{O`R2l7a`1Fzu%F0esU_1 zfGQKrx&kq~qmK@g8QN2E4WE5q12b$379%f+)b)2vLSpV9aF^l-1s;Lf+7&Tk_%6tPg7{Z!xNW!5>s&S#R5YC{(7p1FHd-Y9hH`i&Cbj z&a`Z!INRh%jcE=C5L}I5jJe6Y$W7=tajNcJD2N>tnLbD`$O5;c0HWb3X_`rdhn+O= zFGzB2NxUpBV$J&;kU-$5!-5kIn*AF1gg=;s2D|vD7;;6kg>pWaBM%a8d4*onPUYh) zB>!%+1J+q}oX`jS2 zjZ6&-J_ihp%>#Q|1s)xEBj#0)rpJRVBfb`&-o@E6)&*?0-13T`r)F8ats?A{uCBwH zRf^0a3hy{CKFpNZ#erX@!TVr2qLif;PLWzZ3w^E1J^Ksmve%YDu{S@InP1?I$?aYN zv7_4{2}>k6uQHtDN>@5a^Tp-P;?aY1z`X8p-Pk2 zvchO5s}Fi!&)W@<*NA8Oa3w~xRTLyt^|(Ui8&#CQ++$vst7UGU_mCItQ#Yp93y{Gzhdfnr9~Ha{%1{ zLIo88{JcK3VnH>Ws(aNZt-J~*e+u4SrY|`wQWgNfuFQf=S3{;s^>TlX8E3iW1M8H0 zoIOaOUzSx2Hram&(1TZAE;CodnAX6YP(1_UdN#o|^)B(%pDpgitlwc}RymyWMbvAI(N{$BK^ zVa{| z9uFPM%?n1O4W&3`Kn=H5K?^mLyky1UmakwMMCoD(v)W{smr)q+Rb(G9x|5+6v-2U7 zPtUe1+pMEt6rsKk;Yu}se2Y@CSkps!pYRkbFvN`-@a5?}LH>w;RvuT)J=K+52?{K; z(|MWOz_@p0s#<(KKws3b5&Q(O;wv~?gOlC7k&Skh9|=}Mn=nUaU2j@eVZ?FJlS-0O z9j5^#MAHg`%0Dy^I@jnI6i__6#>Ze5#L6@HWh@?9Kij{@2Ghav=OEVh1ibT_xU+|z z+ga&O*oc*NI;G@U8g*J}+ofH2$QkEjIpF9yiz+I3KeNl8zI3Va{W(BJBUgQhnn_?$ zyWyy7=XKSWEo6hl4sDlDX3(PMpeoj8puxp9cwerEo%2QX`1%hu?L%}iEiNK-jp06n z#;N5eyg+&LvTRAk$2&?_bVHu~+JJe`HjlkY^KQ$+8sFOPoA#sW_~8oU#(YJ+B6@=| zZ;CXe7S68d(0diMES5eREGK81uMQLvAt6)sNw56T*9idCyX5DfvM|WVn_CanQTu(G@q}VpluV<3*N|W z^D;f8P2bhY5$M-P-Osj2V;Ayipt`3R#SeapQe|~WaobaDEEE%a(So(?L4JlfV5*BM zziX?f_t{uvquFat?{e#w$@Cc>c_)7T+L0iBG& zh)#?5rKB%ooA2~w{Y2mG^GJ}@MnyTqpH)fS8+z_w_f{m}y)cTun{2G6!s6s*8(CY= z>QsE#;85Y3b~o@GU{hyZ##tc)w>+cYa;q!otk{H1`Q>1ER(298mse4b9>^ggc?^-& z=sV?Dk?ZN;x_o(yhFUy zeakx-Cgz^D6osEA{x;)7X2pqc#JYrJg>Je)3kH%<1&FBP-v!~9AIw}y+x;Bfn5kj{ zDz{mO%OZM=5zgQ^2OcaVDi|Bu4_BI2a!%yWE5pGzM>{;oU#00^(@P;Wyhw6I^b~)2 z6@ruD=!S4_g?A!DS5VA2h+$mVMRi-#x-eK~lZ%qupk1zDrO(`!f`Z=N`_~M0eVM%R zm1o@P_Km42f!AJHz7lRV0@`7I{8Stk@rZ4d^Lvoi%s4nq08qvnI#_XuML4H*d> zEu7^X((NFO@{S(k!k#;RvnfBa8HjlGCK(@l8ARV=Ewcb6z4Cxs=y^aNyWRwv3tFCV(#n>FTm+7gOqNUv@ldR zQwq4rWQV5&cZ#NpQ!-(Lf8ZCu4ytp8J|A4!*gO@ zmbkCH_g76WtC@tmG{3RK6sVug(M3~Iev+DkQ3&)eKO%@v!iAu~fo1xyZI}hFl8$k> z#P{&z>yKaq!mu{Ju3n@(dDK*lN8b^W*%kL3%VRhJ7lQ@VVr4R%R9eanS6??6V%V<_ zzHv5**9^V2zhR{Q|;skxq>&X>-EoL%f8x-DS;> z=|3O1kr-sZS3?zn=4jBC-77M_tY;8DjO?GPu;x73kMMrO&j!&e;(Zc8}E< zX+(C>)pkukUM$hHO=)xWoeFxL1K4&qtb#QW47e_Hta5)yr#n?qFvyc%1tN`qLmg0( znQeKe<4u4gMn1(-X5uog+UR~Sdhb+r7HwWAxdxdNsmW4MNpI!(I)s9Kt?A^!2jbc= zs6hfZHuO=aAU+6_Td}(6pm`e75dBqxiMtN9D?P_G8BlHMy?fg1+s_Y1>o%<>(=GaG zo-W6#)Ta4qFIF14NmehnuQNSf>nejzx3}6a=#rv*S!_3O5;Z`$e{&8FI(xG`?9-Yrms|w-9%%l zJTUpcKHRw8RT^rVI!|a75KA_R53i0bWup0pppyO}+rYKw0il7(PJzg4?JB*Qy^}TD z4MiVm?jYKtsYJ;ficaP1J;99H;<)2M1^f-17Ut#0v2IlwU?MDdF5{TLI9`8ZFN zxHIk4*{J_AVxchWT|v%GO4BbSB8OuskR7=H4}TmqZYfn%iTop+)tvZ zOD!<*P&1_sR^xrx_?x`)GYM^lOBz?cfpkOA2)&-;evWhsd>g4FbBS~N{OkB zj`ST_ZbR>1M|5tqWbmCXI9WL+diF4#5$_e#gJ6;ga-=}?T-ia@FGT9nJ*gK+J5gR- zEPwhSgy;3{%Yn%qbLf+cKXV%S1Eivi7A$<-{OBq|cxQR$)8A=b_;%tfk#9^+tJrgNVp(qg(R3rZmhH_OBTrb5N@}FmJWs(g zL&v+TwDql3)#iFPZdmlb;$y#JI!JMQO0Z^9IN$p$qNj1&@1@?r!aKI8u`k#3hltK~ zXKmJeuS}cFj<6fq?khgYn2x%k+8c=_!A=b|aVYtX8hfJ|57key11H zmq_DHne|kp%ky`x4M)vxCJA>1r92E^qRL<2ZEz&jY1?sRK6o^=L|1O-pMD&T-EpKP z2BTNtoPBHHlupiu@n9g0r%FCY{B5Ps@S3+NdztTrZu5OPR9n+N#O9#7QS@HL?1YNxU61IR3fIest(US(M*#;)}ph<)ot>T@1|Cb7qa( z79jm+PYQ+*)IR-j$LPpv6Sa#qtYd7T_Q66uo*S%tGO!C zHxj866=GcMcf8 z*0wK8cf?{)D5iPz9jBNli~cs7oMTfH+jfXIJ)b(&G^wi*n~}2D;#T$ouPvy}(;OV3 za=PwU98JP5ulkyK#h6Ssq#wM_y=b*!p=&O?$ab-tYfX*Md;KzTSK%emS!EJkrfsK) zSnay7EH?NgHInyapgj*rIoIAL^IS96i+NFB1n|;QDE=|t>g-vkB>>m0LxO&Y`<-6@A*~4zE7SYZV@XOa}PKB>$ z4Sn4olPpM(Nx#~S?zF-l#;1Y!RyoF%N2EsDOgQgvzcLi7vQ&w@ z=#mkmwiCq)sT9u^gL;Tt89{GKn}fK4waUP+B{2XO=ND`lZ!jdvt!3@|v~q8>(b@Aw zW~b%l7DE8szWV_b<$&WUBaC)&3iK5V6!a}oO?kA=2sL&jmZU9xqjBX)Y8ILeu_fo- z)RMv=ZefL{H)`vwK$dUjuCI3kJ&Fyz#a;F_t}*4YUg(RUAYUOXmO8LJ;>FI!cJkp( zaH<^f+QRmDO{_{ABCr(NHBe_|wP?#@STMK5lOWuZn)`W2Q1{Mgi|dFY=@q(-%AgWu z8iQH6T!~`XsMSe1dO03W4+CK(dIcD9BCE%J_Bv>$RFJpZv+tiO1fOQ^&Rq5gpi!VM zkv_GJyGLb~kBc~(!(kDTr^YaM%uq-eOfWE(> zyyh%*m+;9dQFVmVS}XK%!)c2pfjpcuDZ`4&VC!em&IafA$%^dLbi>B8GW^w*Wm?s! zpizlyhEl0ETCR&AU$Kpj-d^Ec?N^m3y}8E{?ZhwCvmCRD;zKpNIa`bj3@-sJKEE@d7Uf4k; z(By-B{97{{`CsqK)W27{LYXA@g^P}T?2e)X!grOpFWlHEH0850iPs7CFaN@x>3i_> z)|-ph+7juO{jRQGxXQ&l+azJ(YyNlvUOqNiCR$Hi|2nA8duxQ8iu>mPhW1GRwM88p z%;MLA%`Zmfzb4D(vMvsq>(cJsTZ-`n0WQNYZ6T-#Vt8xp;pChrzZjN2_u%Z`3SJHpvV3>Ms#)eP~U+|y_o8|tCOLiePN_l>F zm2$@yIXIwM!-$!gUDDUH;6kpJ*iUy>(PT^sIVSV>0mo*Y@IIT z=~bxeHwmg$cdqFZ;j5nWaS`EoGAgB}ee8%CGOWw;{a$mDq|J%zGs9)fER%P+cah_R zus4cx=(bLp`cKOmKH-&W{iGNQZLK#uBilX~aSWSfeD)DYAZWtareP%5t3n5g(Ibk-q3gTW;e#e(qlU^VxF0VJd9^2>iV%veV zZL-RzSg>Z^b4 zd~}uoXZ?PJ zr@F+RSmSHLC49PcU!;5cgYoe9bL(C1s1)Y!{D4_ye7#(uL`6E~Yb!S6ktfzt<>9!`k-up|B)E=&_$fp`LEAiR7$-%jM)6I**|uE6^4nM z7lQyYM3l~H&6JeD$HI?O zWJN7i`Z;n6+zuo>7f1o`KrbPOdSEl$q~io$WVI{)I3XeKKi$N>;ecR)3y=2 zq8F}yj2!e{RWz39zw->M_uA# z1gYDSD|WJce~WYM@%UNYPmcL zaVjrD?zA-(pP3x)_Y@c1L;;|OjPU?q>+F(aO-^~=Hj?*SYsV`bmv;IJg4A34 z(zIW@Jf_X8D{IK`k>Sx(baUj|J4)#E^B%8ar!=wK2n%4tO&`j{;O9`tYGGfmjaFw& z`HeE-L!)RzO({1gZ(n9;qE!ifkFK#Qe;A4uo4!+q-lJNw{~lU})w|ioOrFnKZp(H_ zk9LIe)9r_h)I(&STn<5cNl=e64WpBWa{%%7t0G6-B8n@p}hMdeJw3;iQm&}(K3HTZ+D9Ph>n z0)@^RgaM~A=ooztsC8(0;i(a*!&gL%4oq0T)y$8Gt$p0_%i5>EL7UB!x)k!A&R0lJ zv68Sf%Q!*ddo5I;&%gRsf8<^6wR+UTtivS8{Q1@iB321_VafBDCM1`o&mZb{1w?61 zzo5USX|m=3!e8rG>vFla_oD5zQH$n`rq)i>4*PU^-sFa{d{@q*9;8iY9*@8>SoCHoCVnl~R0Rc|R?iTk?mq~{s8wywt`rEmjsoc_dr`7?Y8(YTztmOs`b zP(?U`m;Vr#x#3oet9C#({tg)Qq5a|th!|?!AL?{lX4Z%E z51L@r1fmc%szWFWycI4Oy~lySH>K}l=jtcoOVeqG3c&$6hK(3~o~r5GZY+qgMq za~6$d8YD(MP+R?)*#<4LK{?O)y1j2`=V4i^x+}OI0}r*(Tg(_*z+8a ztfALCMhUaVOhV&UU7GSNn;Wyf@?5tFP#r}svAYKg>0z0R8;;$H2NlRSaNAh%G5tw` z3}O0&Zzj7W>!@*FHKtejIhn`1pN1*EqW7w$mU>)pTMc*L+$pCHt_%IV^Pz143kq{v zx^Qm`Ri!^|h*-LteGV9Y5WTb*(sG!KI=zn-iu&2OhGc>Bd4SWG_g}qp@aw_mPGTJs(d(5=M z^18+63rPx{*3Lr;2X>?pmO!*XIuc`I&)PRXgclA$u)y5VueyB|mLQDAPQ{LGr!z%^ zQ?$0C@_tV&B-lsserHd$>AjFV#5ihkC5hI%MD*N+_<(X2K)b$ddl*sWI)GG2udmmJmM=6d~ z44MromH8I#R#!G=+4$6N&*9S(;2AJhkkMOpa*kT#@yC|}+VqDl1IpCfwwAlz*jN`T zz^AlXTMDnPLO%Z-{JK%%`H7EG>qDti+%1ok;IB>EmtaA-0!&4}3Y>om&VYlvyt2CS zs+V}qdyG|2P;K+x=7u14z8)?LqZ*fK*GGL>cqi>U`9A3q3)*~ePMDk#IzkCfJba^S zvza2;FkbInAj5Pwxi7@4d_h0hPc-BDqaBLGO)k*v8@xD5?eZAM9pB>u$FI;}?I*IS zdh{1fW1q7l;vVr4*1JT`r}usJR`&Ww9#7O@>aMjAMv7kk6vndG3Q2$4NqN=n{4jG! zFob=h2|=N)Ft;_oRLAk-fYl7kPiHe!JC% zhlAcc0}hnfpTGo|39zRtX$Q^c?p3YKXK<{q078i`kz6B5_+b}a!lMg7ElG@5E`8kE zng$l3ds1C~#WzwPtg}Q|6yBasuZx>?Z+iO4`Ld{}yadmckBlZ{UH3&YZpes_Whk%0$Zb(cge@|e9zY1!t z$eVZth@4c(31#yi>9JV!Yq?Dc|Nb$Y5lTp{hJo)D%>QJOwNJ?87iH01oPJzQG6XtF zYVj@e3d#ODVqViwG`IQwLhcEyM0Cb+4m3abyaY`Lh9lR`0RTd9u+WP2L8N>G!)@Xb z7SDW*Zy5d8R(86_nb&NrmVWBT{gNQnOVJnHrzQ*Jmmjg3!;#(9W}XEGFH?9nar1q- z3VX6Hdr|Qx_3@iR-_WB=fr=80GV8z#3NP&Vl6F*@t_|tSgHcZ zh6CS@rp(L%+_2vGWqntca`fYbtUkF9r&+O5Wj!CoZo}S1>um>;_NkJbMM3NK*POSi zngTaBHWKC+Rn`k#1RAsOw74tSFiU=N%yBM`vFr0U9s0G&47E4;h#vzOZu3mpPI?^s zbcXo*AZTM3c=uqf%;PN9IqA~Sb6&OM z2ywsjhUC47;99gk`xyQvBF>S~ZNjfX#_=lh&ZI9m(5bw+HH)Q7;gYLQHTtI5J2Jr| z<*j9ml{KCQ!{QhXW`Hx{B{6!@vhAS^n+b<9&UEC4#0_7eBsJ$fPM~_`6Oy7RJqr=c z6s~jau0CP*fk-S9?~Ymi-GE=Z7O%x1I<3XB?9S!X3nxD!!%kHZJ-T@7Q-v+KV%&cB z4E)kWyJdyFcc8?=%lekL%`J~dq(tAQ4rS>9{BA2c20=BCq68W|Qb56hj5WkA1bTsV zHgi2__9i(aB^j~)UUk~~xA<*=C%S8r#wsZ+2!_2NK2@T-%@NR>sV`j89srvYwLr#K zFZ8C!_#oe@)Us5!EBQv#n9ZH0eX-=Ti;n4!be8;Z%#TRQW!+N9Ygst?z6IZaj;y+u zS3@m(idhNcm>Z??_p|HyjoWyo+oD(e+?TqYKCS?0uXOjk>g4*)&vaIV5A&$T9pAys zJTKWsU?p;wZ_nynaR?*sIvX-ezZuKmqT$ zX1&GKn4=Pgb(_pd^TUY8Rv4EYVR5w#mVP~+X3e|UPtYe{UY6OkXQh4L%AY)(UDq|z zP;xt*o3g{)AFm7DL)~yWQNu#|O{nn~ai$f}T=aAL5pnL%@=ON6!iFE{daU45}f2;dhxiCZcA zj^TLvvzOYUcmd2IGNzt*)GD!^UH#PCN{MDeC`{G(!dd`JUtyNI1b;&xUj5M6OMkJ; zKIh=eiMBHOv->V{X^V(}aff~0;V$hLJ7 zAsu6!wR5F8SIy@7uiHvh8+-Jufg~+c$YO03_yk-7H?*P_l#M~@V2;XGip)+`ZKtJS zH)M{oUtiB#x@*?QYHUy5h^=_D8(Ad{9VYcgYiXh-;z9S^vEs=udnk76q_n!P*;tFe zm-rx>weAro@e<4!Z`P_28Yenq5up=VyGj_om+{`u<(m0oO??GFfJ)2zCqV?O${af| zU2+X6Q-9oK;b6S5Shb6I;lOxCT`RpTHnLAY%e$qn9rD`t^H{!RT|m0Z+Z5-6bm{Dg z6YefLm_Jse2f?faQVX2(u~@Tf%Cmlm!xD4c1cm}KPq^?%r95qBJrvZ-vYAKTxFU|U*#`(0p;%->J-E^tvV(Wq%c$Y z?fI^50>fFHGWnY%&w?$|3`@<^!N zivjAWGJw5EX}+0I@!{px4gGn@y#A}+c?r7r3pd)dY3pzcXdZPy+BFvkM2I||c=kAN zM+<#R-*q%3LvAFxJDRFG(u;Uvn)nQmjPNmkFRI>z0hc~dEYgCNDcTsA%72`@W%i@4 zs`J}~+Enagq!NoU)v#j9>|hrrbD@HZ*?R11bDGp@4O@ljt8b%QP2k#EMu~0@C~a6V zlZ`ph!&{3dd3?LoW7i}pXqgPBy0VmrrR#58_MU7vb@Co9U9OUo`pfY*Bt4*=Iz&!Uiq`Pqp!+5GI&Exuh{;|Eb8YvcF5-E zXv7+_pZM%>>EcYM5blK|#l_UPJb&nzC%vA$Z)z=v6PJB+&)0VO_Fylx{S_R%@3#J8 z)kbrc-V6&Yj7nE^dM$eb z>R71A0M1=hUG9*?b3n~(-*RI9#?THQ@g~prU0ZOnaxK0u9}%m}V`#h4`Z#04U_bIp ziLl@`rZFLKpJS=lsS%_=M`FDiTQsNTIO^RVsN=}p~tx^_k7 zd;Ei4!7Gwd3~|9>%DGF11RBDv$jfRSUt8vT-xMy5ta(?K`DzJg=?D2%Nk=TlBYc2t z@QLuv6p$E(eGks_9m(*rF{a;UHsPR&Fum_5Gl9OeBP~Y4qR1O_yzil=c{`fdW82|E zgcO7sw>Cr&oh3eq-=d?7jlVOUdm)#mrt_v?s>P*_Ifl_M#Y=kL*fs*qX!-ptT;6K= zpg^)lD{k{{9OU9wh{a6OypL)3TRnflIGxQ5;aE}@Mh#xs`Q1EpJf3xJ2)(D*c-E+W zX^7&Ncc^U__2OV1DdTF6Zp`DGhOzx_&j_sn`kGl%n+|3>-;lH$+c3te7&^Jc3Y(I906)^I=`rh!#WfawI6 z+1#k~43RjsQ1KG0^AwKLljL3kqkTVK4XBA`j!a+GOFaj;g5&uWnkIq-=7GjoI;id^ zd#EOHI%C@FzIXDrnddG+olG=8vhwJ=-RZtZIcR(n6uH?aFgLT=V^K^zs2tafvkrUa zHM_s%b8=SwW|w}K`{t()sEvNhaLMN+=I`tP6k*AVN414vHVs)2j~Ag9o%suQizdHU zY`u>0Ps$4IIQ`yv8vbpJ7*~1-a6xC$!3`z2lELlQ_IC3fU$Q@YjoX%xTGDb*@xdDo z?Fg(b!H|c@5AFtZQsdaM94ni#2X6c{XJrVFGhrjO`PiAb+8+>kHmpH+!^H}s)kl7VY%nb$+4rur%R z(vOek@&6Y^R~gpi*Tzv=5D)?Bp_H_Aw-O>u=?0~9bPgsU-7O#kMLH(kjP8)`8r>TR zjN1R*`)wa~?Rs{e6ZiSmU6weW7wNN9+k&&igXFsAGz?!htKtvn>GDu+8ChgWUJXdY9>r((9Fr^=SIDZ&;X!nJ?A+P!8XI zsBz|!B!4NsKrQC+Xi|TuVb4j=YksOE1CnG5alaS@leo#uu_ekivrN&2OSif4LZ2sO zF-hce=!1gX?Df4xEin9E4=E8Ix6s1o$HRkmG* z2%1L{(VU<@r{$9fUOZhU1#fFusleL5J&+qEF(|=00&~T=XRNpT< zo6VuLq*vrD+#HYJa2>mxc+{2OK-1=&!^DY#ckF(OHPijE=n z8Z1}==htfDd89TnM8`cHNZ`59xEe+0p?Ize(AAq~QDTiPz@8%@9(Q5Y_v~=2Mc2tI z*?OJJuve=!{e6`LL-S3%-wm90DqUPfqK=$eeIENF=>1M%gm_dgVV&Sxi zHEM*rgQ&;gJ!e#o8Ufvi7mdi(Y3>Mszt-BLaSw8Li*f-Zd~J{2K+bo$Ox~j{wyr59y`Jsc3bLFM?2@ENF+c3b zUIjn=f`$1*h-E-U4VM#FY1siR%<*@}3DAfR0kqkj5msX(L;QQ90LvpX$%tdNSGvS@fdig7Cbfg;o4xm-UnW&=%wcOWvUJ- zN!!V>o*<3r@T)6o`{OV<%-o3rou0|Gz@qt8Vv7U%;Rfh%+-EHwK{#k`Xo}DWS zgE)_3dLBGeeLi72&f&APmzkH>fC<<=H7)`>!6@O*^6{xvrDTOa!D1b9gp=D5I&9?3 z&@rao<^UGGBxj0B9kdh9T=O*o+uOj+m`dLHw7rO7s)HKcwBLMs(j=5I;aq<@=fyJm!$ru z$FXuOC6e~)R|_-Dy<%at%lV4NSg#fEqrOEb@b3YvBHvx z-y>f9#`6>IkFu<|c5nO_tcgZLP_0hXS?<^`LvPVLG-zmB> zfoWZFRbp(NAfuK^m)j+Tu@<^; z8QFt^$Y(6j>^Mk)KKZ3`RkS)v*?2}qb^}{6`otF)Tm1g1l?N`lFcDU!CJHvQZKA#e%`Pv}*o8G5xHajWW!~6E>;BvfqwwQ^H)+7);4~e=4tZqv8k=`{ zXpZ?9FsBQnaqE5yXY8*@SAI@wJoe6Wrij%(<5%vvi{ozcR46$*9~xcM_ZY#nV(-!I zt+My?4T-^(_KottWS*m*OLglPheX)vkcY>%rM)UTDR(3;c2M8XZPo!#P3?`C(_#OH z%R$ThH`n{mo_8Nj!2Fs#z!apBW9A92$R{ozsBfh7M*;cQA6)nbS;#;9!G8S{xC z4aV(3$iFzETv5+Ead?$LhoI}Hvq{vFvlWD$oJ(1G6V$}uqIKXa+fN z04#DN=VLaPo-%l{PBWZETuX6a6NNQKV#9FE1 z(}B{XM5t25hBqbqzLDeZ7PFCkYVyv2Ck+Lq>ez#v<{=6!gAZHGnAby&9QaJ)bT!tz zD-#s*-lo=m^W=v?H~cBYK93B{(~9oeTxY@#url0oogB^3-!gF3-k$dj>{(LSALcPm ze{8G}GR2ntc5NuHVN{;|U!``ei|kpT?3Lp~cyYkbzG_#aOp@634o0#T@?^vSgi0%~%f3I^Q%J_r6$Gf`&k(ubM zO?Q?g{{L`9w^y3&o{SE_@?)_>^i56@Ys9ObYtz^SL>a`|xw;^d>q_0}pTfDk&4DBL zZ&SyG#~?Nx(%7LL#SCN7sAHpKttsVV#!!L+;Y@$`L;e1<%l{Xd-W4suPDQ$K(V?g)sKuZxTZ3!@CQ z8vh>G$&)UR6vi8GZl}Yis^WsZKB>}YSn!tE+L10S#|xmjUmS1Uk%IA>tFdOa|8N*E zFTnOqv#i-?o7eFtToL7OBmmk>YX$e&VG8GV^NZAz37mvJ0^e zz>HyJ{({w#!fV?m+X!uK!-rg!m)2~RMl14bLZ+diE#ylii238hJEdh+gsl9P2UgXk z(^p10Dasd2_b;}|@*@2{sVgn*U0_m_-?oqQ{5D-NP5Y+$TEep0?=gOcs3vHs4BtaXTQdKwkR24SgTmqdM`3KI2P_2mmpIb1B z1F5TorN)T9h)kvmM2~h;D3_7?f>L>c0vn~je7N6={4<$A5JMkm3&Nm6Vhy{RUB(^o z=2wIr78qlv93N(azVO$fly4u17Fejx5-OReK2=49)gq{D@1FijL3jXm_+23L9eLB zx3*cYF?$Qw=kdzwby>D}mJyFd*}Tuz;E?(W^h=fM^76)S!D9E48k$msX^LeIEvu;m zv}f&`sj`2XIqUss%CTIl@WZb!%?YwE`YdW2U?47h!L7MQsEx!;hNN>QjkQG2?mI_j}G>H!DJ1U>U@4GE3#~DcccMbD>f* z%3YMb3m^S&9?1isJ$zOMaZ=tKsZGo|Zg|Q7D{1b{a8deyi%sunmbk^a-Idc zT0ZLk)U6Ad9<0**6%LW0xaAN^Xbp{PiNtTu58uX)qI#M%?ti@z&)p zD+cfU4QFzQ(SJC$syAUri8nyL>3fiq{pg`6iC~lTGcGF*S#|2UKGZL1?_q_Cfagsw zD_bq7&=C(%5HXr(!%764SmWoqnk6eg_dIWKHcQ6lPDNS%Dmc4^Ig?6Z+u@cuEyTmk z?|j6&D&RX2z3MamNKWzo9LdJllRHh6jJqaZZ*C0+AdLdON$WN1{dho9Bcq|p1^$#q zc^iUI z)=9v>o6ry#8x5%G$ddu#KZSE7EU$5Cx zsQ=&x9oxNDAG|3#O=QnB3*8{f_kO8G!~_}VdGWEyD6YcIDB3x={`NC+8bb^z0Xw0i zkr#>&x$=&n#hm|F9rw;j6QxHPOKDg0=9H>&f|{yY%uc^|zLg~pNE6d3j4Jb4I6GM& zmC4EMJ)PEVAKHSS9K8qzeAD6st8ZwOn>Zc+PJOYJ=e#K6!FXC{U+DD3z?YJ{0ID-4*suGgd-6RERb*t8j3WELC7Mj% zvj1>CJJcTeLRE-E=T?<9c^<0{$8`R%-awL(NlWu-5$M{pL3eLg@CBX08H4~X#$fMe zWMdzF@zNo*G~kt z1klFJ{0Xl`Pe^poHe0dj_4Lk@_sOdYlLERE`H7i6Hw~W@tYr))JWrI7ZBy5T*TwzSL$5nUI(Z!HgaqD+--A%*d4#%f6n7P6f-Mt5M|x^o>31WQQG$wWzhi;(c@6h#tYd;sGj} zE1!(>B?-bo2gRp<3i2g!cETZ_j_t){{$nWLQdc`Ya0Z{U43R6?Qo-l8>-nMf~ z3W5WpWgHygz95WKHaFGJ(fUl~?S0EtjXq&?Q|zWeUm~&Ev?-Vu%LtLQmc&^&GE=~7 zl2vsg5~w7$elTajY|!dkXG=hBl#-un&wn^{auN>W(U1JB68q>e&;k1$B?hcFV;pCn zOv>O&umt@=9gbi1v$aWO9CvU6?K#fV1NOY*028B=8O7E_&<2}llwBZ!yk{*Ty~z^$ z!^4ZDLjD9DJ`JGoO8fajueRiQAb%x!sOtFxc2zBbwpI%-u|tjhSbPkw=JG0FnH|6jAF56e95w|n zBPR>SUX^O$J(5Krg5dE0nQJnPlUk}s#Xy4Z2dz^ADOAkWgLvOGnp>+b+{!;3fFA0fvxX+e}0$$DyYcyyEgaw6! zrIizq{2h@FRL(~aP#HwBnYcK8RWZ-V2k!zsw{P*cgiOIIe|Fvy%9p^7q*YLt?T6Us zqO7D@5|K9Y1`?U%C&q2Uy{Ffza+MWA)j1Qp;P|2w*z^SmLho4@7Ut)T(G4VhvIL_T zHV%d$x0QJsDlnF(kk5HbI{HDf|4aZR`|c;B1E#Ha%KbN6_7QKMY|ZS#bud(5-Z^YW zkt`AzQj~CQ(1?WQ&_L%^47VI&UgI}x;|TwF^w(+%4%})(rfmcjZ20!jsnUsQTNnc% z&BBk+dPaP~G!lxXVDh#`-J!9(Sl5t=hJVfm?54wd)P?MztV!UL{L@tUAi6=G*x`j> zS+4CBfvlAsA@f=~(?pL8x2hs@t$on;TQ6vPJe;cD*-n1JKg~}9p$KJu4On} zq&A;*94Rtz$;ZqQ{M-PYI2~yMb*7!qyftWSBld8|zWsUfzQKd|<0DqaM;5?CcZgwU)otWf96vZgp-PktXf(}G!8uQFF0I5>g0Q) z_)_-_1sY7*?2bgpq3uIuQXPd`Crm^0VEn3mvaj1K4%*#Pmp3!P-h04hHwx|AY11<;uN=o~?-8I|4jFf!m&?kSQm^L-H2M-n z!@b{asYJ^7XJB;U-}OYh-+wsEf8U?%2NC|!JP!1HXLVJKRRl%HvAJLQr*KFf<9gE($3-OJwB&KtrKHW;BT+={VZb-{*X#>+DbijW z0sk&q~xJ${+$@y~m4n$|_f@7oN%vPkWQY9V~s+34p6?zE^wHx|l!NDJsB4xOXi| z`u{gVAF%P12$y&HSrmZ$A3W+hBhwffvT4YkA-zr^`tySSOG7jNSFPlTWCd-l@$&1) z!N{%oe)3}{1`|k39>vZydz?^CyuL%> zMEpIWA2tcruZ+oQKT~+E4#(o z=SL7D_2|#2Sc8V9NoN_)t#ZJ>SWPi$+Ika)z;Mi8{y1Zms6I|Y?$*XBJ#3#z`E*jId3c3Qu&z{&bAQwI@Se-#_dFD4F;*3M92o=O$i@&LIr{-i zoW}2_7&bwn1up>PZFCh*p2msPOGEZ4YE$cHLJUs6LSgi~`qm%rzY^Z(%>`4*mV{2L z&wVizaLI5sAFRcfA=UUQR%=&^=S}^<=@;4C@d}-V6gEUcqP^)vUE~MksGX$0yUuZu zu{HJ+e@^m@qwo;4hz#bP^glkdepbn}8+Z z-aJaM*#_35u@}wxr)JXJB*%|ZFNVXx!j%xv-j5(++bV$-{)gkdzLbhJblkmI^qby@ zsQu*!?}ZTDTRBu71w~Yo?cM=xQEaj7XZHaGiF!P; zxe7GTQw=qV%6R)QV}IlNeJ2;PA#Z$l-6eInWIyGn(-kb?0(gfa#V+>t$xda4!H+7Z zLK37Qx=H>xUxn zrB0ywd5#}afc};7=rH0a5D;^*7-S78oi zc%c83OKl_MWJ$AKafq!??r^&S$zoun!V1tk5WU^9Vy zy_AIc`)3oIrp&o_Vwgz`SJu*e_nZ{x5&>{o)IOhE)~8(X(0#fJ-^UnoY=-K7DSwsM z2Z;=(`9b#O;*}}XI85s zqTvoqMoS;{)q_XuNH-YMAL;&}Ad-J0u^l+or70NXBTG&{9KQPUJi~lTV3I%?Ok}*}Uk+_%jxfstPBv3P>PL*J>hWZ_8ZrV1ACa}vUmVOEAnG)?b z6ic~KSvLK-q?>1I1(kmvfvhaDz0=$I&8^CPdYBLG`H_7CQmaRwlsbx2bRoC;`={jB z+IyG0hA4D8t&-e+$9b{NwP*m*rqe1PuudDfR|~Yt@6VSGeDO%Ft@H7$b|eQrLqjV! ze?trOrWdXigFKQ)KhMa_y6TQbxle5Ba<QPv3(-2N__DXf@>@PO~k$5Hiwb?T+#-=x>udfc;>VPqpENZnoU8D;+*vC#b_i( zWB6Jx_|(KiPR3XIE%k$zDrt!`y#4UcTwHE_w+H0}z5v+05BBDVCdM6Rh0iNe%cst&l}V z8tO<5VEkRIrpGDKe>i7xjKKuInp#opr8kww{GWnR&!|@9zW#>;b>i0q8uEfyDOV(p zYPPp-bPTcLF#Q*`@e}_|o=a{cnRBD6_#kz5UyL#+zd`R$n0wkipP^en{Fz~sdMg%? zk>j34zjiA8J%RAa0?VTW&mVUNp?wG)`kMO0rEKeE#woQ)UTwicYB%D3g6V_oy`uR` zu55cSwvI@$_#yrmHwN9}=O7n3fA{tlU^s%ZP>&I0%%*PdVd*?yce~x#x)(GeL|l$v zL6>HXRkn!9W_c1+{D$xzfUfE1m1ASbEbTe3^Aklt$C8^Y5(0QXKj{LicWTw-pMAP> zGQ9he0jKxcmTlwFJzVOf_$%hK)R|Y1La>xY=QBQ${e|=ed0)6M;Je)Hz!8KA)G^2M zM%Yvd=cVwDq^y<{GdV#c;V}#q18Q7TgEH484C{d0j>^m1JX}_uJ3iKUmh{FQN=$7& zaRos=t#3cO%8PDeEp|ja9&%v+7w<8Wm=%h@BiS`{>m}Oe_GWEc=0hv9e;~|Bswmy6 zO6aY~n3Aem980U~2N3PuB0~t9HMx1+h@`8Xp5K(gg@Tt^g$9=d-}F~9X@e$g_9Q_} zcK`P^J`^6kSe^%K%0J^b;cdx1{Z->{CK?$gR(Z*$%||?uBO68Gm4}r-HMdOUkMAtK zO7u_cl(D(++`?wmqyy~DEMAg_!Y#k^^SCA?n}re4UlP2$v(iN5g?4#8$fPi|CA)uA z2*+efpL826k-Nzr9p5o=ZmcEZxjVv%v?X0;G--Z%mem5;qVt3WX?PM_`-%5xv8$=q z;yH#EZ8;S9OC1SQulO#U_Yumh25mSM)$ z8DL&P0uy59fUHygS8*-x=r=m90NnTam;Yd$E?TRL*1gaVpQ=5u>U>5_{X=;0i?RSGk+Ktl|WS_NdKE}wr7@&4`2INOb47D}d&>DvimWvrF~Y$t4C6{r-i z(7r`rli7Rrs-BIfIy&^+N48Hh#C?yRtMfi@M0bv0P5N2VlKcO^D=tk-+nghQ_}9mL*~?|Qj$f6kvwm32B{wV zKDj7rR6k~KuxxIP>w7qB6MS&GoJRm-E+05C#Olb4jW&Ak+4{@~KCkuwbZjHH>00H? z_+&^(=pG+5iv#|$Zpel$pDsl>-Rh9MFhJtTxTC?T^_C0yKI?{W)EAUR*F?A+TdJSb zT9^Y*ge3O|OGXUKgA;0`Kbx_G8D$siW&2Hux1Qm9=szRY=Msd8&K^?q4;~NM7#6>r zUilhWrv>3rqnnw19{IoGKhroh;WnW!MZT+~z4m3?+hq%Qf>yl>`MXz(u0`a?3Tr@b zTu;Bibwl)^&$;;xNl&{h7bUv7{#B7S$kf|CFDh^QG;1IHyrJ*qNSl4;su4Wt4ke;VKx6>T&b~d zM+tgaKyxhuzX@v0I)*R>K>{HH3!$^hm&A6OQq5*Jx+IuQUa#!9-LR#Q$qo(d%ryS# zdRiwu=KWAwCz5|-^FDo}N^)F*P;R$=Gi7{kif2sgUA(v2P*fjxU5MgMBa3rBTVk8s z_ah7P*gCdpGoxi%j>LM=3G{1&-oRuBt4)h=X39yJt<5XXvXwRe%6*D&y0}eyl9H^9 z$jtw68qZFM{%Sr=>tH~ptg#Yc#wK4SJxac?Rod_%m%#YL(odFwtxm6>e{zxAc%jbG z)R`c%=WwF})Y9@R_X)7h{A0!zl?=2L6B=t_OQ(G}*-M~JSnaB!|6Zbuu(=amSU{1V zkf5f`W}oY~p;uAFMJYfbzY_ud!NKCQ*M_0o+wMti?p=N0+^s}L?A6*Bo(on-fT+bLh-!&(9(M};*hn6bfx0I+7DeM1C9_2rqpjY4c_pZ{?rH?-2FP$k7_M zqq~NM8UYpxxlf_O3yJS<LW%@pTu6-ucM+vesV} z$xGRpecb>}dw)^!HekKn>w7AT*zBNzsQROL10YJXtaZTi*Skml%a)d-8?c|N2_}TB zG52?Cx6hWo~O!eo=x26Oq-RBafi~`@u z2FyJqw;S8Rkwy2$C}^TD_kfkR)Jhx>#NON(gC>Pk7_L}*@5!ppH5I>WAHQ|qHBdcZ zx{jgjm6;cJEHvfvcmJv-2rU5YQ72ZQkAMw#((+56o8YAI*6`4urq&JX-ygdt^mnKt z2l^7J91RKu>UL5lc2Y#uo>bVhkO~grxTk1<8UWo%l+XZAg(#4nHqG<>#;y4=thP zdB}ow1}khdOz;YZy^JfbV5KVO`)h1XpT);ZnTB{f+TLKi2Vrq-z6Jd*XWnM|4+WrX zC2F8-)YioVH%V;M?)l!-+Qj>}N;#h$B(L52ny>N50_WVb5kcdPPdPKF)m`oyVQc+? z0qzN^^=vH^;|=rJ2oAosTK7P=VcPqe*RucN+|Cx|y#TFy^4)W1b%#CP##-lypB`5W zrks!KyFOMEOPBBKQ)m$p4}_kcFHISaueQppBs34Q&KGK?un!gdH+A3F)*i!_Twugb zJVDoWFW4E(RSIZq&EQ`f`ho!`VRGZ zM2aru_Q8VF&ak?iZ$FIaNY_5cH+}xG$I7{j^AvsT#Ni?^{xxTat?5}<`)UL&>IWr6 zf#=EDM-9KX#WwH@?cfP1S3&FZ?bUVZdx{WAj=87sj}UDkJ@+>>k|sreZh?C$}#l_=_T8@zKq^ z_?4%zs^W0vrCjM>j5KjY@B+)D76yk9p2mDsdW@Wp8Z-_%{d8A ze}nts^&GSGyvU-Rj;o7HhM|j1BTG7^O*IGcBfZRO$=Aw@x7#{ zEFrlCZ~z8wiHz)lMbocB&&Uq48(Qs}ZJQJpVsoz%Z~dAUaTxOh>sw6^Zb!tC+B=ZeXvv3B~^2#_KPR3>wCP1(L9faT>T|* z_U@hHwbxy|I?VX#PPZ4R-s4JpsC{%JmqDQoK07yt3bw2%4va;REnYuhBeU$foW3w= zFsk-xn)(H9TJ$nBRh;pUM;Dl>Q^T`O0@LKZ0O_940_Mvb3zW&#ubF$$9UJ)BLpmGU zsSxe?9!(b*SW;D7e0cGGX}j^w`;@vQDTHL!uCJZGr7yN^a^6hh5`j}Y>xMvIr8$9# z5nmnGPbEgmxS@LYy!Md*Pm9pZk3qjQ$^`^xIrYCi>wkm?F+MWlXNK42+OKw-POhuk zG29$*)Sr54P)nG-JFR#S@VtHH^0=oLK)#LCTg_fRFn>8omd=Y8skW7ZlcT=h`B<(A zwpU{>8bp2ORhJ^&Zl#)SLYNh7one?&z)$YYU)T`=2X~PB)heJ=dn_WM-0hkAO|ce} zC#U#r&j)b$cAgFzrB8gCAveBfY`h?$@zy2Cl&{G{A2X zOp7+om{epW$zSGFc=1YbCcqn(-XUoGUXIVNdY6di;8pgkMTX2T<)nG;=rE(5qw6W) z?aWj~&`fYm@E{ytH5OuhM&uU@oV~ZHKzB2l|A(Wc7N3~ooTMy_XEs=v)%g-AtD^7< zE)gs=Pz+{5Um!qaj`ZHU(WN4ShZeTo#Y1u@DL-xX$amQaobD^JIXSoKSd3~EE1m;A zxo1aZhP9d5mB=)hzkH#uW4zYhcJ;-cb?9S7vw@8yXF{_qzQ=z!NPVGeKBQegy-I0` z#lf8T^!|v*oLV_c#>$5(>*dUzx19u>0Kx4ox{no`ab9;=%|QC=4lS#GIeK)$axavy zy5;lB?15_uC!Ro$l9l{kPCGhKaiJGNV$(?GKb$uTt>15~U0o%Ppn17q)ZH7SLt_lA zbl*q+s?xW#mpylp_R*gUR!d4hnIz#j1GwpMa{E}$AfGF*_4ySJc!1{sO1L#&=zp`S z)?FKWWc4eeTp6CdSW##9w|<}&IUglr$dcVZEG_QuUBLf7GyBaj*}#hU4-Y~-3faIe zIr=&4X_g?BaTht0C|^LG9Z80yzA1RDQ-bA^`ocE7e97S{Q{S(C*8+s(`zn7)HutU} znS`L5sv*p)!y_sZ_Y%!=R|2y&_lsAO`<`)EU36z-;0XSdk_W9@V{f?xAWpAqm8*d0 zgOy$#KjWed&0!PX=MOQhE8t>DNlP9Q!}_VplT%jAXw1S2s~Vl2PygK?D%?p`+JAH# zmoPSqXahG*k>_R;PiMFljY4?8B{nGzGDCk=p9Qm+n=(bHyZ*{y$dqnxmW`4hZr%!s zpMmbK>@Ut@JG&HjWUL|ip?_|QUjLG_9*f+nWSe|D=6We*T)p zb6hHp6foQX*%YWt{!4qNJ)7oA>EhmG>4vkT&gce&1#F#O@=3n!)?qAnyYm?dtB=Ck zwP)PTzj58rse8Q}qEVwRF2aryJSPHbyq)|;|I#D@aZkKnQWO&`lq?(x3eR=zj;*DS0S3euvLPe`PUB8S8 zU@d)OC>S5X&=kGy9%RE;-<$uM$Y{fwOhu}OQdQ?@GjC}wHR$`-#-}eCSZSr3B)k5N zsbPIhB!d-YUj^B$kb_ldb=lGE{h;TY7R#{S;OEo3Q|nhCv~SRF;K+bW$tth5)OJL- zG)16WZcFyf1)?~?3l?R7bi}fN=cC@%8{X9v{no@H< z?P7CFfu_|q{?-eoP$6GNtKwqgOr=_>Z%$ HnIgF2c&J%QvYmp3AatJftnJ$}(tv z)Z4q2zjmUG$SpbiD$Uo zySkWKE{m`dZPZn<18WZw%Y+2fXZR3ma_l6l@8c2;a$Z(Em|!umSZu7&2toiC-P8SN zMeJ>MMxJb)ht>3`VqWn+Pej9G%Eg=@m-Y!IGo>{LD{QOH`tUd^cpiKCx2bWS zefoEwJl3qss)`9I`Q^3X#)wVSINS=)r>_{wQ!h5fn z50mUpzi{`+s9L5?9r2RM-YxxB{-R98{QU2K(`e7$^`|bEA=FiwVyRY+i~jm*$g0Jy zCxjz2dr-fM*t5mcQwE@P53^|9MHF3qYyBhgni{D5GqWGrS#~(1JBiX|Jx6exNDlw6 zOkzLT;S=ov<>}J7ryy%^F@l^F-J{gvJ%7wuvpkXW;_Q|46{!RkPwzQk`{Do?jr7q7 zOK6Y&*B4}0?&Kr92qb7F605bQ5-vYwN-VkO>00hFma8pYGuiiTY?1AQkCvFR#kZi6 zm#0JhkCaPdV|`}MW8*mpz?xLap+pKjDZ&Z4sQdV!)H`IY z;%smQv7bJ5iD6+0)uYh^i6&h2&yJJ7zxibm*&%6guDzw0MRh7fN3?!24FmSKof%?g zCi%CkTeG_n_KV6?gW7@Ce*oX9%2jhc(w{_2pF*^U3c#$$yhzIyG~|~8sVpar zHKyaT#L?fUKV-MrAOxuG=V*)}@!lH5b%Wb=VL<3EPmc9h#v2!s&4$oz8+DnzgA8$|^;IWTfQ5)!$2vH|RJd+urf&zt(xB z|7BrdwDN+2K*imx$)BAjE7!2$Gzb@I_im<*7-`VeLhvi8qq_J&vqeoY8TXCd6Gm@| z&w~g!{l6Oy=-k}-cH@$5v`yx`I~^D!37bD7TUkUa_hbXZ>qs(N>yQtP3!A>*n|}z< z4N9;i4}2kKD&Mid4<3=@NpP{~U4K?*H~DYXn!mbW+2n)%ykTRCk<7uXWU|Y5pfvKd zQj6~tD(+q5Q|V*e|J3dRH?SR?$h!q1vb75B+1u(ST^h^8XoJrrSZ8qK=CkiD?K)7Z z5&ZvPWJlVEe6HiQJygy~)bhN}RUSKCpmaqR(pv*ZFKi6|#w3`|f%>E!7J2+LW|2SE zAHkQUy(k%czp-}%{tpM+jZ+v^;?az z&K@A-Jo)jUSy-la3*QVbeF!ghxV?@PwLbx!kuNQ&D7@b~W2M3M*k%kH_+*}Zrwazo zU^wqdfMjM}zwNJ?31$oCp0aoJ+Y~}=GRUO1~ukN*wB0^}8 zvb{5JE%%TwS6sfWv=9Ms6xZr*L1wpO9;JFLiO^UNTN9qC0vi=On)9a&>rVe8@xoiz zYWt-wF3k$c+3Tme-PlVg;*xn^8t7=iyYb$51SolN>ZE#|4kYiJz=+bB5GKx}y>CesmO`+~7a|eevS##pAh-3KeUM3rWLH(Qar4PHP z^|&^{;uWmHF-poj5;j8y<>#BO;nIc4J9R6k9%>1q6uVypmvNlr-y z$e-{qxaxhRDmnH$%F~jd{_u_w27gUaE+C2Xz8ETf`M64?f>Z9>Mb)k{v+zQ{9J_KG> zN(Mev{}H|$B}&mKR55Kea@@{`LDGU~s8{Hg$0+%WpaK*@SN5LnZf^-nnS`==15?rJI=6(R*cJ zbXCrc@RG-k6;Q7yMnZi~uKNQlW2UFK;SqRiuFlCdZ%4!~-30rIWp-QpYvb8cmTtw8 zKfWOk*Dn4uE=hN^G6O2){=n|{rNLX9QjGik56{p5$mIm}GW|&DkL~Z+UNF~lF9t

w#hyEaQs>3q6qU5-T$)*me<_v~_ zQTr`dR+~iA zfCzX)C}|`~k?HPrumo7C1DP1z#$Mud0NWQ_2CN*qR&r_MNZRtXIwpzlxydTyhLGjK zihFZ~fhj$zQ)ibvvC3@m_~*uTZRZNMONY90R@_9L{i?XRAmT&%po1FCXKY6E*A3U= z48LQ`GUB_GSZ`_vswBH!Nme#%n%RRhw=9Sqjb)D;1N48|$moD!RL)i5QA1B4#pf{Y zJI~(VD<yJhq}5}!dT+^WXmV0iX;_ALO-UwA=(I=X8Gan*yi))lih#@LXj$t ztv!$^6v;}vB7r4i6A0nJp1h3Pse`4!-_uo`Nx9=CrLB1%42-JwGo^frNha{<{ogHq z-+0!KmQ_4}3ZG>owviR1$5t^kACSHqR?AG~Y74)&X8xN&(`@N@FD3nczx`QVa&LW^ z_IB<=OXWYPWxJEOK8rvm9RR9DzJc#~-6(GUz9?^}?p%O$sEHHK379xoYnC-IX{oNe z5Cv2(50AR-cYJmxMYiDx9%Y{Zo7d`%nG$aqi&P9PW5-xpf1Rv$;j($g>1Jf!%B9-t zkN29qC!b1(Zh$YX@a!o z=uQSf&@~z|v@Fs1U(fr4vJ%(S!vOMo-bxzVbQ*-=iAu0rnJV1|jweR+={Z`p&!?LA z+E}aj>IZM2DY2}Z@P%!MGm4}6;eTaac{tSD|DTwMFl`hiYLr`|WS47-nB>I9Id!&ERX`tuk{AE3MW?F_ z73xrG0OcB?#G5jPy>gn0X* zNHO6laiaTp1ANJDwS(DcuL{euTO}#R(amQc)&`;+_^Bm)57w{BcyUgk_u>hGzjXC; z-m%rodY5KKr}R#ZJt9@c9dPIGX6ZeOAVuE1%=ynt@2hh(L#tw6C@>j-`{8nYs@kgk zX}zlU(Z+%Y)~w@K`rT}&32DSIxuCfA9P`2Py)KoyJX5uZW8{rQBcuY;WJjaw)Ga@w z!MS%B>ds{gbPm|kwL0?t!h zSxwQ*QA{vDf@zX+((uqdPLB)^UH3ZCU^Z_!V@&Cse4FO6ahURa6gtB~Kb9G7CX&|+ zBk}F8@1QBBK!0pOBrYY*FwaEE^QNYVTtjT>HBJBI?7bi#YW{w8gPAMZ9r79fEnzKa zMQJ791@<-Vz-0G24fD_c$O6P8x98& zi{B;hQ|~Zwd)h05$kY6*^Bh@u7Aoe8;Mg)t>+UP_a>B@WZx9^G*%zqwxgnfZ{P^Fa z>X+<&$VrJd`ZTAVe>Sb@g+?R4pnP$1q6>Ti=i^2@YPSVEM!MWT*ZDj~dzdw#RsSI^ zz|!TnPqbX!+9mH`^5+;ar<13^RbFaTDxbz_V7!lWw3GBGq{W^Kon2~;kF8R4CcfHy z3Qyfh`g%#0_9S);JP60fN?<&M}dtUG_q&y7_8P%G?7PEJ8&n0X_O@6{k`9$^rq5F=75m%$b*coy!r1=g^ zol~pC#C|}XI9y!X`f%65h#h;i5+e`47h$G;M>?4&69;mgJr<7|nA;SnM#PT=)3Qv$ zEDo$y`Co0A>(RE4uwYNcQJFx>K~v7`XM#e^C2Mg)v}L(ZsUafpFytk@B@A zT<#B@jr-`5QL1Rqbf@LXx(|IWt&=i?p$yAIx+&BE!NY(X`!?;`Y{Dh5d+GW5Gx?y$ zSR8F~Z#8!-g~uyxyHYske`CV!>+MYM;KwbctsQb}@W<=>DC$)sW1|5a;`ey2^ z1C(DFn5*nhIki8+Y}DYr7NKGBFg{~k{99K=_1!I_uXyGsy~Z@qk)EBw{-zuXqT zST9KB^APgt=h%AA8D1L~m8#Nm)@8?P(wA^0)+^qWX=uiC_joQ(U2d$o~ z>6tdcmZ=)0^IS{|pi&!z@Z^(i-}M^}ckl4WhknU^;2(n2DfX#JxYVgY%;cA1@IRm4 zWH~r`oO{nHzLS%~4#rRI=#pAwYQq$<@%Fw-Fj-TJp{LoW?oq9|Ry~~WV;5EARKtIy z$iJKB2wW+m%1WF+!MKfw4WZdgSQ)fq-S1Vx`xW0NvLl zz~)S3z|MK}R{m_;d;aN_(IGGI?->tG zJ%Qmz>lz|LTYjX$R==qu`pedKMJEf@milPIMj5S3k54roSYI$TDlp7KS|lFIiwmqY zF(`~8xLj@$Q^F@NRuXljq;H<#^4CSx_)r6~rrq$Tw=LO+rHGm4N}}-6ss#M~?jOJ9 zA+Ox&oXqIB%wu=?CptLX9WH6t_p;TW__ErNU6_;@1%~DAX}7BhJd!(;t7O$|22c2= zDt5Hgd=cS%bKe)^=@;bdaj{XX+K0pWdf{;jTqu?;VSTr8t`U1={Nf+j?Z19&NtE}C zZqJuavTUBXdoSQcWZSd_u zh`H0fa}U(4bAvh?r>RCGk=85)@L=KrFt5r$cBt2zBTv}VsW9Xsl7$--u!CKV`iPDnEGaMK`qVWW(D8L z!_jI}%lKc%Xeb0cUH-$|i@#;;TK5YI%iw|2S$xd2<4G1H`4{oXz>@Ye)5oJ6f7!3M zouyi}3s#cy15b8OK{$C4eKBaFJ3}v7FD*>{_O8lPQMqg!JZ;&(PthQxf%V`D*E8CPI zn`C;NEFb%6^w$vK?R->k)@t^Bh0`>Z!Hh>^@7{G^GX0&+BX>0K9;^#OSeFC-{7eUw z5d2>nOX z(ls*Q5-OB+HJzqY)ovd$39F}mDN0Ylvqm{)SBAVP$V zS{8=}&FJ6>E>+RRz3afH96d?iH}HN|M~}_K`TG70mAqyE$Rd4cO@`; zU`_3f=)`4y^Q{QN3IeJy1?_4?y2kgFz%&t91`keH82$3K*7}-R$(dn&ghAPerA6pf=T@n0PUeKM-jG+AAeM)XzdF zKs9|_9B4xo0_a(zgV24*vVH~7A4p(p0d*|`Wm_i75<+;Ez&5up5Y}fA;3LvY3Iu7Y znFg>~Xt9*Jz?O%DsBSKoz`XB4a>Z|wA)CX>wp6hBKgl48#{)7a)7VA?KFH}5M@eAU zbPUkY7ZSsDEFj*uURDVyWg`W}rVF~S;UOnH?W7Ry0j<$I0L-}(ND^4r4TNA-L!e(lmgbNM zKR=y8V!0&IBY~SZ1me_I_klW9ggXsDiV&P~tBRz9e~5L!M(C|ooI}ZEfVO!k_JWgm zpUz-${rY$wWIsUNqHgZCkcQ-q1YHGxPHSw+`xDkj=@Qs^VjKqS23C$n%7PzlMHOqs z9jKK(gD7?#3BgGYnQ;Kp!^90bP%DilW`2vHEo*4N)6i%oM$K z!0~y|;Uonu_?K|19YXNmL0%q2>TU__tp5T7gr<|l=Y#R+$$k|3A7D<=3(^e@y#c&= z6OCK^Cu4aMwLaiVqw - - - Xero Java SDK - Sample App - - RequestTokenServlet - com.xero.example.RequestTokenServlet - - - RequestTokenServlet - /RequestTokenServlet - - - CallbackServlet - com.xero.example.CallbackServlet - - - OAuthAccessToken - com.xero.api.OAuthAccessToken - - - RequestResourceServlet - com.xero.example.RequestResourceServlet - - - CallbackServlet - /CallbackServlet - - - OAuthAccessToken - /OAuthAccessToken - - - RequestResourceServlet - /RequestResourceServlet - - - index.jsp - - diff --git a/example/src/main/webapp/callback.jsp b/example/src/main/webapp/callback.jsp deleted file mode 100644 index 75792357..00000000 --- a/example/src/main/webapp/callback.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> - - - - -Xero Callback - - - - - -

-

Xero API - Java

- Let's make some API calls -
- - - \ No newline at end of file diff --git a/example/src/main/webapp/images/connect_xero_button_blue1.png b/example/src/main/webapp/images/connect_xero_button_blue1.png deleted file mode 100644 index c94c88f94b230764703b28b115fdb7167cc0803e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21007 zcmeI4c|4Ts`^Tr{AWMs-&8fzkWXxuUnJihdB)d8!%b0mEF-vCbMMVphHlmaw!U-v& z2t|=COS@1=QkF`|n(s5@AxGys-*e9E_kDd|znRxdb9LX>^||loecku<+|TpJgqoWg zhzKqhgu!4UMuvKp;CBT0w_1P?{I|oIv;h2?$27EM!C*pSoWEJHGiR5=V7dcTYa6zW z$tEJ1K~pAC7|wvQFO3O$!(i%KzDyF?9bm(q0aq$rL%JugP#R99Xh{EtGeMa!bpbc3 zp}!|!y!*v;+034@`Ly%DzG+dRSjK--D&}bz%28G5V(I_N_fIy>(Dyl>@9{&9!ttkjv z>YfxAqNSex_u;_*X-K=V*-Ro5>Eq+0?1NQic)B9d1Ofqx!XPmi1n7Za`O(=VUj&^c zGcGcrqX)3ao>V5A%AmtJx+G_Y7h6MGnllje`F>qACNvP8^_?9^5$Q`}BGJkyRD_{U@|*gNP+G%3bCm!Khfdz{1gJ< zOZ`b0r)NBDY)y@)S{;N&)b#{NY=);bgW;h$zFf^Gask)Xg)5kl$W%HfH*3_9)BPt` z&7>5dM`8n-;HpL=Py_@@)f%lr#HkXos%z00A__G{WZZL_h6#g0b@7|fPyq!%8EdpE z5rrmVRinVinpSf(TzpsCBC(*ZIY&Sp%V?qvVubRntfI-JS>na)`MbRBghr}TJG z|G!+>`1Ssn%BjR>TmhUNWnw}!qO;f}IvFt1(*zrosZ&D)iYft5Cb_7R$F|vz;gebTF0IEPdvU7rcWDYJt%k-?FeEYxp{j}_Aym+S z3qp;8CnG2n3_u|O7>bLE+Jy9!@IOeKc~ZeUD#>Gt4`=rO=@2u>{9!0VDhn)Mem}0I zvAtsj?D(v`$WIa;uCxQ2&@f?kN8u{O4o%xB>J( zE4kxRV_rWOVKH3TJ|s^-+Z9|B|MpfeF8O23bnSn3pO23?kp%|b8}R&3@&Hy!u;#Hj zW!A-$L4!kO9V~xv5|imcC6hP_MtajJ-w!)b&74T~6pjDGYh{tV|K55-lT-i#MO766 zpj9vk6%_!5Ah}@hV8KvT!%!$_oGKnH7=K~CLAPf-5vNAP;3sa+|E2ZD+27+slif&k zSAe34oVcushX1Lwk?|xP$_0%e6VP~s3I&HjkWeZr2xn(i7aYzRP$L82Ipgo7ZQ7}d zmo`p)|J#-2-xL#0y@86)ME?Fem4yO$QvZ|MGG&$!Ciqx2{olFfzh6zcI)3rC<>WzV z?708qX>8&U`Nz}S#Nl*&Y3g%s)tsjVaOwS<2OY5VgOAh18O~d1E(__j@E`6K-_}PXK7nGtgMj^qv_bZ6_nKgsFj3I=%;v zADE}SqZ`Z2cq{k@5PbQFgx)?*NgA}%{&{2aivD?RNRc-Pgn}D`hl?9ZkPi>4U#6a?D6i+uFCj^K1ZH{OPVzE$q6?p2z7cQ;&tr706V- zYh1E>mZZ|GaFe+3Bj~##-piYV-Ro;~$m@<6nXQpEnPa+KN32vWE`7nXe*5jgs|@cf zt&}Obk0`lSJ7>>a|BS6^S$UbPp;BehwP_S1dUZ6uHCJwtf0c4;lRRx_HXiuMc^l~Q(fpIB%9$S*n~<$fJX_PI#3 z$o0T`@Q_vZS2nyg2o3SBsT)2|q2T(qzuhGxmYzttd@EKU@#W}}FwLH3QKcuP7L^0Z zg3;o~fMc@7YK|s4_cp2sZk=1yEMUN0GE z_q`OT`Lgut)-ygvrSlP@V)R}gsYgY7HN`g8efu)vmynPjR-96IXt@0LQ(;=#Lbq@0 zoAO%e`M%nyJ?0Az540o<`(rkYcC_u_D6X>>ms{*E(qNNeqkVAMU{+pG+OTc2&-EqY zdP7;|?q7X#s&fPw-HTJb4`|B=TR*d3KrQqQNcz+jljB|;l=?N&{8|BXz|tdoUi9XL zxp9vqSNuMEO^TMp!}jj=ZxOp>tj|2%+xR6Xx@y1c;0c?Eu2)Q}gPGcCFEn+#1W#%# zcKE#`!z$K4(nonyFaCIEmv}5YtOT;VH$Re} z^(${#TbzK}#6 z0Qyw3zdSTfabl^@9bRd_z-yj+;|`02gvKLAv+O_L^jO;I>|>!USD>&InowH+@Tb@@#q_wnA?=t_?LM~bMh}= z>#oKBQh3ljPgo>;K70Nj$IeUd)%x_HE2xp%PNb~6Pv*|=;m{#aV%7$sCz9~%4{`kykNhbd@8~?0R zfPp*59i6%(Atmy_(QPd~T36bel=y`*yLJrBHW4ToeHlgQX6Qz;16A)B1Lowq*o_X! zx#jzwpf=w@Rc}^7w*@P{E4IiMpTA!F^Ya3M72+qAN=#$omCh-Ct=A=CM6^#3v)ck} z7yHrFtWPg7Rkf`Dl~2lM&`%??NvpK3`n|S5--Akk9vf2}6)fyy_Y5x+(y;}3TzBUmMN%q||TT^e- zidj+$-U=SEXNs9Q`#{CYDpv2%JO|G%#re4G7g}qIOA>_bine{~Qk+A(dJNq_BUys` zOEHs_9D@_%-@9APL~5h{rOeAUFD^Q0_8w3e%n%H@;4ujAUh(#VhyVOAS&PpkiPB-I zg?jo@q1Wz1da-Oms%~-J|zFaARa!KmG8~>TzsXL_vy7#A|X!O zf8S@s^PW^*Y63w)f4t)bz$&J|v>9z^^qI!WbZ|%?Q$!0b z3u_nYaddNed|JQU^)*_#cz*7KcelhpHJv{!RbMMbDjr`3?9Q=_EVZIoVH!a$ivgO9JJKx%DP4V`^+g#)HWcZ5wXH!Mx6%DN&@-XQ=l6n0VyCOdh zv0q(jxomu1(dP@itUD@8*Wmmq!_T>{@7`Li3h#5fuvc6t5&P+&;0@Oxi9+Sdc((q^ zdjX1SZx$>H6*T=tC(Dgkp_$$h8zH)4fSJ^eWQ3(Pb$=%MCe~MX*TZs7#mdABg>Q4O z$nyEzwID9uLg1Gx-d~GkpE}#w$(>ouO5CLoquie&wBJ@;{hUa#x>9vk=B~3*jwaRQ zV$=e=wP#?y%w&G{xvGnGv((IAoL%a0rR>(X!TQ%Hv%F5_fu7jR-j6AkoA4j{Gi+WI zP=nR5>$J2>-fdeV+0r#nF0fkX=)T7{mBUsDu5$Q*rSA^Dm$G>0?{|l#R=(Rya=6t{ zm*yb2O%cHIU+gfq_6{FSF4$PR>OowGIi7_g+q=|w#cDjf|A;Mlv@PI7`9SkQ_PaMn zZy!FW6*LTl<@BU}w30ad;UwCDFB$We$bTh^nII*Q`v86@G-#>DZm}wjqi^x8F4jANr_$i4#MKF1Hen>L6gep_f3WLccm zDSmejSz*on*XMeVq!MjkmaPqyeR@t~i-Dc%O`%=O&Tik{Mu{o;{p6Qhtb*ew_HF{b zqfebHl5AhTUciAMDHP;>={2Y>dEVAEy5dQg{8nj;je;0ktXxzF6<^@vO#O z($(F|_UYoTItKwcgG*za<2u9RLcFvsp4*!ClVh6`3XjBJ%M9_l)4gs#3V*Mt#Ok+x zU3;NIrOK8iVtkl#pd{`7rq4FdF@yux$=K(9S5Gso&6XEzy{=I4&3BK~{7Bu*UO%^t z1KRj~>M=!iaVfu^J!iImL-Xb)!d%FYAVt>0Hf2p@fdU1eznCMj67}c4-@?*J0POlW}fQgWa)hXDSDo z5lgPj&8uWsnXrylTkooN3)$Ur4SRN@bkL0o9cnF#GS9PVSU5?#7pdC*;anVbo@C4- z`;3o|Bx02c4P{sM;!P__7P0(2?@LA7&vd*#Z4`W??6mKrx7Z*_IsVIP=Bql-@0D3} z!-l0d(7ZQq_n@I{{MY^99hYEi*ZV2(R@1NIzswmaRpq}qkZ?6J%=c3)+p80WB{V*$ zh&1W)8ZgDO_;L+#YpwZ_@WPakHwY*&wgU`% zp;~0`nl!?0_V7`&)A(IM7qdxGjyoA!uBb=MP0)`T?R7k4k&{}|p<+XV6_Jt)J!`YR z)te?`uRu>dzeAG@9+Q?~%EkNS2#cpq1I;Zhu{cSs}YCE_G=IZ7#I7 zNUPqKvDj>o*}3KLAb2&j=xNE_VU|T(gI}aA9njQg7oF)EQU)w zKCx`%N$a6|$7+q4H?CzwlMQrD=M*ZYdiWk$?21sa*KkEQ4D%tzbU2 zUiFs`B=yhUG^c(yyhe0Xa<&Ss>T=_#_y~W{VB);T&&eqt3+011ISN^BXi5ByzghbD u{Uu`MyZ3x6`k*lOz#{;>;=3~{3`;b6@&t8xp#$e98;v%Y>ZR*A?fn<%;N)lk diff --git a/example/src/main/webapp/index.jsp b/example/src/main/webapp/index.jsp deleted file mode 100644 index 0cce71bc..00000000 --- a/example/src/main/webapp/index.jsp +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - -
-

Xero API - Java

- -
- - diff --git a/images/sdk-configuration.png b/images/sdk-configuration.png deleted file mode 100644 index a781b18b8dc2fff34266e948d7c12939fc695de4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 47343 zcmeFZWmH^2xA%#L#v6AH65KU3uE8a^6D+v9I|K{v5;V9ItZ@<~KybIv+5AJtT%>$MAq_6Q;>%d%NHEG4b)iu(3Bpufx^!=`$|W?V=d;H*&arO9 z<}=33oq(%xXPeX0jYQHyFnz57Uz6_AGMzqWGHVuw?sl1LdSd3vCiLn;0_=xgG(Sdr z`lH)@Ncbk62c-E*?W38Ly+d!}zg*w#wc}*5JI<+fgd;p|o9HttB7s$?3~Nxg*CFHlT3Qh!aij1 znIKw%CKo5v@Uw#g9*d`01ODvrdiXuFXXNL*jeZ}`cNdS2KYYc)vx-V6X{~w!qFZR# zhS5?wvVtCab_AlfNg7q?W$Q&K;n)LdYo%HBMBxj%aYA9}oMkk}BFBf*IZkrvw3&X> zI&)c}{r=rQmG0ZTV47L{4UsG`!-fBr3rvy?GD@KKryAmc?Z($3Fzig&0>bixNnsdv z!?K+aVK~39HXWP9gk`u0T#cf`M~V`EhsVo@bq%Cqm+DxAlUa}Ezd{V6M3W48ABf&c zi3jK*t|hmH^~#4if`y1N@WaIg6FXvOzfxR>YlW*0S;{B53W_iWdNwLMiT@GxpFGCuNDmgY0>k6c`Z%|za$ce16je6oE-;~xa-ITms{ zf|=<~sVQE!d_GNDQ+vTKRtX;k0$Mp{Q|KkyDG|Hw`wO2|kq9@hQ-YPe+hBpJl&qka=c zs-$G}Q$6l=8k2{{$=787p43c1oBG0Z)imP)&q0}x=Bj8eLmrJ0Wq?|jyuY}ZQjac` zIF)>X!bV|l0`)spqr~#`!dAWWMpN)60j(QtxLU_Aj6ba@jvtOmHb~h@xlAERh9rZ_ zCNzZJe|~@SmAhO>Q>ucv;#EbpDyY(1(aksUk$On#Na{XDiOoCzRRvK+SXq_&+pn|b zyyeveCsnK}B4z&X{q!YN``*8n`y#vbc`%*s{gh5psZNoX&Lyp4&|rS?#5=3wMr0Nq z77CU+%`nZh+2rOR_g42f_mCSivO)|4da+X3QbkK~Ep6fk`|DtE!C%PwsSHrIqLTp0>LuA5nB?$Ul``-2WNNc}tQ>~w*`eJW3KR=jmqi^9m zguq+Jvynl{xv%p{#}=FpZgoBnWLQWx$+XtB6tpd|+HpuVoBeR(9d+_Koz^GKmHFP@ z-YnPD(ENEq{AceR^-$r!W>s+=?Na^dMK0dJ@W{uc_YE^7HaLf#hkdglyc$_BS$4d3 zylb|{wqecJ&1UXx?se|l?(nW&-atS4r*P2V>X?7h6Cz|BqZxw;qm=B~mD^3hUFhV_ zw7lonUGaN)ne4_KZ6!P$8$_8%w0@X9s<3!S*XamZ3LLAyD7TBh1rccYkb>ImwEeysP`aHpzRmLjkbA5>@@H^Tv!5#m1$~U0B zIb&N#6-S-324GCWH5FOG^u$cTkc3F+x3FUjA3}RVRt$%jgg9+1Rg!a#U$5)go!@+v zn+`8qn*2K1vA090uOO-5Hu~Fnd>fJ$UtOz{*isl!+%sI6!lzYU{Z7Ztsp;zD>;YF@ z`uz9#tvVx}pvrf%A4s{Xh3tcme+qZ|4>)b(It^~-Y@%-E(eu;d(sjtXzFSV?A9UNm zcNy|J=}=qEqRA_IEk}_ApA=84Tq;?@U9_ograpeTefQ(>hC8;gvXML}ic*<9`6QuB z#7}&Wz7k)oFr{z@&8ui*AD1LL0ElTRXqjs6uZvT+qmXKgFH+%Bb-qYulV|B;{?dWb z8P{2D*E##Zau~tK&Z}V?$~$OhyHwP`;4!slaXQAM7peETOTp2s<>TaZe|sB4)hfDH7@H1 z7v1Nd^nj4Ssm}6{;pJiC;hABN(_`fU61_`>)PJ-!a6l@{oR`z ztDQ;9_gL@AM5Y3&t2C=v%bwjo1=yC+6_s?(RyW_YE}pNrIp(z5AN5D$tk8p$c;~Wa zwYcB#;%38@_LmwyV?*R$tie-umV1^5;|Dn`A~K+~H2_bwUAEOGFFKD5-);6SXl-_L z-uXnU!6@EfqD{qJbz}2HzF+=ZS_zw_QLZgsW1Nv(2j{Qmw&RVNvWnZqkfrwOdxLhT zmBWV_4C$e55+y#?W!F}(XZ$D4DZ8bm*c{%RUH^vrWBoKctu3)LVml$_5m^)_tUiy!c$8y`J z(qKNc1q=hy8^RM`;)kmZfY0w4ib9dDxEH3+cBtShGr{lX<$-6T2CIH z+*`f{a0-~$*Y8GoPUJ0pA)WLZU`+wMa<8<#Qg=Ihxc2*zSgNFqsx3Zi%M>X7DmwwDd&vw&r4TmX9bPm!^DxO0 zaqRl00pS^E{Q6fzJz_ozGFBEW;3Fc8wMZZpc5x!%ZxqpVrogI7nk@=!T5X-5Gt@j( zRdVN7S8t0%`iWrA?2Ns=zgl}g=<%4|z`|5f>^xi&4N&^kezy&8>(uK8ADqJ3BM3fI z@|i*t*&J&PZC7nY1wk_hJ64kq4yNX;o_3DV+!h8#$Wsvd*3R73gwoT_*4{B1@MHf`kZ!ZCB|`M ziQQvK^}{i~iAG_RI-;gjltkF445se9g%%(aN9RcnSe5HCb6KWM6L(I_^2+^i>ke){ zZE07(%|eJzmzBd(LBNHT5{15O^1vZ)UC-h+*3o{pZ<62{(txX&x3Eo)+*g8i7CCl_k*j^bLN$x z+l|ou-JMFw)qa^~N_{e$)(yLs+wXqsMUOr0bhEoeZaLH8BrX#3@$5uwI)$_Td&Rdm zzry6xwmrA&Y2Ua72BdS6w49d21Ziz+n}Q{;Y-cW#DSMKRL(BU`*iQ@~7*n|+GH>|r zgttd?Grp#KeeBO1>Mvj3leEayi6C7e z_nld?=*s22@azA)e|VS(G+d$naB~|RvcH>%V|@X>RGe!*4ot);vtA*d-s+tD!KO;R zbYA-Ha)ctun%ijWi%fh`76-id)ON*O`OvMz_U$cb^^!0glj`F^0IK=&_)N9*0Lo6v z()&3e7fHQcX^pf72}n{c6~ClH8#=8 z=NXdnHMTGMD z5QY7zcOU=`OCHwIWOGs?1i5+Rf?RUUmrJLT=3YdgDRuDzVY#l~SZ9%8!=h#~@FQpXMXkK@SZH zD(uQi_nm&@Vh1-fFm0~)jAMGu;h8fPVvbZoiuG;$-W^N1AGIndSAqn78Y^s}nvZ|x zFf>s1%^>K+xRrq3PatDabMbpOIqke)?{_c1d8^2~KPcpduRg9_9+6<0RHoG!enH#+ z71}c@BITT=nZu+0%B1q%+5C&)lLYr+kL^yl^$M2Vl1rfQ-b&un3g&lu6Y+QBgUPSu=_c2E=DCXG$M6%JuRe|pZr0zGt%=6@ zv>G2$=$`B2b3gdrrS=nix<3>Vm}{1L&G^13u!>Y4D@MzqaBBCbIxN2CstL}0w40vw zOQKnFY~9g=Gzo*vpz7ztu3kIBVAR1@*$Dz>Knb%WvnD0m6Q?)I@v=wctD6&Psf*p6 zF4l?P8K~BMvj(pF!|%l_CF3eH2EI;J8Y)^7&yrSXVop5|qwDQA5oD=Ar|SL?mRYfW zNap)8rE6f%D}+ zmEL2pf3%*6gU|w7CSA;FlHOTv)G2PA$zzfKcx6^%vA2devR@$vj!7_y%Ml1j1g5cj z?0+P_87t+@d+AL%98h!Gzu-Yu>u|ZP))4U7!0w5LF+uh}l49aZFZmF&E;+G#>XDBc zq-DE%s9E!7=o}LcYtR&+ZMV=AuXYcaisITWQ|Z#*!Od`@p~Nt@HF?Wy#_4zKTLVwK zt6pMjDkAb=GOyj{{#urC**qJQ?5&)G@3Jy8FF)WG-4t!&Ri zy)eG^sfMbxg7GdA@g?`ucwD&1iHO0EdwWq_7IV!{iGGh0(_-wqS%IQ@L5}WcDS-vS zUKF=xaV9Yw-P7@4G;8${2KEDoh)-A+m?jp}%0?3+w)O!jE7+9m2dYUgDSn3{`T;5R z1J-9+EBj--<1vS@yQSj>)C2emgyN@74t5n6Q@aMpLuw_mCT}fP#C*aR(in9U=rEtc zOE6yIhVj^#M^|-uzd~G6D@*dTTIQWqr9+#!NwwJhAM{BYC|1A(EZN+j@D<7J8x}`R zTF|XF*Zr@q>2quiJbWsu^p$z=3rQ!ZdS_IPycMv{aR1~I!wOyt{8*HH_7hqc3?z?x z;l{lYr_W88kO@lOF`4j6;-?uEmMPtrp1z3LylKcT7Ov;EZo1h|fBg>M0e6%jr|Msy zyhi2=frZ5Zm)4eyBWSz?ka-c~DFNXOc*RG{XPmJfgFr&q_30?EaQChiWj|nD9=26L zVHrNIRB4-Sh}17L@-n>6^o7Kta$;xF0(_Dq88UdjhuwusIDPw?czXBs!L!oax=n72 z5p)Fz*dLN{?7e{&ty%#0)K-^rcHiA$1l zcGo~~BD*exzZXQ4fJ#OMw}uyt-+6k*p{L5+Z>DTu7!U=Xs*&+)>olMGh&2-**b)hd zfe<>=g&xiOBxE+e1ZFnBBs`!IG7QA7ttFOx1i2?EZfL&y%wKn1s;JE=AFTWNGr_)OAm6hDVvyd9MP02! z-^|)ca7D$|jB~W8Ei|(g;Z>OxrVfK?eCx{<4}Q7B5oFrPIxKmV%PLs%pq{nZh^OHH z$cc2YlJIf%6q@?Xr<%A30urC-h{?c6XX1j=X8jH_p=I8_C$Ge(g@ijB=quI(@lHj( zoIj+n=p$M9ItRXF2%j&Q@IGH1S%0>Ed4-C9r`9tefRWjN@@}UU3wXBhC508iu=yFS z!Qmi1#Ie9Qk$O})s`uXdNAgB!SdjNcuVkWAO!`fwo=4A&Al-@`#(Y|0sY=e|d>cJ-PPgZQY!+-6&d89&xWEA8n3 zPa^o|`Wm^Q#n-Cm>Zb^EITO+{wdNw0H{+U=;U1ZKm2@i*^v`(5CF2I~9Q-btB&x`S z-6l+U2l||0OFFaDS_ZD$-bD`bouh^cSadUgMc6=^b5Neei^VFASEiq=dF@P~PZp~f z&j9BX7U-W!p!MAbtb`R9zVei#wclP~7W(6cggg2SiK_b{xJILdKcK?kI?CNx&EtdS z5Z{K8`|+E+8<6Uc6BvXL;g!{7Hu$r0k}lkC&ZbBV59t&yq0^3EpQRP<^acgO!4*S! zDHHZ=R%78JVP?bV$$qCjyXP5j0d4edjn+jC^{E=|#Zsa=-h z_S;~oTAgoB6~2a%^(_+c#C3UNo8duBFab~CJw~xOeh1qBF{m?VTi&l410n$3X>p>R zy&dc^RDDNSesKf7I2BW;6^;%9R zMmpL|AexGHL;4Fnx=6CC@Q29w$3YY7-xQF&yTn+^F<4d+_)Voi>xT!<-OvTc#BW6; zMac`4?JkiV;;ozCGk~Zd=!?QA0NMPk0s)W1>8y64pH{;x^1QLwIhdJoMs*H=(@5du zSSCFgBzz8P)wVi?WRV1_Mzfc-#+ArVn+5p0%-=Iu8nVOPzDSS6^(Gw7RVv6fo6#~m zed0NB+5Ikl6BIh@ym7p?OPhez0y~G?$tND@yD zT~ly>)>Kg2O*x>I2u_>7Olm0JT;t9c;}AxaApP!Cs5cFTl9|9Z7=1esn!4k{#*0G} zOBuy93{5OgZ$P*CIaiI9mBUqEbcn&*4uuz=u8pZfeLYPC+@R7p=#8=zqs~1a;E4ez z`yu3XLpcYeT(0(@Zuqe%`Y+b^_ z$?OFOKypDpLEC@S!}JOZrUC2@dh>uju!Rq&RzfLaes}H}e*H^`3>I$)bys;`4o7NYo zAnakkkblPqL0szMJ56R%O|SonfeRp~`KE~Jhwa5h>g0a>@Hj+z<&^|c=~M8ZE|qnD zx0Ob@L+l=sDiplov4kaQ7PsaE-|7m876rhe+q^&bezU`BuysxN2Id?ysE?0gBB8H^ zVek1hvB6IfLxX&o^sC)^i<*CPxgQ@+o^3Uzs@k-QBHs9J_f$BVN3`+vU(&R`oO8D; zd;lptLGzNLME6T+zHhD&~VW)D~y)OzYlAzNe?1JSb)5tMBnt-BDjYxhzQoOC3l2e`~hz3=? zq#wE5_M_2oE;AKb$9Z6?5el6#kc@NQ3maqdo1xYr+^nM3iM-Qt)(<~%2TCoHNXzX} zzhFzm+h{5waM;~_JLC-Oxb>!+G_KB0@-%|*@Ovx?1Kbd+?U_J6p~H;A0RQx+nv!H;A{}blkQ+%_cZ#- zI!W75br$#UGdqFMEI-v)jUCtYV=1MnER$Kc!K5!7uS*_j=Y2vnD}bi&lB$xeCLjE&c^5S_T$)PxiaO% z-`ofDWZq_%v2ToS<}Vn^(Z|@6Hu(#b^7uTQyJw`y7(@El(B`LI!!ZuC~_romlSVuA6o6MNE6r zKK*(YZ|-mA6>_tbwGQx3qOjMWD#G#DLp$Xj%TA9*x|^u{T3&Y7+f83doa2VP{9g{Iy%A72da$s@wW#=)QRWM+jp)dXjLiN?`yvV!i-hg)}onp*vc{%D8MVnMc z(%pnA{zEc#M4%SCZ?pI$=72hY)9AQU%IL)F@#3yaJCY7!-&JHnD6F@!ALbTctS3|3 zTZV{Z4837+Zz+72n532m^hMB)n#wwAtgytVpq=+;gkj2+U2G=CcDE5ss0F<#fb7%7n*PFQl8Yl3iJPm|f_y^+{N zp!Ur+PTK6rhg_-M&?G01g4hP#SF*M$=(6c1_5baZG)k4 zrbLoy8nUnO$7J^SJ5D0-8TU#*@Qa zG2!~th{%)sITu>04iQRb@Xv8I?3+_`AzV{2S6-!0<7C!W`?wmmJ?2?q1OA_|OoA?o z?{b2Da8E~m(4WrpQGsI`GQeUb{kYvb15J<5=`JVa9HAKdg36|wp_u!^#2+@7a&mWX zSu6RG8DQJ8P#K_Oc>Pji z{}KlILY`mHtZ`Q}r+G+@y{lepcID<=UvSZ!RB@+v#rD8v?^NuNC=(!Z!lI zFR50|Kklk@=hxEQ>({3u!e#=#BAhkdsSUC40bCr*tp&aIH_RV|w^mca=H3a>zfUzR z_`*!MZ6*{<0V>SHTrJsPw~5HK{lYC)r;kjxbZ{gb!c;BTK6HfKAQHslF)=X)y5m7T zH)uheG{%1iX3Y$)KX*a)jwRyARrU#|$hZw*x)mBkfyJ5aqZ{3uZJ6MV%!@i3WPo>V z2zUiyL!mDvKZ`qMQ$orwP{MF|HRWW$S;0R=~cUqfAJ zkdfN=MzifFc>}7*B$Mu4B+gQv^{+Jt^Ah;E!qr0RbJTs;SNr4QuK%O;JJ1u`DM7Ivn zg4IUW)2l0o9+}KGAsk~`nW>J6MBsVTlN+wOC`9`a2^P_;I+HhX?Bc_57l_M=9fC|M zzx6UM#n`*JN89ZBs6mZrZXU!&zed3&QRQ&V|BP@O43gS;T0a0`GNDu&p4xWyi0c8R zxRoFr-}+9gnT0m}?y*ou0gVl%k+o-AyPm*y`JN-J-Q*7sQr=l%8ru748v@T68K88x z)PRZ7&xgN~M(5o9EkpAhE9@T;QU_V( z^eVBcjJlBSy_$=#O(qloAm!HsN{GNTJ4@5d3#eL&Ffzc}+ADTWW1`(M5CU!W2&Quuj9PAd z$x(Aj*A#HA;JDlQ%yiHzYxC^OyPRd?ZJzkL-%_rz9A2wT3J*K4Mg~e0mjh?VH;FIN z`BD{wwbH%xzWAR9m-o|6Mp|KKscz&2YwBe*CD0j>|xA zgp8-3lW?Np6Q>l&Kb{4R3b-uKurR-R(ZEP}SR#^VKOA{fDGh2frjoSIGIS#U@HNXZXQ&u#f-Wo;`gbcqE0|`49{O(!Go4;e>X!A+hCIxq zF-%Il+k8wJ{Su8ni=tTk-m$6vF#>cVqW$Ji?B8G*j_}*0G3+#?#}@l^xH`vSUf+SX zHBht`W?fM1s55`e7LWatK1TQ@8|NvKi&4AtxY=?zG`J;I^UE0K%S+p`)JC)!HhfQ6 zYd>pc5tV*^SVb;bHTV52PPN$5gP12?dgV8|&JjSht-vy*C-jhVcbIy+@BrA@U}?76 zz!Znk*Oj?r!Ym#FgyN-9P{eEb7?Vy+7i?gnT;pxP6$to`>WY2r;^-;+a={qtj`+fB z$PY7>G{cZWcrGTcLI73-P9=4Er0Ed!zY&$VXWP+Z4` z09yVoxI-<`H%^j9wIxxf=a)+v)?c&@2nvmOGNbC9xbAF?AFj&<1WTX#=Kgf}Na<1FVQzHO3xi zc8yI&DK^PPH&#d@$G(o!J?RL|g)QX3w@|NM6X^gYDf85{5y-*iedO_4V81*uliln=09f`f@+eZ%;GpuOd_=_Nn);Qdb=baMPs z_{RZQ0Id5NC>S}Yx-Q-vK0q8Li6@v!Y}UqlYz|3Xc(ml(LQT9j64QoogfT2w1c5K1 zsjJCW|73h)98^~}@{+Ej{CghJN4&BZvSdHu+Wf4I9OPxUa1q))3bV84(W=iEcMuV% zYwz^k<6#i*78dDK@vaYUPmE^tC^VtG?O@t!jQf#ub3OpyHOzq$NTesJoxLL<+6aOR zIu|%aXtolw4ur7>oV0d5F3>h!nmkIugkHzlo)72sroCf9$pD|7pi3TLntQUBwV5K z`#_D4PnWlDh2H&>qk$$}wKswRyTdWLwI%WSAgdxam+8vur1k)QLX=-3nq$PhJpx9~ zKnl&>kKeHc$#2fS6JY@T&*}$9%(>W%HR6Z}Y1~zsiwZu9d!k={yC?0}3fO+1`Q5*7 zin;r0J)gms8nF%2r-lSb$R+I6YngLr3oMaghghemN6V4x;s~F%eP^rB^bKg5~6$Hnb6^3413!w4r$Gu5_JiR-+9Uvsbz0?~X7yhD7dbS-UtSDnF zBP_Iv{cXD@^85No|5YmXA?Lu&w*C`(1I6Ra-Hj0AWr#x!Q>h$H z;z7e*!O)%YYbmc_~*{EEd5{xVJ z)lNGC_lpGtV)Wu6%mF^AI&VJ(-arEt!Kd_zhw-X0H$ZD}69wNhzPs2IjP|X`@9weA z0ye#sYq&4(u-ccdskMQz9x_<@fUJs-U)W#in{7%_kz>1A`3(>cKX)f-avX5JKivBb ze;G~LjO@g*?P^}#xHT=LFRhV^qZbdTjv&1q?Rr`%f`CP}c>8`f;l->9m`N5KoPRG9 zw($0lo-VG>D(D(E8w(-mDk>+>Llbj|ihluO(8qMTzuViuxIrGqzK-(k!awpSh+>uB zfGDp$#R(Br3&F$Jx|b?Vi48M&z$C68sem~dC@~-N!z00(ugk9U^Ttq%-1H%G42;6> z@meC%uI_AG2JIo?v!D*rU0J@UB*0tUr$276qB5m;C$)(Lo)vho|s}o z2@FS6N%KDf)5-uPFe|R6uG;@tiUL&LBSJSh-TY4g#3u!%pjk?vFy#MX8o581h9+|{ z^)IGbFZn~hrlKZI{t+OKs6V?=lIlzU{4YZpt?`|Jz;Ws4zx9B6fPR^-Ev)QDO>gjg zrrEK~Umy94M4J?A=aEfUkTlV_4}}8+!Tao`5Ga?0ZnhMKzlT~4x{H8OJA>-7(;sl< z$WK{WdtR4#dc5}*ixx$D?a0QTUTrYfPqxuRobVa(QZlNSsc;wCDM}2iGeD9*>E;&$ zroV!y^FOTl+?4p5`fsm;&ahOH{O|7ebfiRqo_A+dD*^fEuQygO{!+pXlcHVRpw>T} zNx!hh@1Lo<(7@=eI)p~|FaIzX?H|mA?RTvAw{MZOf8vKdu^9U=4rzZdm;6SaBb67C3UWu3^lB-me!rPTT=^>sAGh7Zu{iB0y_E!BSQ+m@WfORP}Z zzX4hY^>|Fhc>b4|#?`*KpCZR*J6`R6yQ~{sup6raZul#0WWBQX=MIe?+nF|S z!F|%l7#JjPV_!WBN6p%{05BOeD;+Cv({l&uuxHAo)~qO~KkMO+ zX_~fpzhG_c15hPY3-(>ooL8n)%Mb9}f}vt7?O?MaTym$#&pibz2{c$lpWl30G){4*ExTF)GKp&} zofUa!HJ=t#X8cmmCDj30&)4zJ`bES|cCH)$5!EEKo50mQuP;QR6g(r5EvbaNmVZ$L z>AD@|wNT=(zXd;-HZD#N=R#+mFJB&?)m25t#>?sbE9f5fJKb;oOE_p0#P_oXkbTmu zFD~rxV+l7u(uNDn=&dQT=)~~e;X8THuv>b_9C)2sXq%f)lsy)!tcg!~*Ez4}n#^nMCoMs20P*!?Mnc)8Pu0@|MJ+r0;Glj)aTdA+AE-CC? zt53bfuxN2KUP4`Fn+2*6yAklSub=OzNzYr*TEIfXhh(##JGgh`Ag^%7WX6vbK0C`& zf)t)QXCXXDw_GRi#%MiLqZw6jr|Y_or+J-@QEJ6kyEoA)(Z7G#O7*tqO2{ay!CCY( ze5Nfv7Gg6#fzG0Y!$AQdBxG!w1RwIPRyPRiN|(>vZ1Zv-1arh~J=1B;Zm}-yYbqPj z&NorSQ4o9IC33I6!*X4Og%g{>l`H?z{!-431g~~faY#4a9M2CntEa@c1?mVJi|Hbai zrPzGE=~gATSq1E00jOFNt>E21nmI3%o@Ae_3_QcVFbSeO*c)7M;H=$(9Kl`K(N>a* zVQvOjQStrA++=}S>E1(Z)~}u36cPZNc}JP3Bj%?}p(LX=hBs#iJeiy>SmtBdRA>?s z-x~BS$4bbs<6%r-KcS9pv>(auzANE;s1dVcts z5Eqtc%SqlUxNfPKBuIO_7!YdVv>-mZr`8b2ZTwqucr+M^Tc;x*OvI^M{Y5jynGmCD zr6Vb|jsXl+csAOOS(udJ$rIq&cnB``lYXv15G;oR&ojpV%DT+{x0l(nFDAGe@^p z#H`gz3#Ukj*nQ4F;;YzW4Wd$E?%Y#^$K%k2J+m7EKvL;CI>`P@QWfGmr&QhMjGF9h zTh3~u?PW>a)~32${!CT7J_Y(wy}#4mBsL*0oW3j}m>2_}Maz)pl&_s0(zDRhIWku2B6%nUsFdHW z4mNQ5{2(S`LkNwmwmhkCYD`3=XifQCCmIRy*$Kweh(naTYo)R>&h5E!iWje)Z#u07 zFr;IS?hd0bc?qli3VKa%bzO37d$Xnh-R?qujbKt4_zkMgl$;MY{`Jyw-gvvtfnPFJ zn@{|`I#^1BKY;ZcxRA@fqBg{z4CLVWzT13mZ{e%!{>6K&=iCYd^Z^6^xZ>L9OMa-r z(&Lf=9xAOQAg1CrvAXxHjqxG9Mgy1Rid`iltyEw=xM5ha)%jAT* zP6*A&5%{Uu-?7J^7`=!e>+;gE(_8iAf0nvXZ}8?Zr^tMn2U|`Zvhm>A0nv!fzT-Wp zt*UtP#hMxUoR43IO}cj%89A(k3h!|RE;d`qPJH6653IKvhdr1&X326hMdZr*@xq$_ z`DnN{AnFH<_{+w_y`O@SyI;s3b!|>S-W6u78TgREKv3me{N9QW6?S{!tJA>|A{OBp zHd06!9t^QnhDyP}BI`{7S?7bP85a2&3EL0F$`rAX5Ea;slBF!Wf#sOM!LAU0k23Tx ztlVJecajQJUxlDfnsqlWl-clsC&jdiv+z*6#f`q_cCiNX))~DFoKCb^6tH8awKop7 zP=9T~8y+=Vr5fdZO(B*tk_rqOO1`wDs!(rFo!)9M&}i|7w#RYp6T~NO*#^ie#zMTh z1^JNt>3m?&O~Gv;xFD5HH54(}pm1Sx9luK&zz+OHojJuGD{v1BTcXrtYpWKZ9I5~@ zZNRU>9;3J=%f$q^8le-@!Y!l5=DO{BD_wxjp$az15gAA~f@booaSi+eVqqU+M7Tb_ z#*CWl?n#_0o^hlzgeRx~6pL5^`s5Cf1_FhTAHQl(s9^Nc!ntf1I+>IAlC(4#$&4?t zHoxPi)^^kPizAzvGdqdzHuI^3#LpZ`1JGaT%BOzXm-Goi=JtqVHr*UTB}PCmQ_C>r zjfGnTaGOXV-4DQpM-jqEOlWr3zLqzS#;bq-V{q~9=;yn)-`RxO^&}zUBz1T?EObum?w6Xflv_%(SNS@9e5k=Xq-YaFVtd`BqJf;#C0_6c=Y~G_ zM3ZhuW_CbAvA5g^iiG&2z)-?g9OG18m)f)@tK^6odTMb|x=M_}i=d0Br$@jgOhwe| zud3yZfR8&&u&v0HXhDTsr6p{6p~9pxYJKjpJFN>R8{cY1?P=M4fVF$qVlp4^_3e<^ z-L}2g>x1OhfR$>k4%F0EFX@o#d*32l5?!W7^OVc290Ye(TmomD zBKW%Zgoieos&<#*VQ0=(%*aXO;JP58$n!MgnV(Y5#NocMjgF%FfAB${e}L>9FC`1@ zZxLi#4?TS58lqn8y|q)0-%GR_!6X+d0wKkP3!sB*+1e4Qsr8lLHLGbOvz`9_@mccj zLdxJ!p1>~s5VOro&v5t)-3wFR#j%KUHshtdfL&%FkN^h4`J_&RGZ)_E&=9W;=hJ%~ zY|l}B)~Wkr{8X-?MIc~nN3r=QLVBLE?d!HUJ=^dWP9JU<=`{XEe2 zIn^@rlv?-*nSf`t*tOhtdhuoy;;%y+S>E2N*NJ=Sya7o#fG>h^C34PoxXVL~RbKaJ z`mYZMPHcRtZrJ`Y+T=&1RYPAMB7mQi=ojJ+KG$E^I@r6ft+0UHpD)!+=(?wMOVygL zXtuqq!|F}vCh-GtqpirH-@HpOq(|KccsaZCVoBcL$Nn4=vA{764@sjS^fya=jJ;pY zhFF|g>DHN4u>0P@n0yWYu{iOgVRwub0+{+$%%rvLqleQP-dup*MvQA|Gx`I=cjD|8 zyl~@{bx%%bkMPUf;!si&p#=7&JY`+F)f@Ev2Cgx;;biM!qpK+fjcL`Tnj4{i+J zcP3p%xH`k_w2y5SmmDpv?^!gt6}R} zKC6Z&TnG@4xI;%E4hFIV4wa_bcx;1A_%Rf5&oQu6!yC(s0E0l4v$``x=E-I*sN|lz zYHR)HThh^2Y4IlASYr$bGZ4&^21JWh&Llb+oktZ6IXNLvN6YlodOv6Hzth-zzh`J=YW zio=mA8qKmO9LU7wr5f`fBoRkjDfO`T+ z^4eSfnBoL?bjTFLKU5z6q!5v5Hmp1@f7pwZ&`LR7#Frrc9=0bs;=Zr*zH!J-1pn|9 z8ur;{*EJB93i=voH|$GS%dn+vq;5;;MP;YLvqu-RuzI_$*SXenFV?c-p~RH^nF8K9 zdLenbM;Zp(*l>0_&xGk{;mQWxG6 z$F_*~?IlHj9tMRu$*jHsl@H9+63zIhOc$ zda?+?Qev5x?0?}*&JG|-;IBcO^)oQ}XImBmwb8;ZmN1NdtL&c8wTon>y0 zX?73ajOCq>@jG*l5>P;wLn!OAp2W+ed>733bYb+F8l5QKhWFp0M+ydcn&CE>@J1Ob zL4-B;q}+^iTOZfuUNAF|V4e`a}0G&AJU0(tA;9P&JCU-lnZYt3 z1owW5GhXI1w5J=$-D$1bs$Gjeaj{*?eRdZ?z^?V0yI-1q8mxHj91KIa!ZVu=6o^a9 zdkq%?*Vl3jddo;MV>aQAT|06kTG-+f0qIVtqbnGCQK${Q(6h9%tId%J)4iHkAxu*WiI z7N+lPF{n07Stx6!Vxv~u(wHl-EJItxaOHz z9v_^yN4QcFXfTk#=tBnRV56-k-!x?5 zi%8}Bz->8`Oc_#&$8)BIFxW$JNd$tJ1~2DrL14%3r-d&Lt(=9!N2(Nd?Y&1-S5R58 zZxBpO1Q&{fl2eUj#KIS4ZE8{u1uk-}nxSM5bDxt(+5?a=&5&%U@8+vK$d!P+IR_); z0r>IEi=~SuD9{*i%gF5c6S`eEX!j6jMY6KXUwCuvyG)r+?7zHT-RaE_H}TWr3{F~` zd54b8A3o1D=Of++RT@k%cUlDIEo`H1dVSTiPa4VDSuo&h&bU9Mdt~lI0abqpw>eY9 z6Sb7KED8rhWFmVWi}zje;TZ@Qido17odj+FAuUconVblxl{J*9{Wl8hmiPlH3vf#N z{^2U>5GcU;QzTn_9JI(`mLg+N;wxm zLbrbn3-o!to{AQ*P;Y+qbh|dS((bWB0wT-#YYN)RR@y!h&ofFMyT#;-ov}kI_5=36 z0|R?2-OWPuT&36YMyLM6No;nU(qDFZMv1T-w?QG|pM7(*AOSUhNlEBd_OD}5ubOBt zJ7ZbXrOFhH+O?GC(0|*}nK(81k4yg_M7?u-oKM(2+<4=SZ8x@U8;#Srv2EKn+cdV_ z#vyxS=*Utb#!)Q#i48oqMACUucld0ooV`6YkQiVE$_oL38|9-1U9t82-N| z()WL1{XS7<81?_&{%?LL70qJ&_eDiO|6&4^CEtzy->^P9$m{Uk1VY|qrCc7-m7!L1 zugmRTW?oog0Z)-`pGSATELOKab4zwjJx4g0ZGQaKuT_=`oCKBUXCE#MMA>X<4+%ul za5ReXi#^Tk|MS!hGzcRPLJf_f&@#{K^PbggF0C4U+3^hKi~_}Mj-q5L`D}I7wTrdp z7>kL_Yl%%9Bi|$htj~A9t}}UdPEX~*K}AkNLb5s}k+a);od^?4K%+Dlvh#}hOHX{= z|0Qdx8vY9sozvfi)CxKCvDG#-s`1Put$-)AO&<4LXKn{MUINZith_CXCiR|29M^BN z=zN{unmP7{w|^8H_GIWL74!;M`+h)mj4s29ENdMcp&$C~Y?{@&nms24Tz1)Z#SZKgE1e$9o9!+UOyKDg6cp6r zva;P9AS~$nq*4V-YjeC(Z%WS51uhvM@U3UmZ)3?5@JePf?4q?BnES-%^H2rq@qKP+ zx~x*1=XzP~@?s~mDHJ@I%F{zR7)=>|*9h%(B1$SU!((T`Kz)`U(-Z%_eX1ZkS6&AB z;gdCX_auRPlbs-xH1DM=zznJVo?%o>c`~PZqTFf93L~f2#e;Qz$7R6p8Ts>#EpY7d zC70=PO|dfo+2ky(=Q&#Ka7vQ5z(zt74rJDm%m^K5=}*9exhl-fHv?tHPc zPuJwJPy6%kje7yi`UR6ZnO_R&`JFyhFB{Vr^8ZgHdg4J|OATIbv^O#=%~z;+H+IOhFakEHAUcY?OSs z*05X7d_29({d^5=;x8@SF1g7-XoKRo0&wDGB#DB<+h6 z>Vc3(E>^A7kibv${b#F<=IcK->0R*dRxJxgdsf$!B6X5sXiUer_(AOY1JkDpEGBSu>%YQq+ODYJdcD2eS6EDD4^;Ww z9h0s3gO@8w8J2TXy$Urdx{$k`A5ioBfUFOd9@mq(8v?Q560V|IhmE!*@5c*9G3YAv z73nXg)hx^AEpvs4A8KqEVIqH~4{v2uY4eR&9$c;0-4PD=rG_mhi@KP5NGCRWVoSDT z)_UYxr@;AWAkp1f<~9+Q)5(gsq4V?0Y)NXnuBM)s)e|p)u;pv@|Aq!FqzQNqQNPt? z+&|&q@^IWS_kxnKne=6Bma5R=wo++Ti$hn-)XL;$-BC2y&89?Cn5W9EbLIQ-ti4K$4@r> z9FK5amQ@NvHo7Z5wPkdYszVpKm3A!pPvEox{PGF!{kHh|?rzg#TXnWrlB&E< zcS$v82y&)K9L|ZZulmz?AR2kqJw<1)|C_g1F2n{ttE87M$9J)FqcRO!GS<{`9ad~e zCYMi}$h@IDJyp%$vgb`&q=25DkM@~+hr@aDL6~Qx@%_2OT*7c~=g;RJ9T@mNXupC2 zq|1fz6s*Ao;Ss>Q-3XHCuwifg$N$-zBWu9{m(o)LpUq*N>|4xjyTbB!tDFCPqdld? ze)F@g(8P10E1~gHqop!D4?Bc^IpfoV@Y4>I+|caSwD5-jcsG_+3W^d#jIfAz*K4(B z6!KTEb=n)^@VL-_IW9?~+gsrv+~IYIG+8wt zc+qH#HNlkLASjGc0BVSLn9n+(KR%xL(&Tbnt46H)O4aF>R@fKD{FZQ`-!9ksOdlJN zUm+f5XhRe5qxWSn!TQ^1Lu!YN34%q8m?X+4*Dzp25O3%>bUnfUVh2wsNc$XOZmzyz z?pG{&ElN|1)`!(*8|}Z_y}gqp4uUwd?{j7HRKXu<+J^Az3u#x$TQb*7}z++I$%;eE^+O2b4za|jzYk{s0Jtfw`&}+UR;9XX|Tmelx zu(_+!?vF*3tVIIrFYHEXqsXBIMvH`Z^m@nCU?>&?^M@ZU83yo-x=kt;s4S`Am-X2I zuXK?~MBScZQJ`UC98Qq?p-~$70IC(s+0^-z{zECG`2Uo0SWjKe|3>{+lzhVTAAAh5A_Y3&3SrNR>gw7ikO&ha%luK+ zWI)^iW5Us^2r~gzQJr3YziDP3h$(m7$1l^FR%}aao+F-T1aCBC&j}O*n)vQ1Lb{kV!qca+ys8%IvCUC6#+2V0Z z#yHscPP(NFKYqyMb?@d?k-cXw^cu>Rn$Z4BuzZuM)~(Q|OM)42;@hZEE61B}Ls{Xe zi1*6KhHSX&^M|@NEwM&J_H{n=AjmI;s*HVHYXrT|IvUff7-{Z~8pV?>?h*s$x$jM{ z6|e_wp(Uo(J5bweA&5!;3jgeXrI;-dntx|LuJXc0_Jy!yo)`Dz;T`IDe?ZbV57m>Y zL4CHBZ>}T))q1$ksMOj>i7Bnc4E`Tr`a*m1wBgm15rzU(qxsIPo!-FxL%Q$v7YL@w z@|O%RTotR5nb{qx0ivmCt&pq9yhT=TGf99PvZd1Z(v$fZp!?S;eZ6kX)dscen#%}= zv0u_jjwgTLp`elKz?P6Mv>?xtU5a~#cQqGm&RZf%?4JIH2E`n%wEL^mrD}RQn@Wv} zuQ@ghk&X77d|%v9nWGV#l{W0a=yUQ zV9Q$s=xaO@7?TFwu0?>T4yx0xzScgkJN|q=Rq5#RL0u$djb*zUCk!p+n;E+ji!e3@ ztUa_hpB_JiA-WcXW!#=FjXRVC@l|TuU5RwKAG2r@+_7WXZ^y?w{oHyB2(LO1FxjL2 z(n;c{Z*n$6oynvHF`-jY?CO`0!P0}x7h%DG8}JX<#ir2hR z-WSUp&*p>Sc}iHl@6q#Q+{GanG~?~$8xhR49RT0T+wP>?TDRYNWY)Ec2TfGbm zLg4kyL4tJ4>M4)kBRvDxc|9isZ*EO&ob$vsi577x7g9t)bZJ@OC&k?J zRBUIhS2`)FMr8Gdli3e*jfg+$Mf!v16gBHbDi)V)Idt(;KPbrx&e|af0`MeP;$MY$6zrUQK}k5cvQ?@`KqCPANUKUB_6$_PAP$=Ih6kMA|Q3MpCQs znJy%|r{dN#Y9%a@Q=xNN#-$p}bCk7>ld|#StfXGGu`Vy3pee@=|EEaGEm{4~SiF@- zN0-b<0@mS3&{DAF4K7zIs~3N`lFg?mD}0n04L@7FbfgTae#@7iiF!ulZQK$baO``c z5BNZ~DOCOjQd_yXTnLtQb-%|S>(jN&A}&~)60!R7Y^Z%RogasOJr*0Y-t&3Qww+m+ zM))1M8hvl$2H8@@jFJ1u1v!k)w99y7x>kQoHtKMW>D{2nh-B6R%Hu521}-E7UdZO$ zvf|h4<=itefi>1+S^`W8dn~~mG|gmUK1_~Z>iMdrmBHgQE!p?aJpr#M&y)`(`&sPj z_q*aNpV5p7YD@CO)ywCCoG@rH*#Cy4l*=3rdaF~1cbc(6BP`gs7$?L+ookU`7cZK= zQ^m1vqgp?=kG$A2zEs*uW}VvlGJ+wy1gTvA5*LWJg@fp7%(4M57Gd z?)d_4J<)~Zhr@brmrDkCDg;(@_pL@S!picHX|=31ANP3@_lE6zKeevvDxK7j?_mAI z>JFJ*s~v1U#uH$$ncVwRvvQ8?0Xeu&qo^62+~kmQkj4-{BpDztK~etx(&NhuMuG`z z%{DmY^g7UePwI|Lo-9@%sWAhq2Oy#U(=HquLSI#q6DpnS;3?|(OEF1PSZce^N~?gw zmVn9Ah*N=ZfWPcVjB8i?$c{tnJ65@G}M8@NOSwZW4 zjB7flrpmPke^fZ?6By){A&RNB`s3kbrX4 zpEC!U{gjm;5QTy91PC`pT>TwAyx^m3sp)*UpyGuYibrop`VW&R5sO0R9J>bXaJF-u zRr@jYHFm^zr4)tmxr&g0I+iMP(V~le_^-**Nojf8I5tR!0MkZYb4Oxo_npM-$t&Zj z@HuSM+2TouQ!bxwKJp1Pc3+j5YYf+~TfQAl=Ja}j!J(@;H^BIo4*?Z6c0T8TGYe7G zDi~yf%+C#y7E*1H!AkkX2!1|cyu)fPBMyzoK3V}_T7@{sbMPu}5|hI|^B%e1Ha}Id zm9(@gY$$G@cc#?j0TxPXO>btQLft$jpiC}}{AoO{^Anv*bq$0%Fdee00u`CWuZR)s z{33(KJq>pA^VfbEkA`MdFrLxEfr{^+1Y-S5mv@<|txi#eSqEPWtWvF}$Ba$#3%+y; zVeQ}2-R@(T`*LHNJ~<*b*~r7uC=`S248Jx$+Y>Y*)aK*4klJ|Bxg4Q~=P{_uynJ<; zTE*6-;80N+`kZD>_x(65YI6vftLf?tdPyoVI;m#zOI1I`)8`Z%i zm6-T(&0t=olCM^OWdT6CWV1Q1gMBKKVX6q8lsa%6>P!A8+%beZluq? zH$-8R`1{q;HQ@-Z=LyPmcs*LAGdvtc7qmt&aA!y31$TiT@UU!T{)nv)kok&<26M48 zitl5t$J*u;XrRTlm+{h;bI#*#EIO)tiie#WY-N9obG#oMmYQb(Q5cd!9b;ZJJAwE0 zAStBi!x+Y^Z~A0t%Se^FC7u>c2lkml{}CL7D+!+_diRy64#BguV5hNqxjR{?GZFVb zDa+V@9w^hK!sgWz}8Q@fV)}guRYU!%oe~V-`E2% z%C6_cT6~}Rq>l;E;DEmE5zgr()0dC{x*7)swhMRv1`(?YN*_7Y9TKl|=vJ}4_S~}9o5FJG=dRrd_TqjJf8K*Zjhm928DPF#rH_~) z@qNu109RYRv=Q-;Cpa1^~7S)&-imiWW07o#1bvVyq+D7s`lnL>(yJ4S~)&O zZvQq9DjfVxxDQYy8R+}`5TR`v0|%WjIA5+lFM0c`AdVS|TpVtt7MVIb(G=VGIdBF@ zENUe)4B;E*MGT~b8z2+|eBv}}k!gAOAYCY9(vNgU!IPpAJ{ALt82=8sGW$xU0*4K) z^R;l+(yP3@I_r*b;!704=GD;ru0nzs5;mLP`}_f#DOLQoHlO${8Wz!;Y1O1 zMy#`aEB{l7@~r!?iXM7x;AN@H%cXvwm;U=O7KE}C=@!j&P=W7AB3Us^2;Op~wz9%r zW|RNhi|n2ER+rcB{rs@z>}5kA#X}5gpQjBps6Y|kRM7>&2XKn-!RK{T`qXW5bGcNV z!!iNRLUR+{TUAS>(7U+7w1COk$;$W040w*`-!V8br-inw4Na~mYQZ0b`&Gg$jsW0Q z{p0z11}qXTX}=Gcb*j-pQNh^@svxn4$~+-!GjkSQC*pA|`~~6rdfv+PdNo@>!N=kc zY4>XVDd?H3uIiZIK{X$HT3*%a*7(@i3@{h47lsG zlV>ob<)t*X6R+)Y%`kwT`IW*#F)@7sp+COcTkhoBU&~e=F)@+C)^n9Ls2mUjQ^UCZ zE|S6Jkn|25Ryp{7`8y+4x&I%v2O*#YY*Nky?S9J~%q%PzLOhh&uIzMADHMe!Cr2^4 zBr*Mko)pyl(MYeQR#P5FC1nhk(=mSkA_h7Gs6eX^x-EX#u)S9EF5ZSjaB)jrSSV5^ zB11&+!y=bcu)muR`Q#?o1;SbAUZ3`)wtvHdC*6234KS%{W!B#}Zs$P9#Zjdch7Kun z=%VtZHtho8>OoIJyh@%8$&6|>^4kjDPUp!(;`ZmFMYh!ph|2blW%Q>%X@PX3Gy7odG!xsAl$$Hy!CD8gBx6_<9d^tTW`*xxZe}5#n zojixhOkGcC#V-*2Nyu)E17FCu4KT5rw&)Tq;t9Z|cl0#>^H;yi@(Fh3v`SI*6effV z8bc7YJTqZZ%zfzYLadh?Vu3nDlG0>8j-AbJi6Safr>5~LzC)_eJ@Z5%?&z@-6P!tE z<=mR}Oa?%lSjgY8Q66A|mxdN4%{&6El?#SxPxn;ab5Ha~4b;2#F(a3wtA{@HrJgaO zsM?Vf+(QhH#5yUqCeUf844H78jNGAeBXGC@ppwW~++r8~{Y_w4E>cFCaMsPqKzl9* z6j#IUA8SS+(Y`!9{|RSS?tJ$B=2jYvD(o%jFpsI8?nwW^Wg*vNmFs>I6Gq(ZHbKc| zVP7gBRy3VOLQg*}ko7Y5EGwv)(D(VtMPhf+MPrK)F=4et!3?*;n!U>|wiQRVJO;*^ z$#z4bl^JI2ySMr3Z{QaTo1O;1B_C0qxLFrPwCzXyT4bE53hdQ$O)@#K0PPANdE0;* zjoRB+9rZB?p4c^`{)9(>0OA+)$md`N9cr^(`H&?6A0fB9{3sEPw3d}NU9ed_sNtdL ze|0G^Xli303^<#4h_0B4(fH5P-u3S+i7nns@5TSqGYrGQ8VGZaW4HeQ@dTG(V}6gv zRHtF{|4ASj;4>n&$Eo$1wf|3gusm4AV$zK=vzjJzP$GLWz4#kpH zVFfbyE9WF0V#yjpwmQ&I7DpkGAy@ll>n#kcRml(#{K5lvCnaLzB4W2gnGove;+$U4 zOU8cEVwS*`WH7_Rz|1?Mr+!)H+JFo4Y`j8QN*NyDvalf?dU@7iC!t?A(d4bNPAGFo zq8y&L#-sTwnr&EB7lAcU$Mr7gFKaA#^=H?NG3K}N}1ihQGtGSgD3GWg7t#q~-X~rpKUf z%*jicJ~}LaL4L%a+;R4P&n*kk@H=L9Er5yRB=I934N2rTe!N1v`7@M#Ez53EsMy_0 zUiE00=F)8{tIJRw!HZDQwVHtOSkcbUv^cx4nIUyKVH3Kr85!=dv> zCZkhLEAUS|a8Js*q(1r~z0@x-&7DEM+x+Eu_|l3o0dJ4?(Oh|yHNfoyVw5%Tz*oEL zwnkqWl7wV5N#*XGn@W#3U3%-~EumpYZ8E7>t~=!x2aNaSw(k&6GSpu$K;{4}-+L^% z{N{Q>et~lbx|q9BnSqelAern?+W=}&6lmetewCVXMKk!lm>jNg-1)29&f~P@V~AS& z$o4j$d;B5?AognoUtOwA!Ry$WG=E)we6DP@AT>|74oTYt=PZB zb%ZXVcOm!Z{0kAK^C$%d@y%~=9-#*fNsr+(A|G(^l{&DLFFY|0h0dm4WNN8e&-~5T z1w{{lJ*}BYhe2~9U-d29B#dtAg32pR zlAnWL{w6X`Q3lJ7#}*H0cf*e_T@Z1u4ehAnFyDg-H;knQ=8YaAq8v`?QfQqXs=~!&CoAD|eW+mLxvol|ljLrX7x^urP?6MX1|md#YfS z^lVNZF9p`m+x(@rU#H4uJTDkVnMu>cKf;zRJdjHkh!?B^CyH8$gMBe$$VQiL27w@(z2x`6J5CM%)-ax|y@R-z*d>K;92UT}loic8fqJpjJS`J1keqlY`-99b0$kWrTNwMaGv1fkRF2 z!C}xL)n!XQEo24&jOTja9&#uvMcE2!3_8`A{C5XjQGyCpio}vtQP;Jqb!EkJkqNjW zsS`SAL)>obQ|;lWvf>%jhtIcrg%_*!mbs*2=fC7sYE>6M-yUJqU`6>QlH-a=CJ+l! zrjS;VI&@u!>jwO z<+g51El}4mqJ7_m5wb$uW8;O`C;YynI2?-?&^nb{CRo*;aRe=-qqKU*XmizAcaXzF zSpWt7vuavMJc3&JU?RwEwBXVOID}GUW8a8F>rk2ADU-JW_O> z)QFe>or5U*1&94fOKo_9F%%8pL+e15`)EE%gpC1+Wyzqxa`|fU2bbWmw(nz225UmR zu?&&w83m<~=>jp)NG<>`;tLaxW)O%C?jODNo7cwl6U_>w2~v-M{dyZnJv6qU9)`Cv z!UdQd>yBE*Y`a1`fLJHfrv(q-sDs=wq`Pq+X~a_vn966q`@V1RkB~txWLXskyR42ZFGZf##5P%giIcqZI;s&TyGC28(Gz@R!7_; z%m`*`l0;E88q8!zwNX!q-?(g+V&7j*nR&GL{ok%ob6k?o2K`q(CEe{|eOg2~ccmeP#S|TYccU7!%_XCBMAFccC72NT@AwI1Ehr(q z>5>-d<1D**!0LJ~0Y!4*a0x70`{jCLyGF1R@==uX32{*E_qc1p4%fE`t5F|W%0oE9 zrf{D)ktK>AXK&WQV|iC^Vkq!+xy$>nq#bftPie&-4bVUQ;w?3Yb&&{{&;g1pqYz^% z62CguZkWaqXF(^8P6GsDJkNv}er@#n4O5R432-=V$hWSl!Fq&N?pG0`%aCD|pxGx| zPRePc5+cnrZ0Ly6D65t^^b|wd8KSr_ZIB$cv#mQKo{m06i*%Vh#Zv>y{a7qhu%>lk z4{cez2hW^p06F@tcIy`O>1iZ9K-|p5iT5Qvhgq;`MFJxteXCFuO18kJ61N`(mqFpc zINJC@CI>ONxlg4+t;}p=NHECOU-PF1>-Rxhy(TL%(~pzy1%L|sq)p~xE|Yo@K9y3C zWE}+qCaWlr`U(dlG=s^vx_u?rKM_x8VhISTU*t0}an$>SZey5d$LzWw{_gsujnm>K znGMh9rPlO01x~1Rf@x{rMV8MXGnhzqCq6G#z{P?W#_kmNyRV|=57O87#ux{p^iSef z7!)*u69W%lj@7UjNMju*BSbGf_LxLPGy96dLUy)BMx8LN=7lX$Shc}E zgxko1K$zb;I*w-x#lOGS2OdD*1=gZ!;n0g-L4<5hSqBf6>@^+%L-_`A<^5;Ec68f2 z9E1%v8Z`CEj4!ShL#ArlVEueZrf&OVObVx8+7f)Qed3%DXj9HWZ@49ysmaRvMWD7bF-O8UXl{^ z;C1f@z=IFX6%7d=vNJz!<#}3SF-{F}5U{iQlv5GGc!>2@Y+wn^jabE`CB`KJy+M`; z6wL%1r_f+gAwCVr5XFBNiG{7gMMJBSHWzx+QMjgX zBm_+T-PMQ1ewnH0t?|k1+Q9j-d_$ZT2p^h>lRH!o<4F5ANbp_U(Umnio zF=&)ZLu_9{n7hTo5YVsx%}X^UE^hI`h?6aqJU+Ky!wCwWS7Dc1-8p?vmJ^v|!Jqv1 z2wx-%iJH8hwu+nvFOknln1Z{`P(vU50-K}3Z!*B8g+z5yjD!y~uJ^qD8Z1m~MB0b1 z3Wmk))KB|PL{n=Vrgj@`^|2+s&xxdzE&_ad&=Qc`7@u$#TM9=n@YxjpeE#L3-=QI+ z!C~6y^Gn9$aApV146Yho_lTV$085ya<11)u1nv51@L6k}Tb^a;jG(k_4fW`zA?int; zC(wOz)`K(+zk;OJ3<;U+i%svj=7PDVDaC~fjg=!z$0Rrv)_;uTo_aU_8#fd1gXL~DvbW^}hSK**NTfnl>n=nf#q~`jTrP80m z+x^Vy9ia$k(y||=$>!J*ejv2YBWe>s3V^E975T*fGOfVZ>{+oBx&`@e2krSa z9!L|M34k8%cL=a}MrcpC;*{K!-80Kjw8{nzf(q#i8?;Gc#>ZLq~pM7G<>Xb9K@CN})6ai=t z{`L|T6wyL+{f+O3ZkLx>VXC57-jrg zR7XHzrm&HXiAcKO>^%gS7z=ZqN%{*~q%I^88!wn1(Z~fiBdOA@WR3(g8Z3U#U+oT3 z8ICOWH08QL#}X`gMYZwoaUuy{kh=HggZ)c#!#WtDVV|x6PpQiPF0$!Dg@C^NgP51j zsOP=?Teyr~E8GE&fkUaRO?-zkhkZBt6WPx#XqutT$oK87tiDx^-T+XJ-*%czI(hV1 z529o`IhLJ<#yg{MnWkEDvQ`tbT%}4wI768&o!)2NRE8uoqlVD;>DR31c=qLPQwx2I z!>QXYLzh;UsmE8r0+%D9Q!gQ|MlxdnE@XXBARQ?2)Cxfu8t7vKZU_$~17ZM5EyGCW zHD6e-&+EZeFh~&MeLxoI;y`d;+CVGu|LOH_^a&A!`qRl9!s^TabwLWEB{fD6Mj%}S zf*;amAW_>XkBRNVA&!K{CebO`4=Fv&+p&{XN&;QD zlgDY3ZUbH$&>`GT<_3UJ6&}I zR9{C(wo;E*CVhRS%Ju#zop1n<9jxZds-33=x}UB4eFUJZPR=j0KE35yUw<4NwHz%_ z0ND{fm{0nVQ*Z$kFPYMKvYj<VNQb=efL3yjqRgW{$Sz z=Vt{`8&Xrkbizm)(h3yj(rfQ}BGMQNa1)GVd^BH{2Yum!P$z6+U3!{4%|Vh-`L2~< zVCMfc&u@4!g?-`9ygO7Hc6O(ml z(2k&Ue^vC|)MIIKv-HyEHuQ0(m+AO1lLcui{h=x>%`76l*|jr=;`|Hma$#yONKISk zM<$NYgXfj0pF#Ce_u60qiSN{7ZSCR7^QpVP@94q#88 z70v;|wdM+X0_-YoJ&7n=L&r03ksArO64t*Qg|OFpB(~3}LY3PY5HtS$vP<*haRI~L zJ)yH1+5X%g)nbCwK#pLXB*kya5-7=9W^@Nr6u{+Gra%2 z_oL?RmYdn2Jnz}~)aLGwi~TBrcp1#KnPB{B=4Gl{%}@PK-|JsrCPWDgnf(oXT5X+J zmS;Do5dEH~+nC}f(dSCS5|9)9-%btklW9)z3A%yO4}+X9ppKg8GGXk$raWlI-*Uai zKhSBNnF%@PF8>?~UKOr0>cap}Cobogo3l8`ObAkYV+uUw_+ITWlmdrp4#m4s{Vu;N zY8Mv;v|a+)@?mQ%3gFTn1JnC~T$&lDu?(I~y)9YxFG~b+iWARvXkAJ__0|_rXS5m} z+CG?txMjBizZ7H&uv@9+PX4dfzVhec8*1rn}nphfq1CFM7kGX zb2CrS`;w6yQcT*{utA59%EY|Bkq8!8gG!*z6>dn+4S<+Q|KYCM!e7QmU^M=M6qQgM z^@Eh1#D$f5m|_CvoUz&mjpy<@`(!X+lq!SLMge>gqYlAo5qyF$+*FoZqgI_s-rWc4 z7`1f?LM7=KKW*%w(=Mf_pJ$$$2_s#S08Jh(qnfgYWVT*D8YWuzV@@}_M!<}*3%}8b z+HpjD!?3ut_3f&pI(3By3>KZON8JhdIJbR_gLVn912cS%GQL6~6}rKBK*D2oLAK`n zPI=RzMC#O1KmtFdrESq?^ZRK~e|01+-&%#%rB?#6Pq@lZK27)0A}$)A&P(^aSc^n= zhujlX9@9G68T?oV_b{GMbyz>LJI~f0R&ih9%fag}Cr}<;tV>Rh!JlYter=z_BYFcq zll4(#g0}N(Fl}&7)^06mQYDUO`{7r1gMo>ajQey}>e2^C7a+@TAiW9k zX0Y0VW1ZkDWZCUVz3}%nvElMO{o{7jZk+~~$LP^pWofP7K)|ixPvCV>u9r9t6=$$B zPFSusOXhPx>t8P7zjv44Gi~3Var|nYuf#jzxCU63`=8*XAw9jzMFEM03osG#7XBAw z@aq%`zJ@F^ZTW;D5W%ARf)7UF$l7ZLn1YOn){m!U_8-!V$Ac;+>lUnaXt<=T3M@0a z2_)w%&X(K$-|g4yjEmSn{WUAz1Gv9U534t^jCe@>(cS@T9~bG{khDKoQ@fIWJ!@Y2 z^~Pho053l1T}gZj-hm_O@9C)>Si6gJ^Tb~Xx7Ue(LqlzWji_0DZzvdf8P@aV?I-i! zJHeif4zSbmIANE_W1|QbG8}SG0~;L!EP!)>X{tqWBmZY}PA1a2AP{W0;Ia9M@#BWe zG%xOPCcyx4D!Cc=L|D)aSYUp9Ij!xSyBQ1)KASCxpx0}u`fQ(SPIcWvt(5y?nuyv z;YesmBt11Wlwv^KgH)?U@2JmB_%yH@0!#1DwO(I&nDt9d*~!`pJ^SJHc^?zLEvP2o zQ9!X3oju?DU6adSUTFsLY`LU6x!Je7w?|`Pgp^i%7TQz=uRQ^~S5hZO$(+t{!OMSM zaSXNi_SN+ae+(unA;eWd*V3p0nR79IDFI4V33{>uA|phWyjA>_wc-m3b)H#XQJH&+ zXVH|)VpQ4An%MQhnfpQ{wiF&Lnwq%4hsgo`Pcn#3GAWEbqLohNxSo*f_|S{oU*ant zwUiI7iYHJ(nW|498H)F;<gXlBNxwssNgW5s{AcpiTY}s z+ZPBY3Y3y7Wi^>M-H0HLzSRQso0^g4s;{@$rBT%>7YKP1cZd>$so^r~5c=BK@rc1= zZs&cO-;jHurcn}gTaJHf;{s4xmD{Fe)B|n4jYNtK)6?Q!08z2lG*&iMmSB|VYdh2I z=rtsOvq#QOdXV+2vlk}0_HhtgdbS^LFFA0OlrZ*GF5 ziRYcJ5a{833XUo*3$RFHj%c_129Hq7@Sg~ky9YG2+oGzO+|!_?F+H6_6Wyw%Uua#7 zJMrc<$lwwNJKx;)BeHczv!MqGFk9Du>o^r(oeDm;4UTWOyXQ&CPIZ*&k*g8R0ch>X z`ASjarCJck6c^V~d9hKjWUP4WJ1a!&EG{NBlI+HH9-&BR`(EI`wpjH=UC;w5 zzI14xuu_I+NuKxmCL{?}h~``Wil~W#qiGyyGLL^*vr0!*{KH@PFuvuVW8+8}%q%x0$><>3}}Xz_+i=QZR=wmiwF0u*&{K2;XBA>K^T?(*hb_Fd^T zNn5L6)H`nZ{L!g-yVUv1SPF2&oucx7fOyDD8`68RNuz2=aEbP^>rjAK3Y$_8V=1+_iyTMu;AYf zz}!pc?j2?Yk{CVQu<%Y=|Ac0*tswl@| zLG1rz!imHJ09>0Y7y~FdsgFk5lkr7ZK1CW6%Chj>jH4pY!Y|3-mw+p^@Y8m5)INoN zpkWGc`Ewuzf_a+u&WjFu)$=f=6)nsiixn)ZG0Uq-LZC+t3=El83m*0_sLOs%i0 zkh=FC;C{*_)*UcyR9Nc;t~)SGxxEt<{s~7#8U5!i;x^-|VOo@ivz!EJ$`t`xot_qO zXhHNmp8NS8y5Lv^GyP4-zAM~EeE4DaaAw+Tx@A$lyxq;nw<2el+lDOs7xP~)H61D4 z(5r5oZc;vxwN?j(?by6E0NpnfYzcHqoGEodwx<+>3+3rjxx zkO^OyKZf^~`4^T3HeRHO^Jlto z2KM%!Mk`ZV%Xg4}3xf;KIH5hKxjvuz5qEjr9_mtv#N&s>%~9%aRqJuX8Ql{&bQO)o z4~S1iWq(3KOck)9bWr{o{I&1le4QRg&_%@qXg>kw55CDknTE0cV81f)wzr|&S7s`B z?u!KpI;V%i(=DAYR%ZN>hM+uw`vwOjrvw*GXzI5*Y}dE}aN%<2X8}jQy~1M_N?rBE z=4i>pwo9>{M;;++NkpyvC^U~MOC6O3nNI3A^psL+J?irEN-yC3;A-c2_fGA( zyvANX1@Vq&VAe1hKgF-yU{MxvMMY%ahM*S|O#BkE-xcuYm`WSDy+}~zS>5jGj@en1 z2sn>Vdj{Ur2o*c-N>em>gF2549Y3mG=kr$2r8LbnP6E8-J*vZx+QLKfRgrk|yRL)% z-wxbsiIUkrvJ*B8qxKj4!Pia2iL#yloYK{4(Gwazl`v6Zc$gITyXV1Fe;#K_85Py6qFD?u8n5?Ed)@C;t28ot^IiNUYhOt4tk?4N?>ZyvM!@l7bwY4?0~2MV#q+NkSj|pP)CKHqZ^ z%oGyOoAn|wbG~Ti_TWFGWJ@fj#XxbFInNc1+3(ax6Pcb5qngR!ki!_xV}Q}zrJT#G zN=Y3^B8M+Bb=EI+u{65c-(XcLrUFG;)oVAwBC(@{xqAj`FsLUUbl>gNe8`={3Agp^ zFto*ev*aYFRJf$#HGT0bxfeJM@c0o->#6G%@n@VywWb7KJ*B2_ARoxyO8Y|S!m)(7 z)F0fs9~(6cs>RHQjoAb_;eNxs3PU&&Q6;{8{@Oa@SNxWL#cPd*K*W071q|ww`J~<> zUli&#+ox<+A$3Ft^f1We~4agjrhQ?V{ zn*FbdCCp(P%*usOh@d{mBrmkc46hvh;{kI3zhVbS*vumJ7>SxZAFAyV4wGlm65?I@ zTiX4*WY&*|;KU6%!cbhQLR`j2AlFHbM8Ef_6v14AT?pq|RXRlyB1P*ZZ^ZuIBijD{ zkAkh>dyqqSwMX7gZG;Pwu7oJM3fmDUoCPA})Yiow%UCBH$Q=HXAcw|hD0Kh%W>=h& z`+N*|n%BFev|M)WMy+<}e@U1YQf^Y>+qi!2adlpIF8xT6h-u-*L->d5o4m@b3j-ds zgIekn=VlPVW#X5b$#|F#NufPgO<|?y_CF-nq&x&xu8$FL7>hay5m@z&{MSC_rVDy$ z@;${?&sc!*X(A=#`YH(X@FSfsrS!*;>h9X$USpC6Y@hF0v zOYcJeVi}F1?BF!1*7EpzcWWNm;bQYKd>!)VMWv%Yr*c=KX zABGn2wvvV)M@K|p!590}oNSwu@7N@8Zk9z*2K)=$)p6;G{{=?kg(=7Ay(7rWFBtDZ z;hr0NmM{yP6SD$>VbP;tx=RDr&_9r1{Rh$=-vm;Hcn5QOvj|vpHR6F6O>wxThN?XQQeiB9S~n97n?> zsi<(-t(9)^$gLo1^xH_|YbUyf^)tNzT}xfIWTqrgjZdVgM=tqJGLx~UygyM8u7o8{fHIyMUX!=kmnM(-K$?cp#fO8T$i?{uw_NnA4{xTadN5WIr1{CH${GbDDgpLT#yGb4 z#-;{3KO+vhm`h=36hA{;_Ep`8T7leJ- z*-D1aVjGLWcKux8hNM={vrFa&N>KWGX~&bVyKk&799f(kdU&dsOOJ4AL`HqiX5Ez4 zTPt0LgQ$|L=`T>_A7qGO(Jr?rP|~Be@cGw=T7{-49+`4WR*zIWn(toV16Kz4e54f6 zXcGrY2WW3(z}A2E@M`vZjkjd(9pOvimo!uTOdpWA>J1Ry4*cvdaZ9jQii4v6_`w5i zVI^59twtznd^X_LyzFRpP%1VlKi(LU@!I*dwsJaM;&7r(m@moE+mN6Cvz*8C8gt_G zS2aoBaiORv$@KIT zZ%!BWJuix#CbkpjoTs+!tGQBmhiYEagHIj0Qi!);@*o_E_kA{BU%1Hy4`R$+sAE=r zeA*7$!~MWQDM+B^1RX|_so?w_Mw_vLV7)Msj{gup*iPic%W{1<*v04$Eo4=F)&061 zR(Y+HHx%*={fpJ^wvzAnn>{j9c-?bI>w|p>I_1bscle-k9dY911?CHSQmfim}gZx>kN=q3^9v?Jl5rXv(1L zy%`_dzmS^tr8rC#cALwcZ%Ei0BP9D%Vt8V7R`b&qG`{>63xu@$?g*Q%d5JBx7e5q;{2^(yEIsT*;wn1MLFlhxGOPg-HO9crb)s_iY(w))t9GvvM-t)(s+nn>0 z+Ea|=V$;UC2Hp}1F&r%1fdm`Q24cod#7cvOB_@)`9&|5z03f*JWO#r^~J=G zRasLp!@+TQ_9SQ_js&ZePlRaQfc@CP2zPv=z+0{3Cf57QRz zDp^pF1;bvhWQgOBOSG2&sSPdFi$;=iuu5Bf3-XYb+aM4^52m!p<{BCMj;G4f%tR8G7A#BDs3_QYGgWjU<^8 z@9_3SsYkHoVU<>5y8EeT&C`&l>(Mr%5pgb+8Y5(JLbyFBMaSl)+QhYXi?5|J#kdAXNYc7!4kuK zeptt7VnXF1-mB#Lhd~)*XR>@IV|AVvknhJ44hKH8AQ$=`=jsh15Fp9(rI$RRKq6vYlLy%cm{4ICZ znQ&s<;7MfGNbc~Ur4KL)lx$>NxbPBxi#K{YsK$rH8G7+M#JutPP(|Et@^+z8!NV?Y z@CgS&>4C<}Z|a!oxw=6on7v_+1c^^%Jxmp;@sU9N{AtKDslbJFujGrtekRCtM7Z9G z`;UhONpOUnpl_Dt?Z%5{1)PoL6PNmv3SnoUdZ^eYTc<=3TlC8`qf;LG_C*WhfyGtR zK(n@I0bd2RS^%YBh&9~B*W(NkJR5<7`Wi+g7+g<3Tz1isY4Ay~C|LDb$yc^(-gTHq zm}kxroyYTUuO@2Ea-^`5r!OxwHHF{ROw(r*oEWu`4Pz3(z#K-*i^XT6zUw$)%!~&$GrOms0mGhh>vM_ zF(lkS|MeWhe2Ehje+f-4LnSAm^qk>Z-XgA?#kmzj{_A7uEm5y<0aP>AFgke4f=iBf zJA`fzeeqBjhP`E}eUo4`n;+RSy*0!? z~@WzwV&*;%@V}9_3CkIErz{ zhs?|dUW`F27t4rRSp9B*`Wx1XlD^inpjHWW`>VjSc}MpTAuO=#^&eB1Dy>vk)pjyf z8xbL+;o)GdnDw(5g9`};9eO@}!*+I4$&nA$0LPo$S1zElF!0-knRg$}Ev zy!wisYcrPUHCQ^v1#_#b^SxvBr8;&b+1U>D1Znu3nztVNHSR@}ODAe>gIG*ZX^c#C z((M6_0{rBftor&Z3%C4l2P2Qaj6e4Bn8`s~w!E6Cli#7cnLJDX(W)xW%8#hdt$Ffd$k0ML#; z7hb5_3pI?mgpF}<15z>-53R`hO2}wi30;g+Qj`*rg ziIyl-LYJiLkJ1Ee zz6ZW-h+AV40y{3r7CoZ(i!p7v#wd7bmwv~Vj5DaO=mK=Tj&}XS@sXbvDncf|ADo;X zob%(va%g_tuytEGY{vf4OlInhgWW%44`RvQ5`|aGROO!{kg$yT&X-bH9R)GiIgGnCc1 z7XHX#p#4R+sZo8qz6c$7G9Q)wMOW8hYom(TdX~CXg<7!y!=}2@JN=?YAJ|fU#!Hr# z%MYYHOIyc&T4Cq#8gf`9|1xu8eYfo;+)IJQBmD*e>-ss@E#y2D3yQ-h3HRsO_Em(i zSb|?mugkT4XlLS?Ib}@I#IhvhW6lc*%u&PvebGZ@BzA|vNXt}iblL@M;i{c!Z30vx ze@K(UbrJawttjYn!#kh>cDYrG8t1JWP0oVZh&eRDjaSD%pL|jBF-bIg5Es~zb-B6gR>8Zpazt5I zs(1|JlVOL~M7*E>mH4#g`TInMnESXY0ZN`;2?mfdb26KjS-2C@0dGZ|2ZZc@>o>rum( zzP}p!`HPj%iyze#MA`A9f=wVJ*H`=mFSoi#BS)Ui4@P>9t5Q(dQ&}`uXXj+FbwqY# z620WM=yhmG&9*tXDog%y*ns;&$6-$R4+i?t3f6i@t(!_37lfk2w4{dO?G#$ipd&{r zlQ*p`=2^N4UJgCQ)5S&wS=!UG7yV$$!zdWb5I}`AaIw4VXgzK3-!O+-iaq|=GO%IH zsPES<^B_bu%%53ug?_7k7$s#;;YkB6myl#P@gZdwKMIAZ!pwN>dVkC zGtnE3Won!h37a1{9CRLp-q9fRu7rF5DPlXq2&MapdLOQ2f+0&2aQtJxl`TFOF96r- z-yo*D*dyx*AYiFnc79Fpo(YK|2FMWz@u1+xd-^0c8K6VdRE}-!?xT|yo-vqU-9AII z9ii4o-Jm7gX?J~Z`D+OGE(ogA{eP5*VYT~Lmz^Q3(c%O)HPv!nJxHTzn@%VT0qxsfUET-wsitU#qdEj6rM z35fF3(&Kx?@Ts%BuKI@#{PQ1ZXLY-C{*0a zhfr_()i-r1r4Jh(e#}y3t*jWiM(Px7FySko--E;#KpYfWh@|Kc$}K!4Imf0&wMr(M z;W7+ebYSS_l6dV zJ4B6+=e@ZMy>j}7c{#Sp=XD+D&JFsHH-xjD((|zr5c+^3+DQz%fq;#6z*L)~2 zMQJaOd=X>9+_yKPLxISUc<)xbV4Fl%6W#ag-WKhx`DomJA$btDeTmMy#OSH{jlDS? zJ*m668&aRWP0WT@zNJCPxisAbXcU}rl}W^`oYPCg@UdUVXpq$pIS+cti^-8}U8dU0 zt{L`Wxt(!7M3tfE=*aXWplJ8wm3)v7P`9+gO+tKI{H40ak!_M-Zs{>VHnt0oh>!;b z3ZSusKPl1VY$UaFg7h#Qr{Can4mcbFOfj>@T8~1sGdNO6@2soC5KuzPSGUPby^anc z$Ma!X77gsr^a414=F;SSfOp9~VYrWg=U zk7P`5NjJS_BL9(eK$t^7FfzE@w5e~;9)SHYkUZRC+(%gRs`YBXeU5RSrkw#H1#-D; zd$LYzP1UoWF`fKjp@9uOhuo)4b)x$E5P{bg;>gtJCOJLNN_yd6M-yN=@CP6cW5khP z%VD01pN=qR1V|hWk&)1mRA+1@A22j}T&$+hT<=gIu|H1TtRKEKluioHXYivZfe;mI z6=>w-HRG$v(tin_3GF}tzFQ5Q?|E|>jT8Ad8$#V<`W^WLpr%_vJgZ=;Mxep=G8Jva}!xhq@J4) zynzAbxT^00RJxP6*pAyRXO`Ncl6FE%#bqTjj3|P>dY){(o7|^XMcTj&@o>MnSf5n^ zH9#lWtrA0~1QwYtf3;5Z9To7T(T(?bm&BfUUmZ*8xJljyS9tr*;z~n@HLdjyd{stE zxRjsPX><|s-abDcyG@8a486df9k6d&R^5)R7H3!9%3_z(?UZJL35s1C&)rIX#HqYJ zUsGooD_A;AWY1pVh+8wC=b$Ne(r1}Qp6c0|@v7!FlT0LeOnh0|`u-s?wN|0y3U@_? z!u8=IQ<6E2+UL0q(vYHl;_+*dLzy#|5_AS~heC-@Q0MAy8cLbt2;!2ffd>kz z8!sLKE84wvZcxGu=r$PD>w5E6B@z`>ua$5_M6WA+L(H-hfZCw~y`YDF@|dBqn*sIA zc4HDJePi)ztnUWzK~A<02W~!i38FrJjC@n|SUf|f^0@lj=#MTg+S^`=;2+r?Aq)f9 z-GkUzRY3K+Eq)oRCqNAW;7Jf|5*{1iQ*8DRI}DwQNkeYg0T4cRhwz2H?q(Jgcn}*$ z-ACAE6ixQOi+{*4M(rrQB~}w#R3*ze%_6Aq7r^h(Ofw^-E0=gH1{aaA&%wDfVrdXug6Q`t3CU z_g1jdUk+(+Ii>UcuFx1j6kd7OtTBah?DC@b*6zA$FYr~TpZE#YoD6TJSUqqqkz!2! zK5MV}Rsx4PbqWg$;#Cwzr=0o(hRukk)aPc_M`^c3s#8~)Dfi9hU}6Lu_W6&*6I7gl zZwx^2DwvwlJr2Obs$J0({4GU7!|I3m8c38eDD`54hef&N;69~Mq*haAbcx1yq6I;MNDww9i*9q_0WS!B8)AoeKZeW z1NCO9{f3B~rnov@IM}kh-$N@Qu}?7ri><0Nj3WA45zMka6+POzsSj2~e%JVxV`Z`< zcM}O0_=*e3D1J~R|M6LvYsuUFgiYvOYN>3?npA)aEl47fHpRjB3Fd09gAmU}zt7Mv z*+=#_r0ohg8OC!yVAIrk78T%jVVwiLnuiR^l{pR_5bMc5VvnA$nG`d}aPVy)$Jj@Jp@~lH zCMSw_*a|5WH86m{TB1_ZJv`1o>-^x9>CuB)O%mErT&gvA?RK%O0Exnroq;{v1cz&j zu%Y5t)jxCfSu?=2kAG@zF}#YV%`Lf8LpiV#WJO{Oq%`dIgxALR?c#AEmr-l=PglUb-Cz9;Z z8W~ejDg{Q;Dva_TW}0qr?S=uN%kQ!b>Y`=`_UhNi2Qs({f}5275HOl~&+NM|7JSZq8CU1m+ZQj03GnR4zH3Xfh;s&cs>WM}luZbKv?6ajP(7SV5y>8%iuB*y>7=SqF+^auQ zMf4iqK-bK1A>f;8GGse){FLdC8N0f^7oQ%tHQe4@iO^MG1DUZ+bE*D-=1zss?ogOUGH=enR1)bd~m&X9E==%gT~s zDJfp#Yag;e!%IB(u9C1)_?i09J1%pO)M`Frlh^#vK*JC70w_yoVU}I~%_S8BBqd=1 zpCgyE9`x4PFSKrTPATOd0E(;4N4F?ho*3iP6ZysNB!l#h%gq|~2j{yZ10tL&ZuaN; z=aW&@A_%&%!P~?hk!~6^u#GKJH$|%gF0r@<4imqw{Dkc{BZ-G`DSH`S%>Y2?-%T9V z;=Sm%Al|u)EX}@EJi1W6DS_{9-h4Sq3gS$K`Q?&7-1fLA+npi+$e4Kj%tW$vnj@_F zpvbC^k9pMT;R(4D)Y8{D4Ls!jWUG6+CtfiB_*k`zX3?m2ILSU~)#J+#{kDPM9k;ej zF^m+vlE5^|zLKyp7L&wfD4|5UxEY4E-nY)ao`^9-F#JG5JPu}_kOnzI@!Mj1juW7J zmq5@-Du0poH}RkhNGo`C&Y#{2sQ|_QPYaFJ17JixnXqX8y|mdWd8c+tlJ_LPyT=7k zG9YQ8K(0RqI7t6ZYRpYP&+E&o+tae@Ibf#Y2EzTj_W z!#hGn9jwf++$t%&WBqmo;tc=mmk$+Bf!>hA+p}iGv%+#9Bdlapg8#lhoB%DR*kTe1 z#8yciT!bY(d$s7!OZ{(lvgiTMdHV>CW&;I?8}U6V`AraxhrFq=*s3bzbLm`VOfmHQ zerQNC3mb%rDOgR0b*^@Rs-jHpb)0X-^w(ISl9k68%|MQdAy5dxFz6xf@bcmN7k_6F zDnoDRc@C8Ha{!VvyBtiW1OI_KfLt7K94T3=bzbMX>*R5`qEwPPReRrO08W@>t;V_6 z8QcY5;ykO+u&%NvL)Gr~+H8Tm-6a4UXL9KjhtJps-Oo1G zh>%^k)Wp*;O+|-Rg8kD^wW@hi{nUSdmV78rKMUAAI*(`eemxbd?%-NgN;}!x`)*|M zf%P0}9hQH5Z{J}aU_D26^U6XV-LL1646vTZrR8ydC*T|ftf#Y=^?TF5mN+H=;H5aX zE%Uw6>1P>ZSwFfB^H5gu{ryg!kPja$5Biawd_M~US)g$OTrb=EA^l+o24H^NGHv~L z08+rtL?0@h_}f`DBakTb|GgQ>Xhw(q1wVezw_Tz|y}mbDi98(67$kL4QoVg zizFEqVn_6T+vf@M+o&@s`DZ!8AE9=>CT?{H76e=Q{{}zTZ#c%Ua#( z8VQUy_JW`@el_@c`Y*MuNc)+_5sR+)i&0}BFw<@4b^uYn?9Y`VRLGUQ94tHG*#{4@ zYt0BMmR~Fvoz0uUufCpAb;w^6t~CDX;*{|P(N&`%F%W5p4*Tj8#_6Hf{i!XTar?!E zV#Gp~(0{hsd=OAR;{Q_O!r--xx;X<|mxJy$piB|Ld)frf4?}!H;IV>!;o80O!I7(mJ=P&7pQkPTpiWZ&3%^7w{sLk(g$fv>>ES&i#yv_sW0ed)Bw+H*3S?%J#r>JwBbc>HUuJ>LllM zFy@oFFb3IqLwU&kE$PIsdGq`sG@pU+L4tmB3b5SN#T0q58_|O;WV@7No%r zF^59rJFrz8kAZ4>Zg0^CWi3uTGg8!vPINhVL>R5uaft{T@Y@ytwqC9}Oqs_b=GVqi zV{q^#LX)-`5mX}Fb}9F(E&>;;W&}LDGN)J5G0Q$l55<$X_>if8G=QWd=U@+VU&oL{ zPBx#|)$CPX?Ppw1=^>4P5csc$*_>8eIAx%%dh>E5jcE603OuW5_>cJse~cWExxo(k zBHwx<#sn#3?p|(36NSAXT52+$o4{IuH%-;gr;Gahx?0-vlbZsHGWk^W&EB^18t%$> z8PAtng?SxJ%ofjnv9%j-_puA2K&t@H?9d_{Q)D6~; zn7?8M`vwLNomEfAyT)SFCa}~LHci35iS7qF9-gb!85q5cQKIR&>HFi);Nt&-yw9`0 zyw9%t(g%(@bkO={S76nk^6^Wo;MyR0GZLR)tH$E*`oH>-2F3lfi;fFRhC7|SeebBh z)X|ppon`%~7j(=1mI5m&-_D7vty79O(F$oMR?cieD`A^otvKqxm&@-m8Tzkc-X`%{ zjZ}KS{0kW)i=`WX6hqvvrD_}(T_?7q>x&gaV3!AmhX!&a=N0*DP9Cz^jO>%zMNzeZ z@mSR^2ddi1QT?EJ0+tQ#i*tRlJ%^*uq~i$9OFrcsv?ApdXSxZltT4Ojln&C*r9%jI z!e9}(pEZ#`;gCO9mbMsi{{0qC)`rp=9Yl+g{9aQ0nyq||Qc@iSH0Pj_x;JpaPwW1L zI!`T98p~w`U+su3@R8oAMd$RWb!{3IW*Fyt)<Zxf>w|HR`$hRf{fe@ql)b1?2_XefOD5)Cj9l6-#CqN>-VlXRq9AaZN^ z**!L7Ni~7*_$+6~Rps$z1*sPif%t3b{$<%NV-{sPk1P!%ZQc5e!wI8_yO zH$7S%9kJ;?BEoa!cMspbpX})1JduqsWM$Zbu0(KpXgl7pGuVy`y%ckJV_dK4m(G5M ze><6rMThUXWqbwubFU)GC|O5eDZMiWu(Al73(dKL2EYfEE^=>zOlIl3HaLh4fjmPcpOH!_Y2j z109t9?~bS6!ho(-fw!W<*Zg~A9}$}QHpu%>?`NlyLN^5zydRq;m-^40e{t?C z_;z_TXyxErtR{DSJfH|2M+a+`a0GuN_n8f@i+ySs=Wxp%)GL%Jw#;^oF+2mbm}S32Kh;6&EoUB&NOX&{Qr52&jc~3oopa|=N&Gi zY_bKhmZvoq-{&wxz+7l%Fui1*mKpW|QMnrRhJM?(bSe_*UMtv+#>NyE^P4pl;d{Su z9noyu^GGhTOPPer$d%p%FbW^;p4TtSnJyJ&atXV>NqPSK&F?1pDF!d(vj#&Q)+#Tz zG1{{lS;lWa&f>qABO2$UH0;#+C5$e98c73r9EyjKAB#H8u}y6`e_oF2M3VceT)-%; z+3Az}D*_j1f4-$Wp{IB*<2%n&5L2BN#B0&KLsz99NsL+SPa_Ax&1*Ed^}DssX0B%X z5gaP3RHWoqj{dJ}6_6{v5UcN{)e1#4yMIB*7S!`(aAm&-tt2Zb3IO=ctuLy2y}v6z z`*@gGsGy}d5&W4-BiEnv+F@*aWkd?WSwj13G=6vPddm`ZemYC03{iZnU%!W?DY(5BAIMbI6M$cZ>*=uw^M?Bo z<`{265R*F|nneXICU?Ho#q2l>j-l?D=7 z>T8jmsek=j`U{LN`B|7WKOSVaH@ zIsYS;Qa`xxGjr9!Y4RMq_NqX-TEV($=8Y5fe)JKRaII&Hbs(W+)Q30au=XBHXMTZ@ zl33^#!)1~|fnF%hn}3l70GG}k6{u^p$Iguyn_V(EBB^L`>OWk5b`a%{v`A*(o0Tp@ zM8kg8y@Ic8vdT-Uk9Ql2s6bawV^ktlj1vsHe@`jkAYHnAVKo%j>2dAskL4e}q+S%X zP8ekZ(8$T;RNTLQBNpn<4x31X^RTk?Mh@n!LJyI!mg926JV!lc$ZB#%iL3{4+L=?x zzL(^=oNJc7Sl853Ytb0@wws}8@o8}IfLfxnG}ogE=94?LChqDA{ReJ*LJs(~qz{oH zBjfzoIJp%WJ^wBEjb8*C1Xa{B=M9z$J^^Y5E+``*_>8UH?Kar#^9>E=PF8#s8`|$u zou~kRB-41$JM+_uiVpv4{(uL&<#AOy@K?Mze#6VmRcdakBrZNR;*kD4j1UhaLCmlY zN^72&eh^!>Cnze9Z=lC*n1eJxAz0aO3n>kwU{YBaPS|zJG`Bq=bQ;Tv`ojvOT{j<@ zDBKol*CjD;7h}~Bdu(KO>drRJ7W8>N#6EjCtR0EmkhNf`hz52;|H71gOTYMOz9U03 z)ZgQrqqXPsA4ip5laa63SE{dqJl6Xf_Tox=D#35hkOShCt>@c@y5}9eGoeADGEaC2 z;@r-@l%F~y_l?VPCSVHGzpzVYY+B73Eg?tqYby2h%x0WF^1i?bntwY`AoE-7dUWxv z!arCvwtztL6PP=3?z$*h{mM?M@^-3sO5-ABDz*{0GDeATGrdRmQ2sl5;T(DL_`eZ`{yvZd>~SDDwf0Yt{lYV*JJ4OM9`Gkvpu+=m(^bSl z*qyJ~#lF^Xg2NyXCba>xM*U0kFHjN;3B+HH1au z6IC5!asB9j=Fou`psAAN!1by`Ade28znfO98-w@LOVx8V<|i4|>HpUA_=FU2;%D!4 zhv=`)=p614Jx)ILDK+Nu@>K4Q8mH0I9f`7=Y>sQ)rWRM4JODmQa;mb$ I(k6lb2O(QlH~;_u diff --git a/pom.xml b/pom.xml index df6ee3b6..c331a3bb 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.xeroapi xero-java jar - 3.0.0-beta-10 + 3.0.1 Xero-Java SDK This is the official Java SDK for Xero API https://github.com/XeroAPI/Xero-Java diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index e933e574..c2c410f3 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -6,6 +6,7 @@ import com.xero.models.accounting.Accounts; import com.xero.models.accounting.Allocations; import com.xero.models.accounting.Attachments; +import com.xero.models.accounting.BankTransaction; import com.xero.models.accounting.BankTransactions; import com.xero.models.accounting.BankTransfers; import com.xero.models.accounting.BatchPayments; @@ -15,16 +16,20 @@ import com.xero.models.accounting.Contact; import com.xero.models.accounting.ContactGroups; import com.xero.models.accounting.Contacts; +import com.xero.models.accounting.CreditNote; import com.xero.models.accounting.CreditNotes; import com.xero.models.accounting.Currencies; import com.xero.models.accounting.Currency; +import com.xero.models.accounting.Employee; import com.xero.models.accounting.Employees; import com.xero.models.accounting.Error; import com.xero.models.accounting.ExpenseClaims; import java.io.File; import com.xero.models.accounting.HistoryRecords; +import com.xero.models.accounting.Invoice; import com.xero.models.accounting.InvoiceReminders; import com.xero.models.accounting.Invoices; +import com.xero.models.accounting.Item; import com.xero.models.accounting.Items; import com.xero.models.accounting.Journals; import com.xero.models.accounting.LinkedTransactions; @@ -38,6 +43,7 @@ import com.xero.models.accounting.PaymentServices; import com.xero.models.accounting.Payments; import com.xero.models.accounting.Prepayments; +import com.xero.models.accounting.PurchaseOrder; import com.xero.models.accounting.PurchaseOrders; import com.xero.models.accounting.Receipts; import com.xero.models.accounting.RepeatingInvoices; @@ -261,16 +267,15 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String acce *

200 - Success - return response of type BankTransactions array with new BankTransaction *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactions The bankTransactions parameter - * @param summarizeErrors response format that shows validation errors for each bank transaction + * @param bankTransaction The bankTransaction parameter * @param accessToken Authorization token for user set in header of each request * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public BankTransactions createBankTransaction(String accessToken, String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + public BankTransactions createBankTransaction(String accessToken, String xeroTenantId, BankTransaction bankTransaction) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createBankTransactionForHttpResponse(accessToken, xeroTenantId, bankTransactions, summarizeErrors); + HttpResponse response = createBankTransactionForHttpResponse(accessToken, xeroTenantId, bankTransaction); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -281,13 +286,13 @@ public BankTransactions createBankTransaction(String accessToken, String xeroTe return null; } - public HttpResponse createBankTransactionForHttpResponse(String accessToken, String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + public HttpResponse createBankTransactionForHttpResponse(String accessToken, String xeroTenantId, BankTransaction bankTransaction) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransaction"); - }// verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransaction"); + }// verify the required parameter 'bankTransaction' is set + if (bankTransaction == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransaction' when calling createBankTransaction"); } if (accessToken == null) { throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createBankTransaction"); @@ -299,17 +304,6 @@ public HttpResponse createBankTransactionForHttpResponse(String accessToken, St String correctPath = "/BankTransactions"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); @@ -317,7 +311,7 @@ public HttpResponse createBankTransactionForHttpResponse(String accessToken, St HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(bankTransactions); + content = apiClient.new JacksonJsonHttpContent(bankTransaction); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -463,6 +457,77 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String acc content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to create a spend or receive money transaction + *

200 - Success - return response of type BankTransactions array with new BankTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param bankTransactions The bankTransactions parameter + * @param summarizeErrors response format that shows validation errors for each bank transaction + * @param accessToken Authorization token for user set in header of each request + * @return BankTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public BankTransactions createBankTransactions(String accessToken, String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createBankTransactionsForHttpResponse(accessToken, xeroTenantId, bankTransactions, summarizeErrors); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createBankTransactionsForHttpResponse(String accessToken, String xeroTenantId, BankTransactions bankTransactions, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createBankTransactions"); + }// verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { + throw new IllegalArgumentException("Missing the required parameter 'bankTransactions' when calling createBankTransactions"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createBankTransactions"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/BankTransactions#bulk"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(bankTransactions); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1185,6 +1250,64 @@ public HttpResponse createContactHistoryForHttpResponse(String accessToken, Str content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + *

200 - Success - return response of type Contacts array with newly created Contact + *

400 - Validation Error - some data was incorrect returns response of type Error + * @param xeroTenantId Xero identifier for Tenant + * @param contacts The contacts parameter + * @param accessToken Authorization token for user set in header of each request + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Contacts createContacts(String accessToken, String xeroTenantId, Contacts contacts) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createContactsForHttpResponse(accessToken, xeroTenantId, contacts); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createContactsForHttpResponse(String accessToken, String xeroTenantId, Contacts contacts) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createContacts"); + }// verify the required parameter 'contacts' is set + if (contacts == null) { + throw new IllegalArgumentException("Missing the required parameter 'contacts' when calling createContacts"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createContacts"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Contacts#bulk"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(contacts); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1197,16 +1320,15 @@ public HttpResponse createContactHistoryForHttpResponse(String accessToken, Str *

200 - Success - return response of type Credit Notes array of newly created CreditNote *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param creditNotes an array of Credit Notes with a single CreditNote object. - * @param summarizeErrors shows validation errors for each credit note + * @param creditNote an array of Credit Notes with a single CreditNote object. * @param accessToken Authorization token for user set in header of each request * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API **/ - public CreditNotes createCreditNote(String accessToken, String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + public CreditNotes createCreditNote(String accessToken, String xeroTenantId, CreditNote creditNote) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createCreditNoteForHttpResponse(accessToken, xeroTenantId, creditNotes, summarizeErrors); + HttpResponse response = createCreditNoteForHttpResponse(accessToken, xeroTenantId, creditNote); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1217,13 +1339,13 @@ public CreditNotes createCreditNote(String accessToken, String xeroTenantId, Cr return null; } - public HttpResponse createCreditNoteForHttpResponse(String accessToken, String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + public HttpResponse createCreditNoteForHttpResponse(String accessToken, String xeroTenantId, CreditNote creditNote) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNote"); - }// verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNote"); + }// verify the required parameter 'creditNote' is set + if (creditNote == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNote' when calling createCreditNote"); } if (accessToken == null) { throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createCreditNote"); @@ -1235,17 +1357,6 @@ public HttpResponse createCreditNoteForHttpResponse(String accessToken, String String correctPath = "/CreditNotes"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); @@ -1253,7 +1364,7 @@ public HttpResponse createCreditNoteForHttpResponse(String accessToken, String HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(creditNotes); + content = apiClient.new JacksonJsonHttpContent(creditNote); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -1467,6 +1578,77 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String accessToken, content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to create a credit note + *

200 - Success - return response of type Credit Notes array of newly created CreditNote + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param creditNotes an array of Credit Notes with a single CreditNote object. + * @param summarizeErrors shows validation errors for each credit note + * @param accessToken Authorization token for user set in header of each request + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public CreditNotes createCreditNotes(String accessToken, String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createCreditNotesForHttpResponse(accessToken, xeroTenantId, creditNotes, summarizeErrors); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createCreditNotesForHttpResponse(String accessToken, String xeroTenantId, CreditNotes creditNotes, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNotes"); + }// verify the required parameter 'creditNotes' is set + if (creditNotes == null) { + throw new IllegalArgumentException("Missing the required parameter 'creditNotes' when calling createCreditNotes"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createCreditNotes"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/CreditNotes#bulk"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(creditNotes); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1536,15 +1718,15 @@ public HttpResponse createCurrencyForHttpResponse(String accessToken, String xe *

200 - Success - return response of type Employees array with new Employee *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param employees The employees parameter + * @param employee The employee parameter * @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 createEmployee(String accessToken, String xeroTenantId, Employees employees) throws IOException { + public Employees createEmployee(String accessToken, String xeroTenantId, Employee employee) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createEmployeeForHttpResponse(accessToken, xeroTenantId, employees); + HttpResponse response = createEmployeeForHttpResponse(accessToken, xeroTenantId, employee); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1555,13 +1737,13 @@ public Employees createEmployee(String accessToken, String xeroTenantId, Employ return null; } - public HttpResponse createEmployeeForHttpResponse(String accessToken, String xeroTenantId, Employees employees) throws IOException { + public HttpResponse createEmployeeForHttpResponse(String accessToken, String xeroTenantId, Employee employee) 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 'employees' is set - if (employees == null) { - throw new IllegalArgumentException("Missing the required parameter 'employees' 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"); @@ -1580,7 +1762,7 @@ public HttpResponse createEmployeeForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(employees); + content = apiClient.new JacksonJsonHttpContent(employee); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -1591,20 +1773,19 @@ public HttpResponse createEmployeeForHttpResponse(String accessToken, String xe } /** - * Allows you to retrieve expense claims - *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim + * Allows you to create new employees used in Xero payrun + *

200 - Success - return response of type Employees array with new Employee *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaims The expenseClaims parameter - * @param summarizeErrors shows validation errors for each expense claim + * @param employees The employees parameter * @param accessToken Authorization token for user set in header of each request - * @return ExpenseClaims + * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public ExpenseClaims createExpenseClaim(String accessToken, String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + public Employees createEmployees(String accessToken, String xeroTenantId, Employees employees) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createExpenseClaimForHttpResponse(accessToken, xeroTenantId, expenseClaims, summarizeErrors); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createEmployeesForHttpResponse(accessToken, xeroTenantId, employees); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1615,35 +1796,24 @@ public ExpenseClaims createExpenseClaim(String accessToken, String xeroTenantId return null; } - public HttpResponse createExpenseClaimForHttpResponse(String accessToken, String xeroTenantId, ExpenseClaims expenseClaims, Boolean summarizeErrors) throws IOException { + public HttpResponse createEmployeesForHttpResponse(String accessToken, String xeroTenantId, Employees employees) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaim"); - }// verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { - throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaim"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createEmployees"); + }// verify the required parameter 'employees' is set + if (employees == null) { + throw new IllegalArgumentException("Missing the required parameter 'employees' when calling createEmployees"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createExpenseClaim"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createEmployees"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/ExpenseClaims"; + String correctPath = "/Employees#bulk"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); @@ -1651,7 +1821,7 @@ public HttpResponse createExpenseClaimForHttpResponse(String accessToken, Strin HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(expenseClaims); + content = apiClient.new JacksonJsonHttpContent(employees); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -1721,6 +1891,65 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String accessToken, content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to retrieve expense claims + *

200 - Success - return response of type ExpenseClaims array with newly created ExpenseClaim + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param expenseClaims The expenseClaims parameter + * @param accessToken Authorization token for user set in header of each request + * @return ExpenseClaims + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ExpenseClaims createExpenseClaims(String accessToken, String xeroTenantId, ExpenseClaims expenseClaims) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createExpenseClaimsForHttpResponse(accessToken, xeroTenantId, expenseClaims); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createExpenseClaimsForHttpResponse(String accessToken, String xeroTenantId, ExpenseClaims expenseClaims) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createExpenseClaims"); + }// verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { + throw new IllegalArgumentException("Missing the required parameter 'expenseClaims' when calling createExpenseClaims"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createExpenseClaims"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/ExpenseClaims"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(expenseClaims); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1733,16 +1962,16 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String accessToken, *

200 - Success - return response of type Invoices array with newly created Invoice *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param invoices The invoices parameter + * @param invoice The invoice parameter * @param summarizeErrors shows validation errors for each invoice * @param accessToken Authorization token for user set in header of each request * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices createInvoice(String accessToken, String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + public Invoices createInvoice(String accessToken, String xeroTenantId, Invoice invoice, Boolean summarizeErrors) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createInvoiceForHttpResponse(accessToken, xeroTenantId, invoices, summarizeErrors); + HttpResponse response = createInvoiceForHttpResponse(accessToken, xeroTenantId, invoice, summarizeErrors); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1753,13 +1982,13 @@ public Invoices createInvoice(String accessToken, String xeroTenantId, Invoices return null; } - public HttpResponse createInvoiceForHttpResponse(String accessToken, String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + public HttpResponse createInvoiceForHttpResponse(String accessToken, String xeroTenantId, Invoice invoice, Boolean summarizeErrors) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); - }// verify the required parameter 'invoices' is set - if (invoices == null) { - throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoice"); + }// verify the required parameter 'invoice' is set + if (invoice == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoice' when calling createInvoice"); } if (accessToken == null) { throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createInvoice"); @@ -1789,7 +2018,7 @@ public HttpResponse createInvoiceForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(invoices); + content = apiClient.new JacksonJsonHttpContent(invoice); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -1935,6 +2164,77 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String accessToken, Str content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to create any sales invoices or purchase bills + *

200 - Success - return response of type Invoices array with newly created Invoice + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param invoices The invoices parameter + * @param summarizeErrors shows validation errors for each invoice + * @param accessToken Authorization token for user set in header of each request + * @return Invoices + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Invoices createInvoices(String accessToken, String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createInvoicesForHttpResponse(accessToken, xeroTenantId, invoices, summarizeErrors); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createInvoicesForHttpResponse(String accessToken, String xeroTenantId, Invoices invoices, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoices"); + }// verify the required parameter 'invoices' is set + if (invoices == null) { + throw new IllegalArgumentException("Missing the required parameter 'invoices' when calling createInvoices"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createInvoices"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Invoices#bulk"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(invoices); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1947,15 +2247,15 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String accessToken, Str *

200 - Success - return response of type Items array with newly created Item *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param items The items parameter + * @param item The item parameter * @param accessToken Authorization token for user set in header of each request * @return Items * @throws IOException if an error occurs while attempting to invoke the API **/ - public Items createItem(String accessToken, String xeroTenantId, Items items) throws IOException { + public Items createItem(String accessToken, String xeroTenantId, Item item) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createItemForHttpResponse(accessToken, xeroTenantId, items); + HttpResponse response = createItemForHttpResponse(accessToken, xeroTenantId, item); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1966,13 +2266,13 @@ public Items createItem(String accessToken, String xeroTenantId, Items items) t return null; } - public HttpResponse createItemForHttpResponse(String accessToken, String xeroTenantId, Items items) throws IOException { + public HttpResponse createItemForHttpResponse(String accessToken, String xeroTenantId, Item item) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem"); - }// verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItem"); + }// verify the required parameter 'item' is set + if (item == null) { + throw new IllegalArgumentException("Missing the required parameter 'item' when calling createItem"); } if (accessToken == null) { throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createItem"); @@ -1991,7 +2291,7 @@ public HttpResponse createItemForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(items); + content = apiClient.new JacksonJsonHttpContent(item); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -2061,6 +2361,65 @@ public HttpResponse createItemHistoryForHttpResponse(String accessToken, String content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to create an item + *

200 - Success - return response of type Items array with newly created Item + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param items The items parameter + * @param accessToken Authorization token for user set in header of each request + * @return Items + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Items createItems(String accessToken, String xeroTenantId, Items items) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createItemsForHttpResponse(accessToken, xeroTenantId, items); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createItemsForHttpResponse(String accessToken, String xeroTenantId, Items items) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItems"); + }// verify the required parameter 'items' is set + if (items == null) { + throw new IllegalArgumentException("Missing the required parameter 'items' when calling createItems"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createItems"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Items#bulk"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(items); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2724,16 +3083,15 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String accessToken, *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrders The purchaseOrders parameter - * @param summarizeErrors shows validation errors for each purchase order. + * @param purchaseOrder The purchaseOrder parameter * @param accessToken Authorization token for user set in header of each request * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API **/ - public PurchaseOrders createPurchaseOrder(String accessToken, String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + public PurchaseOrders createPurchaseOrder(String accessToken, String xeroTenantId, PurchaseOrder purchaseOrder) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createPurchaseOrderForHttpResponse(accessToken, xeroTenantId, purchaseOrders, summarizeErrors); + HttpResponse response = createPurchaseOrderForHttpResponse(accessToken, xeroTenantId, purchaseOrder); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -2744,13 +3102,13 @@ public PurchaseOrders createPurchaseOrder(String accessToken, String xeroTenant return null; } - public HttpResponse createPurchaseOrderForHttpResponse(String accessToken, String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + public HttpResponse createPurchaseOrderForHttpResponse(String accessToken, String xeroTenantId, PurchaseOrder purchaseOrder) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrder"); - }// verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { - throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrder"); + }// verify the required parameter 'purchaseOrder' is set + if (purchaseOrder == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrder' when calling createPurchaseOrder"); } if (accessToken == null) { throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPurchaseOrder"); @@ -2762,17 +3120,6 @@ public HttpResponse createPurchaseOrderForHttpResponse(String accessToken, Stri String correctPath = "/PurchaseOrders"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); @@ -2780,7 +3127,7 @@ public HttpResponse createPurchaseOrderForHttpResponse(String accessToken, Stri HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + content = apiClient.new JacksonJsonHttpContent(purchaseOrder); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -2851,6 +3198,77 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String accessToken content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to create purchase orders + *

200 - Success - return response of type PurchaseOrder array for specified PurchaseOrder + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param purchaseOrders The purchaseOrders parameter + * @param summarizeErrors shows validation errors for each purchase order. + * @param accessToken Authorization token for user set in header of each request + * @return PurchaseOrders + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PurchaseOrders createPurchaseOrders(String accessToken, String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createPurchaseOrdersForHttpResponse(accessToken, xeroTenantId, purchaseOrders, summarizeErrors); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createPurchaseOrdersForHttpResponse(String accessToken, String xeroTenantId, PurchaseOrders purchaseOrders, Boolean summarizeErrors) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPurchaseOrders"); + }// verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { + throw new IllegalArgumentException("Missing the required parameter 'purchaseOrders' when calling createPurchaseOrders"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPurchaseOrders"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/PurchaseOrders#bulk"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (summarizeErrors != null) { + String key = "SummarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6023,7 +6441,7 @@ public HttpResponse getContactHistoryForHttpResponse(String accessToken, String * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API **/ - public Contacts getContacts(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + public Contacts getContacts(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, List ids, Integer page, Boolean includeArchived) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getContactsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, ids, page, includeArchived); @@ -6037,7 +6455,7 @@ public Contacts getContacts(String accessToken, String xeroTenantId, OffsetDate return null; } - public HttpResponse getContactsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, Integer page, Boolean includeArchived) throws IOException { + public HttpResponse getContactsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, List ids, Integer page, Boolean includeArchived) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getContacts"); @@ -7516,7 +7934,7 @@ public HttpResponse getInvoiceRemindersForHttpResponse(String accessToken, Stri * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices getInvoices(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + public Invoices getInvoices(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, List ids, List invoiceNumbers, List contactIDs, List statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getInvoicesForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); @@ -7530,7 +7948,7 @@ public Invoices getInvoices(String accessToken, String xeroTenantId, OffsetDate return null; } - public HttpResponse getInvoicesForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, String ids, String invoiceNumbers, String contactIDs, String statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { + public HttpResponse getInvoicesForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, List ids, List invoiceNumbers, List contactIDs, List statuses, Integer page, Boolean includeArchived, Boolean createdByMyApp, Integer unitdp) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getInvoices"); diff --git a/src/main/java/com/xero/example/AuthenticatedResource.java b/src/main/java/com/xero/example/AuthenticatedResource.java deleted file mode 100755 index b75e7157..00000000 --- a/src/main/java/com/xero/example/AuthenticatedResource.java +++ /dev/null @@ -1,2537 +0,0 @@ -package com.xero.example; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Base64; -import java.util.Calendar; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.auth0.jwt.JWT; -import com.auth0.jwt.exceptions.JWTDecodeException; -import com.auth0.jwt.interfaces.DecodedJWT; -import com.google.api.client.auth.oauth2.ClientParametersAuthentication; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.auth.oauth2.RefreshTokenRequest; -import com.google.api.client.auth.oauth2.TokenResponse; -import com.google.api.client.auth.oauth2.TokenResponseException; -import com.google.api.client.http.BasicAuthentication; -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.jackson2.JacksonFactory; -import com.xero.api.*; -import com.xero.models.accounting.*; -import com.xero.models.accounting.Invoice.TypeEnum; -import com.xero.models.accounting.Phone.PhoneTypeEnum; -import com.xero.api.client.AccountingApi; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.threeten.bp.*; - -@WebServlet("/AuthenticatedResource") -public class AuthenticatedResource extends HttpServlet { - private static final long serialVersionUID = 1L; - final static Logger logger = LogManager.getLogger(AuthenticatedResource.class); - private AccountingApi accountingApi = null; - - private String htmlString = "" - + "" - + "" - + "

Xero API - JAVA

" + "
" - + "Logout" + "
" - + "
" + "
" - + "" - + "" + "
" + "
" - + "" + "
" + "
"; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - PrintWriter respWriter = response.getWriter(); - response.setStatus(200); - response.setContentType("text/html"); - respWriter.println(htmlString); - } - - @SuppressWarnings("null") - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - OffsetDateTime ifModifiedSince = null; - String where = null; - String order = null; - boolean summarizeErrors = false; - String ids = null; - boolean includeArchived = false; - String invoiceNumbers = null; - String contactIDs = null; - String statuses = null; - boolean createdByMyApp = false; - int unitDp = 2; - Calendar now = Calendar.getInstance(); - int day = now.get(Calendar.DATE); - int year = now.get(Calendar.YEAR); - int lastMonth = now.get(Calendar.MONTH) - 1; - int nextMonth = now.get(Calendar.MONTH) + 1; - if (lastMonth == 0) { - lastMonth = 1; - } - if (lastMonth == -1) { - lastMonth = 12; - year = year - 1; - } - if (nextMonth == 13) { - nextMonth = 1; - year = year + 1; - } - if (day > 28) { - day = 28; - } - - PrintWriter respWriter = response.getWriter(); - response.setStatus(200); - response.setContentType("text/html"); - respWriter.println(htmlString); - respWriter.println("

begin processing request
"); - - String object = request.getParameter("object"); - ArrayList messages = new ArrayList(); - - // Get Tokens and Xero Tenant Id from Storage - TokenStorage store = new TokenStorage(); - String savedAccessToken = store.get(request, "access_token"); - String savedRefreshToken = store.get(request, "refresh_token"); - String xeroTenantId = store.get(request, "xero_tenant_id"); - - // Check expiration of token and refresh if necessary - // This should be done prior to each API call to ensure your accessToken is - // valid - String accessToken = new TokenRefresh().checkToken(savedAccessToken, savedRefreshToken, response); - - // Init AccountingApi client - ApiClient defaultClient = new ApiClient(); - // Get Singleton - instance of accounting client - accountingApi = AccountingApi.getInstance(defaultClient); - - if (object.equals("debug")) { - - /* - * Invoices invoices = new Invoices(); Invoice invoice = new Invoice(); LineItem - * li = new LineItem(); li.setLineAmount(100.00); - * - * invoice.setType(TypeEnum.ACCREC); invoice.setReference("hello world"); - * invoice.addLineItemsItem(li); - * - * Contact contact1 = new Contact(); contact1.setName("Mr. Sid Maestre" + - * this.loadRandomNum()); invoice.setContact(contact1); - * invoices.addInvoicesItem(invoice); - * - * Invoices newInvoices = accountingApi.createInvoice(accessToken, xeroTenantId, - * invoices, false); System.out.println("New Invoice created"); - * System.out.println(newInvoices.toString()); - */ - - } else if (object.equals("Accounts")) { - // ACCOUNTS - try { - // GET all accounts - Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, null, null, null); - messages.add("Get a all Accounts - total : " + accounts.getAccounts().size()); - - // GET one account - Accounts oneAccount = accountingApi.getAccount(accessToken, xeroTenantId, - accounts.getAccounts().get(0).getAccountID()); - messages.add("Get a one Account - name : " + oneAccount.getAccounts().get(0).getName()); - - // CREATE account - Account acct = new Account(); - acct.setName("Bye" + loadRandomNum()); - acct.setCode("Hello" + loadRandomNum()); - acct.setDescription("Foo boo"); - acct.setType(com.xero.models.accounting.AccountType.EXPENSE); - Accounts newAccount = accountingApi.createAccount(accessToken, xeroTenantId, acct); - messages.add("Create a new Account - Name : " + newAccount.getAccounts().get(0).getName() - + " Description : " + newAccount.getAccounts().get(0).getDescription() + ""); - UUID accountID = newAccount.getAccounts().get(0).getAccountID(); - - // CREATE Bank account - Account bankAcct = new Account(); - bankAcct.setName("Checking " + loadRandomNum()); - bankAcct.setCode("12" + loadRandomNum()); - bankAcct.setType(com.xero.models.accounting.AccountType.BANK); - bankAcct.setBankAccountNumber("1234" + loadRandomNum()); - Accounts newBankAccount = accountingApi.createAccount(accessToken, xeroTenantId, bankAcct); - messages.add("Create Bank Account - Name : " + newBankAccount.getAccounts().get(0).getName()); - - // GET BANK account - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, - order); - messages.add("Get a all Accounts - total : " + accountsWhere.getAccounts().size()); - - // UDPATE Account - newAccount.getAccounts().get(0).setDescription("Monsters Inc."); - newAccount.getAccounts().get(0).setStatus(null); - Accounts updateAccount = accountingApi.updateAccount(accessToken, xeroTenantId, accountID, newAccount); - messages.add("Update Account - Name : " + updateAccount.getAccounts().get(0).getName() - + " Description : " + updateAccount.getAccounts().get(0).getDescription() + ""); - - // ARCHIVE Account - Accounts archiveAccounts = new Accounts(); - Account archiveAccount = new Account(); - archiveAccount.setStatus(com.xero.models.accounting.Account.StatusEnum.ARCHIVED); - archiveAccount.setAccountID(accountID); - archiveAccounts.addAccountsItem(archiveAccount); - Accounts achivedAccount = accountingApi.updateAccount(accessToken, xeroTenantId, accountID, - archiveAccounts); - messages.add("Archived Account - Name : " + achivedAccount.getAccounts().get(0).getName() + " Status: " - + achivedAccount.getAccounts().get(0).getStatus()); - - // DELETE Account - UUID deleteAccountID = newAccount.getAccounts().get(0).getAccountID(); - Accounts deleteAccount = accountingApi.deleteAccount(accessToken, xeroTenantId, deleteAccountID); - messages.add("Delete account - Status? : " + deleteAccount.getAccounts().get(0).getStatus()); - - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("GetAttachments")) { - - try { - // GET Account Attachment - where = "Status==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); - if (accounts.getAccounts().size() > 0) { - UUID accountID = accounts.getAccounts().get(0).getAccountID(); - Attachments accountsAttachments = accountingApi.getAccountAttachments(accessToken, xeroTenantId, - accountID); - if (accountsAttachments.getAttachments().size() > 0) { - UUID attachementId = accountsAttachments.getAttachments().get(0).getAttachmentID(); - String contentType = accountsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream input = accountingApi.getAccountAttachmentById(accessToken, xeroTenantId, - accountID, attachementId, contentType); - String fileName = "Account_" + accountsAttachments.getAttachments().get(0).getFileName(); - String saveFilePath = saveFile(input, fileName); - messages.add("Get Account attachment - save it here: " + saveFilePath); - } - } - - // GET BankTransactions Attachment - where = null; - BankTransactions bankTransactions = accountingApi.getBankTransactions(accessToken, xeroTenantId, - ifModifiedSince, where, order, null, null); - if (bankTransactions.getBankTransactions().size() > 0) { - UUID BankTransactionID = bankTransactions.getBankTransactions().get(0).getBankTransactionID(); - Attachments bankTransactionsAttachments = accountingApi.getBankTransactionAttachments(accessToken, - xeroTenantId, BankTransactionID); - if (bankTransactionsAttachments.getAttachments().size() > 0) { - UUID BankTransactionAttachementID = bankTransactionsAttachments.getAttachments().get(0) - .getAttachmentID(); - String BankTransactionContentType = bankTransactionsAttachments.getAttachments().get(0) - .getMimeType(); - ByteArrayInputStream BankTransactionInput = accountingApi.getAccountAttachmentById(accessToken, - xeroTenantId, BankTransactionID, BankTransactionAttachementID, - BankTransactionContentType); - String BankTransactionFileName = "BankTransaction_" - + bankTransactionsAttachments.getAttachments().get(0).getFileName(); - String BankTransactionSaveFilePath = saveFile(BankTransactionInput, BankTransactionFileName); - messages.add("Get BankTransactions attachment - save it here: " + BankTransactionSaveFilePath); - } - } - - // GET BankTransfers Attachment - BankTransfers bankTransfers = accountingApi.getBankTransfers(accessToken, xeroTenantId, ifModifiedSince, - where, order); - if (bankTransfers.getBankTransfers().size() > 0) { - UUID BankTransferID = bankTransfers.getBankTransfers().get(0).getBankTransferID(); - Attachments bankTransfersAttachments = accountingApi.getBankTransferAttachments(accessToken, - xeroTenantId, BankTransferID); - if (bankTransfersAttachments.getAttachments().size() > 0) { - UUID BankTransferAttachementID = bankTransfersAttachments.getAttachments().get(0) - .getAttachmentID(); - String BankTransferContentType = bankTransfersAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream BankTransferInput = accountingApi.getAccountAttachmentById(accessToken, - xeroTenantId, BankTransferID, BankTransferAttachementID, BankTransferContentType); - String BankTransferFileName = "BankTransfer_" - + bankTransfersAttachments.getAttachments().get(0).getFileName(); - String BankTransferSaveFilePath = saveFile(BankTransferInput, BankTransferFileName); - messages.add("Get BankTransfers attachment - save it here: " + BankTransferSaveFilePath); - } - } - // GET Contacts Attachment - where = "ContactStatus==\"ACTIVE\""; - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, null, includeArchived); - if (contacts.getContacts().size() > 0) { - UUID ContactID = contacts.getContacts().get(0).getContactID(); - Attachments contactsAttachments = accountingApi.getContactAttachments(accessToken, xeroTenantId, - ContactID); - if (contactsAttachments.getAttachments().size() > 0) { - UUID ContactAttachementID = contactsAttachments.getAttachments().get(0).getAttachmentID(); - String ContactContentType = contactsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream ContactInput = accountingApi.getAccountAttachmentById(accessToken, - xeroTenantId, ContactID, ContactAttachementID, ContactContentType); - String ContactFileName = "Contact_" + contactsAttachments.getAttachments().get(0).getFileName(); - String ContactSaveFilePath = saveFile(ContactInput, ContactFileName); - messages.add("Get Contacts attachment - save it here: " + ContactSaveFilePath); - } - } - // GET CreditNotes Attachment - where = "Status==\"AUTHORISED\""; - CreditNotes creditNotes = accountingApi.getCreditNotes(accessToken, xeroTenantId, ifModifiedSince, - where, order, null); - if (creditNotes.getCreditNotes().size() > 0) { - UUID CreditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - Attachments creditNotesAttachments = accountingApi.getCreditNoteAttachments(accessToken, - xeroTenantId, CreditNoteID); - if (creditNotesAttachments.getAttachments().size() > 0) { - UUID CreditNoteAttachementID = creditNotesAttachments.getAttachments().get(0).getAttachmentID(); - String CreditNoteContentType = creditNotesAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream CreditNoteInput = accountingApi.getAccountAttachmentById(accessToken, - xeroTenantId, CreditNoteID, CreditNoteAttachementID, CreditNoteContentType); - String CreditNoteFileName = "CreditNote_" - + creditNotesAttachments.getAttachments().get(0).getFileName(); - String CreditNoteSaveFilePath = saveFile(CreditNoteInput, CreditNoteFileName); - messages.add("Get CreditNotes attachment - save it here: " + CreditNoteSaveFilePath); - } - } - - // GET Invoices Attachment - Invoices invoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - if (invoices.getInvoices().size() > 0) { - UUID InvoiceID = invoices.getInvoices().get(0).getInvoiceID(); - Attachments invoicesAttachments = accountingApi.getInvoiceAttachments(accessToken, xeroTenantId, - InvoiceID); - if (invoicesAttachments.getAttachments().size() > 0) { - UUID InvoiceAttachementID = invoicesAttachments.getAttachments().get(0).getAttachmentID(); - String InvoiceContentType = invoicesAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream InvoiceInput = accountingApi.getAccountAttachmentById(accessToken, - xeroTenantId, InvoiceID, InvoiceAttachementID, InvoiceContentType); - String InvoiceFileName = "Invoice_" + invoicesAttachments.getAttachments().get(0).getFileName(); - String InvoiceSaveFilePath = saveFile(InvoiceInput, InvoiceFileName); - messages.add("Get Invoices attachment - save it here: " + InvoiceSaveFilePath); - } - } - - // GET ManualJournals Attachment - where = null; - ManualJournals manualJournals = accountingApi.getManualJournals(accessToken, xeroTenantId, - ifModifiedSince, where, order, null); - if (manualJournals.getManualJournals().size() > 0) { - UUID ManualJournalID = manualJournals.getManualJournals().get(0).getManualJournalID(); - Attachments manualJournalsAttachments = accountingApi.getManualJournalAttachments(accessToken, - xeroTenantId, ManualJournalID); - if (manualJournalsAttachments.getAttachments().size() > 0) { - UUID ManualJournalAttachementID = manualJournalsAttachments.getAttachments().get(0) - .getAttachmentID(); - String ManualJournalContentType = manualJournalsAttachments.getAttachments().get(0) - .getMimeType(); - ByteArrayInputStream ManualJournalInput = accountingApi.getAccountAttachmentById(accessToken, - xeroTenantId, ManualJournalID, ManualJournalAttachementID, ManualJournalContentType); - String ManualJournalFileName = "ManualJournal_" - + manualJournalsAttachments.getAttachments().get(0).getFileName(); - String ManualJournalSaveFilePath = saveFile(ManualJournalInput, ManualJournalFileName); - messages.add("Get ManualJournals attachment - save it here: " + ManualJournalSaveFilePath); - } - } - - // GET Receipts Attachment - Receipts receipts = accountingApi.getReceipts(accessToken, xeroTenantId, ifModifiedSince, where, order, - null); - if (receipts.getReceipts().size() > 0) { - UUID ReceiptID = receipts.getReceipts().get(0).getReceiptID(); - Attachments receiptsAttachments = accountingApi.getReceiptAttachments(accessToken, xeroTenantId, - ReceiptID); - if (receiptsAttachments.getAttachments().size() > 0) { - UUID ReceiptAttachementID = receiptsAttachments.getAttachments().get(0).getAttachmentID(); - String ReceiptContentType = receiptsAttachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream ReceiptInput = accountingApi.getAccountAttachmentById(accessToken, - xeroTenantId, ReceiptID, ReceiptAttachementID, ReceiptContentType); - String ReceiptFileName = "Receipt_" + receiptsAttachments.getAttachments().get(0).getFileName(); - String ReceiptSaveFilePath = saveFile(ReceiptInput, ReceiptFileName); - messages.add("Get Receipts attachment - save it here: " + ReceiptSaveFilePath); - } - } - - // GET RepeatingInvoices Attachment - RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(accessToken, xeroTenantId, - where, order); - if (repeatingInvoices.getRepeatingInvoices().size() > 0) { - UUID RepeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - Attachments repeatingInvoicesAttachments = accountingApi.getRepeatingInvoiceAttachments(accessToken, - xeroTenantId, RepeatingInvoiceID); - if (repeatingInvoicesAttachments.getAttachments().size() > 0) { - UUID RepeatingInvoiceAttachementID = repeatingInvoicesAttachments.getAttachments().get(0) - .getAttachmentID(); - String RepeatingInvoiceContentType = repeatingInvoicesAttachments.getAttachments().get(0) - .getMimeType(); - ByteArrayInputStream RepeatingInvoiceInput = accountingApi.getAccountAttachmentById(accessToken, - xeroTenantId, RepeatingInvoiceID, RepeatingInvoiceAttachementID, - RepeatingInvoiceContentType); - String RepeatingInvoiceFileName = "RepeatingInvoice_" - + repeatingInvoicesAttachments.getAttachments().get(0).getFileName(); - String RepeatingInvoiceSaveFilePath = saveFile(RepeatingInvoiceInput, RepeatingInvoiceFileName); - messages.add( - "Get RepeatingInvoices attachment - save it here: " + RepeatingInvoiceSaveFilePath); - } - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("CreateAttachments")) { - // JSON - File bytes = new File("/Users/sid.maestre/eclipse-workspace/xero-sdk-oauth2-dev-01/resources/youngsid.jpg"); - String newFileName = bytes.getName(); - - try { - // CREATE Accounts attachment - where = "Status==\"ACTIVE\""; - Accounts myAccounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, - order); - if (myAccounts.getAccounts().size() > 0) { - UUID accountID = myAccounts.getAccounts().get(0).getAccountID(); - String accountName = myAccounts.getAccounts().get(0).getName(); - Attachments createdAttachments = accountingApi.createAccountAttachmentByFileName(accessToken, - xeroTenantId, accountID, newFileName, bytes); - messages.add("Attachment to Name: " + accountName + " Account ID: " + accountID - + " attachment - ID: " + createdAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - where = null; - // CREATE BankTransactions attachment - BankTransactions myBanktransactions = accountingApi.getBankTransactions(accessToken, xeroTenantId, - ifModifiedSince, where, order, null, null); - if (myBanktransactions.getBankTransactions().size() > 0) { - UUID banktransactionID = myBanktransactions.getBankTransactions().get(0).getBankTransactionID(); - Attachments createdBanktransationAttachments = accountingApi - .createBankTransactionAttachmentByFileName(accessToken, xeroTenantId, banktransactionID, - newFileName, bytes); - messages.add("Attachment to BankTransaction ID: " + banktransactionID + " attachment - ID: " - + createdBanktransationAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE BankTransfer attachment - BankTransfers myBankTransfer = accountingApi.getBankTransfers(accessToken, xeroTenantId, - ifModifiedSince, where, order); - if (myBankTransfer.getBankTransfers().size() > 0) { - UUID bankTransferID = myBankTransfer.getBankTransfers().get(0).getBankTransferID(); - Attachments createdBankTransferAttachments = accountingApi.createBankTransferAttachmentByFileName( - accessToken, xeroTenantId, bankTransferID, newFileName, bytes); - messages.add("Attachment to BankTransfer ID: " + bankTransferID + " attachment - ID: " - + createdBankTransferAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE Contacts attachment - where = "ContactStatus==\"ACTIVE\""; - Contacts contactsWhere = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, - order, ids, null, includeArchived); - if (contactsWhere.getContacts().size() > 0) { - UUID contactID = contactsWhere.getContacts().get(0).getContactID(); - Attachments createdContactAttachments = accountingApi.createContactAttachmentByFileName(accessToken, - xeroTenantId, contactID, newFileName, bytes); - messages.add("Attachment to Contact ID: " + contactID + " attachment - ID: " - + createdContactAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - where = "Status==\"AUTHORISED\""; - // CREATE CreditNotes attachment - CreditNotes myCreditNotes = accountingApi.getCreditNotes(accessToken, xeroTenantId, ifModifiedSince, - where, order, null); - if (myCreditNotes.getCreditNotes().size() > 0) { - UUID creditNoteID = myCreditNotes.getCreditNotes().get(0).getCreditNoteID(); - Attachments createdCreditNoteAttachments = accountingApi.createCreditNoteAttachmentByFileName( - accessToken, xeroTenantId, creditNoteID, newFileName, bytes); - messages.add("Attachment to Credit Notes ID: " + creditNoteID + " attachment - ID: " - + createdCreditNoteAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE invoice attachment - Invoices myInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, - order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - if (myInvoices.getInvoices().size() > 0) { - UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); - Attachments createdInvoiceAttachments = accountingApi.createInvoiceAttachmentByFileName(accessToken, - xeroTenantId, invoiceID, newFileName, bytes); - messages.add("Attachment to Invoice ID: " + invoiceID + " attachment - ID: " - + createdInvoiceAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE ManualJournals attachment - where = null; - ManualJournals myManualJournals = accountingApi.getManualJournals(accessToken, xeroTenantId, - ifModifiedSince, where, order, null); - System.out.println(myManualJournals.getManualJournals().size()); - - if (myManualJournals.getManualJournals().size() > 0) { - UUID manualJournalID = myManualJournals.getManualJournals().get(0).getManualJournalID(); - Attachments createdManualJournalAttachments = accountingApi.createManualJournalAttachmentByFileName( - accessToken, xeroTenantId, manualJournalID, newFileName, bytes); - messages.add("Attachment to Manual Journal ID: " + manualJournalID + " attachment - ID: " - + createdManualJournalAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE Receipts attachment - Receipts myReceipts = accountingApi.getReceipts(accessToken, xeroTenantId, ifModifiedSince, where, - order, null); - if (myReceipts.getReceipts().size() > 0) { - UUID receiptID = myReceipts.getReceipts().get(0).getReceiptID(); - Attachments createdReceiptsAttachments = accountingApi.createReceiptAttachmentByFileName( - accessToken, xeroTenantId, receiptID, newFileName, bytes); - messages.add("Attachment to Receipt ID: " + receiptID + " attachment - ID: " - + createdReceiptsAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - // CREATE Repeating Invoices attachment - RepeatingInvoices myRepeatingInvoices = accountingApi.getRepeatingInvoices(accessToken, xeroTenantId, - where, order); - if (myRepeatingInvoices.getRepeatingInvoices().size() > 0) { - UUID repeatingInvoiceID = myRepeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - Attachments createdRepeatingInvoiceAttachments = accountingApi - .createRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, - newFileName, bytes); - messages.add("Attachment to Repeating Invoices ID: " + repeatingInvoiceID + " attachment - ID: " - + createdRepeatingInvoiceAttachments.getAttachments().get(0).getAttachmentID()); - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - } else if (object.equals("BankTransfers")) { - /* BANK TRANSFER */ - try { - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, - order); - where = null; - // Maker sure we have at least 2 banks - if (accountsWhere.getAccounts().size() > 1) { - // CREATE bank transfer - BankTransfer bankTransfer = new BankTransfer(); - bankTransfer.setFromBankAccount(accountsWhere.getAccounts().get(1)); - bankTransfer.setToBankAccount(accountsWhere.getAccounts().get(0)); - bankTransfer.setAmount("50.00"); - BankTransfers newBTs = new BankTransfers(); - newBTs.addBankTransfersItem(bankTransfer); - BankTransfers newBankTranfer = accountingApi.createBankTransfer(accessToken, xeroTenantId, newBTs); - messages.add("Get a one Bank Transfer - amount : " - + newBankTranfer.getBankTransfers().get(0).getAmount()); - - // GET all Bank Transfers - BankTransfers bankTranfers = accountingApi.getBankTransfers(accessToken, xeroTenantId, - ifModifiedSince, where, order); - messages.add("Get a all Bank Transfers - total : " + bankTranfers.getBankTransfers().size()); - UUID bankTransferId = bankTranfers.getBankTransfers().get(0).getBankTransferID(); - - // GET one Bank Transfer - BankTransfers oneBankTranfer = accountingApi.getBankTransfer(accessToken, xeroTenantId, - bankTransferId); - messages.add("Get a one Bank Transfer - amount : " - + oneBankTranfer.getBankTransfers().get(0).getAmount()); - - // GET Bank Transfer History - HistoryRecords hr = accountingApi.getBankTransferHistory(accessToken, xeroTenantId, bankTransferId); - messages.add("Get a one Bank Transfer History Record - details :" - + hr.getHistoryRecords().get(0).getDetails()); - - // CREATE Bank Transfer History - // Error: "The document with the supplied id was not found for this endpoint. - /* - * HistoryRecords historyRecords = new HistoryRecords(); HistoryRecord - * historyRecord = new HistoryRecord(); - * historyRecord.setDetails("This is a sample history note"); - * historyRecords.addHistoryRecordsItem(historyRecord); HistoryRecords newHr = - * accountingApi.createBankTransferHistoryRecord(bankTransferId, - * historyRecords); - * messages.add("Get a one Bank Transfer History Record - details :" + - * newHr.getHistoryRecords().get(0).getDetails()); - */ - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("BankTransactions")) { - /* BANK TRANSACTION */ - try { - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, - order); - - Account bankAcct = new Account(); - bankAcct.setCode(accountsWhere.getAccounts().get(0).getCode()); - - where = null; - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // Maker sure we have at least 1 bank - if (accountsWhere.getAccounts().size() > 0) { - // Create Bank Transaction - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode("400"); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setUnitAmount(20.0); - lineItems.add(li); - BankTransaction bt = new BankTransaction(); - bt.setBankAccount(bankAcct); - bt.setContact(useContact); - bt.setLineItems(lineItems); - bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.SPEND); - BankTransactions bts = new BankTransactions(); - bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(accessToken, xeroTenantId, - bts, summarizeErrors); - messages.add("Create new BankTransaction : amount:" - + newBankTransaction.getBankTransactions().get(0).getTotal()); - - // GET all Bank Transaction - BankTransactions bankTransactions = accountingApi.getBankTransactions(accessToken, xeroTenantId, - ifModifiedSince, where, order, null, null); - messages.add( - "Get a all Bank Transactions - total : " + bankTransactions.getBankTransactions().size()); - - // GET one Bank Transaction - BankTransactions oneBankTransaction = accountingApi.getBankTransaction(accessToken, xeroTenantId, - bankTransactions.getBankTransactions().get(0).getBankTransactionID()); - messages.add("Get a one Bank Transaction : amount:" - + oneBankTransaction.getBankTransactions().get(0).getTotal()); - - // UDPATE Bank Transaction - newBankTransaction.getBankTransactions().get(0).setSubTotal(null); - newBankTransaction.getBankTransactions().get(0).setTotal(null); - newBankTransaction.getBankTransactions().get(0).setReference("You just updated"); - BankTransactions updateBankTransaction = accountingApi.updateBankTransaction(accessToken, - xeroTenantId, newBankTransaction.getBankTransactions().get(0).getBankTransactionID(), - newBankTransaction); - messages.add("Update new BankTransaction : reference:" - + updateBankTransaction.getBankTransactions().get(0).getReference()); - - // DELETE Bank Transaction - newBankTransaction.getBankTransactions().get(0) - .setStatus(com.xero.models.accounting.BankTransaction.StatusEnum.DELETED); - BankTransactions deletedBankTransaction = accountingApi.updateBankTransaction(accessToken, - xeroTenantId, newBankTransaction.getBankTransactions().get(0).getBankTransactionID(), - newBankTransaction); - messages.add("Deleted new Bank Transaction : Status:" - + deletedBankTransaction.getBankTransactions().get(0).getStatus()); - - // GET Bank Transaction History - HistoryRecords hr = accountingApi.getBankTransactionsHistory(accessToken, xeroTenantId, - oneBankTransaction.getBankTransactions().get(0).getBankTransactionID()); - messages.add("Get a one Bank Transaction History Record - details :" - + hr.getHistoryRecords().get(0).getDetails()); - - // CREATE Bank Transaction History - // Error: "The document with the supplied id was not found for this end point. - /* - * HistoryRecords historyRecords = new HistoryRecords(); HistoryRecord - * historyRecord = new HistoryRecord(); - * historyRecord.setDetails("This is a sample history note"); - * historyRecords.addHistoryRecordsItem(historyRecord); HistoryRecords newHr = - * accountingApi.createBankTransactionHistoryRecord(oneBankTransaction. - * getBankTransactions().get(0).getBankTransactionID(), historyRecords); - * messages.add("Create a one Bank Transaction History Record - details :" + - * newHr.getHistoryRecords().get(0).getDetails()); - */ - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("BatchPayments")) { - // BATCH PAYMENTS - try { - // CREATE payment - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, - order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - Invoice inv2 = new Invoice(); - inv2.setInvoiceID(allInvoices.getInvoices().get(1).getInvoiceID()); - Invoice inv3 = new Invoice(); - inv3.setInvoiceID(allInvoices.getInvoices().get(3).getInvoiceID()); - where = null; - - where = "EnablePaymentsToAccount==true"; - Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, - order); - Account paymentAccount = new Account(); - paymentAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); - where = null; - - BatchPayments createBatchPayments = new BatchPayments(); - BatchPayment createBatchPayment = new BatchPayment(); - createBatchPayment.setAccount(paymentAccount); - createBatchPayment.setAmount(3.0); - LocalDate currDate = LocalDate.now(); - createBatchPayment.setDate(currDate); - createBatchPayment.setReference("Foobar" + loadRandomNum()); - - Payment payment01 = new Payment(); - payment01.setAccount(paymentAccount); - payment01.setInvoice(inv); - payment01.setAmount(1.0); - payment01.setDate(currDate); - - Payment payment02 = new Payment(); - payment02.setAccount(paymentAccount); - payment02.setInvoice(inv2); - payment02.setAmount(1.0); - payment02.setDate(currDate); - - Payment payment03 = new Payment(); - payment03.setAccount(paymentAccount); - payment03.setInvoice(inv3); - payment03.setAmount(1.0); - payment03.setDate(currDate); - - createBatchPayment.addPaymentsItem(payment01); - createBatchPayment.addPaymentsItem(payment02); - createBatchPayment.addPaymentsItem(payment03); - - createBatchPayments.addBatchPaymentsItem(createBatchPayment); - - BatchPayments newBatchPayments = accountingApi.createBatchPayment(accessToken, xeroTenantId, - createBatchPayments); - messages.add( - "Create BatchPayments - ID : " + newBatchPayments.getBatchPayments().get(0).getTotalAmount()); - - // GET all Payments - BatchPayments allBatchPayments = accountingApi.getBatchPayments(accessToken, xeroTenantId, - ifModifiedSince, where, order); - messages.add("Get BatchPayments - Total : " + allBatchPayments.getBatchPayments().size()); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("BrandingThemes")) { - /* BRANDING THEME */ - try { - // GET all BrandingTheme - BrandingThemes bt = accountingApi.getBrandingThemes(accessToken, xeroTenantId); - messages.add("Get a All Branding Themes - total : " + bt.getBrandingThemes().size()); - - // GET one BrandingTheme - UUID btID = bt.getBrandingThemes().get(0).getBrandingThemeID(); - BrandingThemes oneBt = accountingApi.getBrandingTheme(accessToken, xeroTenantId, btID); - messages.add("Get a one Branding Themes - name : " + oneBt.getBrandingThemes().get(0).getName()); - /* - * // Create PaymentService for a Branding Theme PaymentServices paymentServices - * = accountingApi.getPaymentServices(); UUID paymentServiceID = - * paymentServices.getPaymentServices().get(0).getPaymentServiceID(); - * PaymentService btPaymentService = new PaymentService(); - * btPaymentService.setPaymentServiceType("Custom"); - * btPaymentService.setPaymentServiceID(paymentServiceID); PaymentServices - * createdPaymentService = - * accountingApi.createBrandingThemePaymentServices(btID, btPaymentService); - * messages.add("Created payment services for Branding Themes - name : " + - * createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); - */ - // GET Payment Services for a single Branding Theme - PaymentServices paymentServicesForBrandingTheme = accountingApi - .getBrandingThemePaymentServices(accessToken, xeroTenantId, btID); - messages.add("Get payment services for Branding Themes - name : " - + paymentServicesForBrandingTheme.getPaymentServices().get(0).getPaymentServiceName()); - - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Contacts")) { - /* CONTACTS */ - try { - // CREATE contact - Contact contact = new Contact(); - contact.setName("Foo" + loadRandomNum()); - contact.setEmailAddress("sid" + loadRandomNum() + "@blah.com"); - List phones = new ArrayList(); - Phone phone = new Phone(); - phone.setPhoneType(PhoneTypeEnum.MOBILE); - phone.setPhoneNumber("555-1212"); - phone.setPhoneAreaCode("415"); - phones.add(phone); - contact.setPhones(phones); - Contacts newContact = accountingApi.createContact(accessToken, xeroTenantId, contact); - messages.add("Create new Contact - Name : " + newContact.getContacts().get(0).getName()); - - // UPDATE contact - newContact.getContacts().get(0).setName("Foo"); - UUID contactID = newContact.getContacts().get(0).getContactID(); - Contacts updatedContact = accountingApi.updateContact(accessToken, xeroTenantId, contactID, newContact); - messages.add("Update new Contact - Name : " + updatedContact.getContacts().get(0).getName()); - - // GET all contact - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, null, includeArchived); - messages.add("Get a All Contacts - Total : " + contacts.getContacts().size()); - - // GET one contact - UUID oneContactID = contacts.getContacts().get(0).getContactID(); - Contacts oneContact = accountingApi.getContact(accessToken, xeroTenantId, oneContactID); - messages.add("Get a One Contact - Name : " + oneContact.getContacts().get(0).getName()); - - // GET contact cisSettings - where = "Name==\"sidney\""; - Contacts cisContact = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, - order, ids, null, includeArchived); - if (cisContact.getContacts().size() > 0) { - CISSettings cisSettings = accountingApi.getContactCISSettings(accessToken, xeroTenantId, - cisContact.getContacts().get(0).getContactID()); - messages.add("Get a Contact cisSettings - Enabled? : " - + cisSettings.getCiSSettings().get(0).getCiSEnabled()); - } - - where = null; - // GET active contacts - where = "ContactStatus==\"ACTIVE\""; - Contacts contactsWhere = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, - order, ids, null, includeArchived); - messages.add("Get a all ACTIVE Contacts - Total : " + contactsWhere.getContacts().size()); - where = null; - - // Get Contact History - HistoryRecords contactHistory = accountingApi.getContactHistory(accessToken, xeroTenantId, contactID); - messages.add("Contact History - count : " + contactHistory.getHistoryRecords().size()); - - // Create Contact History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - - HistoryRecords newInvoiceHistory = accountingApi.createContactHistory(accessToken, xeroTenantId, - contactID, newHistoryRecords); - messages.add("Contact History - note added to : " - + newInvoiceHistory.getHistoryRecords().get(0).getDetails()); - - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("ContactGroups")) { - - /* CONTACT GROUP */ - try { - // Create contact group - ContactGroups newCGs = new ContactGroups(); - ContactGroup cg = new ContactGroup(); - cg.setName("NewGroup" + loadRandomNum()); - newCGs.addContactGroupsItem(cg); - ContactGroups newContactGroup = accountingApi.createContactGroup(accessToken, xeroTenantId, newCGs); - messages.add("Create a ContactGroup - Name : " + newContactGroup.getContactGroups().get(0).getName()); - - // UPDATE Contact group - newCGs.getContactGroups().get(0).setName("Old Group" + loadRandomNum()); - UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - ContactGroups updateContactGroup = accountingApi.updateContactGroup(accessToken, xeroTenantId, - newContactGroupID, newCGs); - messages.add( - "Update a ContactGroup - Name : " + updateContactGroup.getContactGroups().get(0).getName()); - - // GET all contact groups - ContactGroups contactGroups = accountingApi.getContactGroups(accessToken, xeroTenantId, where, order); - messages.add("Get all ContactGroups - Total : " + contactGroups.getContactGroups().size()); - - // GET one contact groups - UUID contactGroupId = contactGroups.getContactGroups().get(0).getContactGroupID(); - ContactGroups oneCg = accountingApi.getContactGroup(accessToken, xeroTenantId, contactGroupId); - messages.add("Get one ContactGroups - Name : " + oneCg.getContactGroups().get(0).getName()); - - // DELETE contact Group - newCGs.getContactGroups().get(0).setStatus(com.xero.models.accounting.ContactGroup.StatusEnum.DELETED); - UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - ContactGroups deletedContactGroup = accountingApi.updateContactGroup(accessToken, xeroTenantId, - contactGroupID, contactGroups); - messages.add( - "Delete a ContactGroup - Name : " + deletedContactGroup.getContactGroups().get(0).getName()); - - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("ContactGroupContacts")) { - /* CONTACT GROUP CONTACTS */ - try { - // Create new Contact Group - ContactGroups newCGs = new ContactGroups(); - ContactGroup cg = new ContactGroup(); - cg.setName("NewGroup" + loadRandomNum()); - newCGs.addContactGroupsItem(cg); - ContactGroups newContactGroup = accountingApi.createContactGroup(accessToken, xeroTenantId, newCGs); - - Contacts allContacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, - order, ids, null, includeArchived); - - // Create Contacts in Group - Contacts contactList = new Contacts(); - contactList.addContactsItem(allContacts.getContacts().get(0)); - contactList.addContactsItem(allContacts.getContacts().get(1)); - UUID contactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - Contacts addContacts = accountingApi.createContactGroupContacts(accessToken, xeroTenantId, - contactGroupID, contactList); - messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts.getContacts().size()); - - // DELETE all Contacts in Group - accountingApi.deleteContactGroupContacts(accessToken, xeroTenantId, - newContactGroup.getContactGroups().get(0).getContactGroupID()); - messages.add("Delete All Contacts to Contact Group - no content in response "); - - ContactGroups oneCg = accountingApi.getContactGroup(accessToken, xeroTenantId, - newContactGroup.getContactGroups().get(0).getContactGroupID()); - messages.add( - "Get ContactGroups - Total Contacts : " + oneCg.getContactGroups().get(0).getContacts().size()); - - // DELETE Single Contact - Contacts contactList2 = new Contacts(); - contactList2.addContactsItem(allContacts.getContacts().get(3)); - contactList2.addContactsItem(allContacts.getContacts().get(4)); - - UUID newContactGroupID = newContactGroup.getContactGroups().get(0).getContactGroupID(); - Contacts addContacts2 = accountingApi.createContactGroupContacts(accessToken, xeroTenantId, - newContactGroupID, contactList2); - messages.add("Add 2 Contacts to Contact Group - Total : " + addContacts2.getContacts().size()); - - // DELETE Single CONACTS - accountingApi.deleteContactGroupContact(accessToken, xeroTenantId, - newContactGroup.getContactGroups().get(0).getContactGroupID(), - allContacts.getContacts().get(3).getContactID()); - messages.add("Delete 1 contact from Contact Group - no content in response"); - - ContactGroups oneCg2 = accountingApi.getContactGroup(accessToken, xeroTenantId, - newContactGroup.getContactGroups().get(0).getContactGroupID()); - messages.add("Get ContactGroups - Total Contacts : " - + oneCg2.getContactGroups().get(0).getContacts().size()); - - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("CreditNotesPDF")) { - // GET CreditNote As a PDF - CreditNotes creditNotes = accountingApi.getCreditNotes(accessToken, xeroTenantId, ifModifiedSince, where, - order, null); - UUID creditNoteId = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - ByteArrayInputStream CreditNoteInput = accountingApi.getCreditNoteAsPdf(accessToken, xeroTenantId, - creditNoteId, "application/pdf"); - String CreditNoteFileName = "CreditNoteAsPDF.pdf"; - - String CreditNoteSaveFilePath = saveFile(CreditNoteInput, CreditNoteFileName); - messages.add("Get CreditNote attachment - save it here: " + CreditNoteSaveFilePath); - - } else if (object.equals("CreditNotes")) { - // CREDIT NOTE - try { - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, null, includeArchived); - - // Create Credit Note - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode("400"); - li.setDescription("Foobar"); - li.setQuantity(2.0); - li.setUnitAmount(20.0); - lineItems.add(li); - - CreditNotes newCNs = new CreditNotes(); - CreditNote cn = new CreditNote(); - cn.setContact(contacts.getContacts().get(0)); - cn.setLineItems(lineItems); - cn.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT); - newCNs.addCreditNotesItem(cn); - CreditNotes newCreditNote = accountingApi.createCreditNote(accessToken, xeroTenantId, newCNs, - summarizeErrors); - messages.add("Create a CreditNote - Amount : " + newCreditNote.getCreditNotes().get(0).getTotal()); - UUID newCreditNoteId = newCreditNote.getCreditNotes().get(0).getCreditNoteID(); - - // GET all Credit Note - CreditNotes creditNotes = accountingApi.getCreditNotes(accessToken, xeroTenantId, ifModifiedSince, - where, order, null); - messages.add("Get all CreditNotes - Total : " + creditNotes.getCreditNotes().size()); - - // GET One Credit Note - UUID creditNoteID = creditNotes.getCreditNotes().get(0).getCreditNoteID(); - CreditNotes oneCreditNote = accountingApi.getCreditNote(accessToken, xeroTenantId, creditNoteID); - messages.add("Get a CreditNote - Amount : " + oneCreditNote.getCreditNotes().get(0).getTotal()); - - // UPDATE Credit Note - newCNs.getCreditNotes().get(0).setStatus(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED); - CreditNotes updatedCreditNote = accountingApi.updateCreditNote(accessToken, xeroTenantId, - newCreditNoteId, newCNs); - messages.add("Update a CreditNote - Ref : " + updatedCreditNote.getCreditNotes().get(0).getReference()); - - // Allocate Credit Note - Allocations allocations = new Allocations(); - Allocation allocation = new Allocation(); - - where = "Status==\"AUTHORISED\"&&Type==\"ACCPAY\""; - Invoices allInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, - order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - allocation.setInvoice(inv); - allocation.setAmount(1.0); - LocalDate currDate = LocalDate.now(); - allocation.setDate(currDate); - allocations.addAllocationsItem(allocation); - where = null; - - Allocations allocatedCreditNote = accountingApi.createCreditNoteAllocation(accessToken, xeroTenantId, - newCreditNoteId, allocations); - messages.add("Update CreditNote Allocation - Amount : " - + allocatedCreditNote.getAllocations().get(0).getAmount()); - - // Get Invoice History - HistoryRecords history = accountingApi.getCreditNoteHistory(accessToken, xeroTenantId, creditNoteID); - messages.add("History - count : " + history.getHistoryRecords().size()); - - // Create Invoice History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - - HistoryRecords newHistory = accountingApi.createCreditNoteHistory(accessToken, xeroTenantId, - creditNoteID, newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Currencies")) { - - /* CURRENCY */ - try { - // Get All - Currencies currencies = accountingApi.getCurrencies(accessToken, xeroTenantId, where, order); - messages.add("Get all Currencies - Total : " + currencies.getCurrencies().size()); - - // Create New - Currency curr = new Currency(); - curr.setCode(CurrencyCode.SGD); - curr.setDescription("Singapore Dollar"); - Currencies newCurrency = accountingApi.createCurrency(accessToken, xeroTenantId, curr); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Employees")) { - // EMPLOYEE - try { - - // Create - Employee employee = new Employee(); - employee.setFirstName("Sam"); - employee.setLastName("Jackson" + loadRandomNum()); - ExternalLink extLink = new ExternalLink(); - extLink.setUrl("http://twitter.com/#!/search/Homer+Simpson"); - employee.setExternalLink(extLink); - Employees emps = new Employees(); - emps.addEmployeesItem(employee); - - Employees newEmployee = accountingApi.createEmployee(accessToken, xeroTenantId, emps); - messages.add("Create an Employee - Last Name : " + newEmployee.getEmployees().get(0).getLastName()); - - // Get All - Employees employees = accountingApi.getEmployees(accessToken, xeroTenantId, ifModifiedSince, where, - order); - messages.add("Get all Employees - Total : " + employees.getEmployees().size()); - - UUID newEmpId = employees.getEmployees().get(0).getEmployeeID(); - - // Get One - Employees oneEmployee = accountingApi.getEmployee(accessToken, xeroTenantId, newEmpId); - messages.add("Get one Employees - Name : " + oneEmployee.getEmployees().get(0).getFirstName()); - - // 404 ERROR - // Update No EmployeeID as part of URI - first/last name used as unique key - ExternalLink extLink2 = new ExternalLink(); - extLink2.setUrl("http://twitter.com/#!/search/Bart+Simpson"); - newEmployee.getEmployees().get(0).setExternalLink(extLink2); - - Employees updateEmployee = accountingApi.updateEmployee(accessToken, xeroTenantId, newEmpId, - newEmployee); - messages.add("Update an Employee - Last Name : " + updateEmployee.getEmployees().get(0).getLastName()); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("ExpenseClaims")) { - // EXPENSE CLAIM - try { - // Create - // where = "IsSubscriber==true"; - Users users = accountingApi.getUsers(accessToken, xeroTenantId, ifModifiedSince, where, order); - where = null; - - where = "ShowInExpenseClaims==true&&Status==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); - where = null; - - if (users.getUsers().size() > 0) { - User user = new User(); - user.setUserID(users.getUsers().get(0).getUserID()); - - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, - order, ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // CREATE NEW RECEIPT - Receipts receipts = new Receipts(); - Receipt receipt = new Receipt(); - - LineItem li = new LineItem(); - li.setAccountCode(accounts.getAccounts().get(0).getCode()); - li.setDescription("Foobar"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - receipt.addLineItemsItem(li); - receipt.setUser(user); - receipt.lineAmountTypes(LineAmountTypes.NOTAX); - receipt.contact(useContact); - receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); - receipts.addReceiptsItem(receipt); - Receipts newReceipts = accountingApi.createReceipt(accessToken, xeroTenantId, receipts); - - // CREATE EXPENSE CLAIM - ExpenseClaims createExpenseClaims = new ExpenseClaims(); - ExpenseClaim expenseClaim = new ExpenseClaim(); - expenseClaim.setUser(user); - - Receipts myReceipts = new Receipts(); - Receipt myReceipt = new Receipt(); - myReceipt.setReceiptID(newReceipts.getReceipts().get(0).getReceiptID()); - myReceipts.addReceiptsItem(myReceipt); - expenseClaim.setReceipts(myReceipts.getReceipts()); - expenseClaim.setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED); - createExpenseClaims.addExpenseClaimsItem(expenseClaim); - ExpenseClaims newExpenseClaims = accountingApi.createExpenseClaim(accessToken, xeroTenantId, - createExpenseClaims, summarizeErrors); - messages.add("Create new Expense Claim - Status : " - + newExpenseClaims.getExpenseClaims().get(0).getStatus()); - - // UPDATE EXPENSE CLAIM - createExpenseClaims.getExpenseClaims().get(0) - .setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.AUTHORISED); - UUID expenseClaimID = newExpenseClaims.getExpenseClaims().get(0).getExpenseClaimID(); - ExpenseClaims updateExpenseClaims = accountingApi.updateExpenseClaim(accessToken, xeroTenantId, - expenseClaimID, createExpenseClaims); - messages.add("Update new Expense Claim - Status : " - + updateExpenseClaims.getExpenseClaims().get(0).getStatus()); - - // Get All Expense Claims - ExpenseClaims expenseClaims = accountingApi.getExpenseClaims(accessToken, xeroTenantId, - ifModifiedSince, where, order); - messages.add("Get all Expense Claim - Total : " + expenseClaims.getExpenseClaims().size()); - - // Get One Expense Claim - ExpenseClaims oneExpenseClaim = accountingApi.getExpenseClaim(accessToken, xeroTenantId, - expenseClaims.getExpenseClaims().get(0).getExpenseClaimID()); - messages.add( - "Get one Expense Claim - Total : " + oneExpenseClaim.getExpenseClaims().get(0).getStatus()); - - // VOID EXPENSE CLAIM - createExpenseClaims.getExpenseClaims().get(0) - .setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.VOIDED); - ExpenseClaims voidExpenseClaims = accountingApi.updateExpenseClaim(accessToken, xeroTenantId, - expenseClaimID, createExpenseClaims); - messages.add("Void new Expense Claim - Status : " - + voidExpenseClaims.getExpenseClaims().get(0).getStatus()); - - // Get Invoice History - HistoryRecords history = accountingApi.getExpenseClaimHistory(accessToken, xeroTenantId, - expenseClaimID); - messages.add("History - count : " + history.getHistoryRecords().size()); - - // Create Invoice History - // Error: "The document with the supplied id was not found for this endpoint. - /* - * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord - * newHistoryRecord = new HistoryRecord(); - * newHistoryRecord.setDetails("Hello World"); - * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords - * newHistory = accountingApi.createExpenseClaimHistory(expenseClaimID, - * newHistoryRecords); messages.add("History - note added to : " + - * newHistory.getHistoryRecords().get(0).getDetails()); - */ - } else { - System.out.println("No User Found"); - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Invoices")) { - // INVOICE - - // GET Invoice As a PDF - Invoices myInvoicesForPDF = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, - order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - UUID invoiceIDForPDF = myInvoicesForPDF.getInvoices().get(0).getInvoiceID(); - ByteArrayInputStream InvoiceNoteInput = accountingApi.getInvoiceAsPdf(accessToken, xeroTenantId, - invoiceIDForPDF, "application/pdf"); - String InvoiceFileName = "InvoiceAsPDF.pdf"; - String InvoiceSaveFilePath = saveFile(InvoiceNoteInput, InvoiceFileName); - messages.add("Get Invoice attachment - save it here: " + InvoiceSaveFilePath); - - // Create Invoice - where = "Type==\"REVENUE\""; - Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); - String accountCodeForInvoice = accounts.getAccounts().get(0).getCode(); - where = null; - - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, ids, - null, includeArchived); - - UUID contactIDForInvoice = contacts.getContacts().get(0).getContactID(); - - for (int i = 0; i > contacts.getContacts().size(); i++) { - String email = contacts.getContacts().get(i).getEmailAddress().toString(); - - if (email != null && !email.isEmpty()) { - contactIDForInvoice = contacts.getContacts().get(i).getContactID(); - break; - } - } - - contactIDForInvoice = UUID.fromString("9f857fe0-4a14-408b-b526-4f742db3b079"); - Contact useContact = new Contact(); - useContact.setContactID(contactIDForInvoice); - - Invoices newInvoices = new Invoices(); - Invoice myInvoice = new Invoice(); - - LineItem li = new LineItem(); - li.setAccountCode(accountCodeForInvoice); - li.setDescription("Acme Tires"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - myInvoice.addLineItemsItem(li); - myInvoice.setContact(useContact); - LocalDate dueDate = LocalDate.of(2018, Month.DECEMBER, 10); - myInvoice.setDueDate(dueDate); - LocalDate todayDate = LocalDate.now(); - myInvoice.setDate(todayDate); - myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); - myInvoice.setReference("One Fish, Two Fish"); - myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); - newInvoices.addInvoicesItem(myInvoice); - - Invoices newInvoice = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoices, summarizeErrors); - messages.add("Create invoice - Reference : " + newInvoice.getInvoices().get(0).getReference()); - UUID newInvoiceID = newInvoice.getInvoices().get(0).getInvoiceID(); - Invoices updateInvoices = new Invoices(); - Invoice updateInvoice = new Invoice(); - updateInvoice.setInvoiceID(newInvoiceID); - updateInvoice.setReference("Red Fish, Blue Fish"); - updateInvoices.addInvoicesItem(updateInvoice); - - Invoices updatedInvoice = accountingApi.updateInvoice(accessToken, xeroTenantId, newInvoiceID, - updateInvoices); - messages.add("Update invoice - Reference : " + updatedInvoice.getInvoices().get(0).getReference()); - - // Get All - Invoices invoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, order, ids, - invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - messages.add("Get all invoices - Total : " + invoices.getInvoices().size()); - - // Get Invoice If-Modified-Since - OffsetDateTime invModified = OffsetDateTime.of(LocalDateTime.of(2018, 12, 06, 15, 00), ZoneOffset.UTC); - Invoices invoicesSince = accountingApi.getInvoices(accessToken, xeroTenantId, invModified, where, order, - ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - messages.add("Get all invoices - Since Modfied Date - Total : " + invoicesSince.getInvoices().size()); - - // Get One - Invoices oneInvoice = accountingApi.getInvoice(accessToken, xeroTenantId, - invoices.getInvoices().get(0).getInvoiceID()); - messages.add("Get one invoice - total : " + oneInvoice.getInvoices().get(0).getTotal()); - LocalDate myDate = oneInvoice.getInvoices().get(0).getDate(); - OffsetDateTime myUTC = oneInvoice.getInvoices().get(0).getUpdatedDateUTC(); - - // Get Online Invoice - OnlineInvoices onlineInvoice = accountingApi.getOnlineInvoice(accessToken, xeroTenantId, newInvoiceID); - messages.add( - "Get Online invoice - URL : " + onlineInvoice.getOnlineInvoices().get(0).getOnlineInvoiceUrl()); - - // Email Invoice - RequestEmpty empty = new RequestEmpty(); - accountingApi.emailInvoice(accessToken, xeroTenantId, newInvoiceID, empty); - messages.add("Email invoice - no content in response"); - - // Get Invoice History - HistoryRecords history = accountingApi.getInvoiceHistory(accessToken, xeroTenantId, newInvoiceID); - messages.add("History - count : " + history.getHistoryRecords().size()); - - // Create Invoice History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createInvoiceHistory(accessToken, xeroTenantId, newInvoiceID, - newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - - // CREATE invoice attachment - statuses = "AUTHORISED"; - Invoices myInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - UUID invoiceID = myInvoices.getInvoices().get(0).getInvoiceID(); - - File requestBodyFile = new File( - "/Users/sid.maestre/eclipse-workspace/xero-sdk-oauth2-dev-01/resources/youngsid.jpg"); - String newFileName = requestBodyFile.getName(); - - Attachments createdAttachments = accountingApi.createInvoiceAttachmentByFileName(accessToken, xeroTenantId, - invoiceID, newFileName, requestBodyFile); - messages.add("Attachment to Invoice complete - ID: " - + createdAttachments.getAttachments().get(0).getAttachmentID()); - - // GET Invoice Attachment - System.out.println(invoiceID); - Attachments attachments = accountingApi.getInvoiceAttachments(accessToken, xeroTenantId, invoiceID); - System.out.println(attachments.getAttachments().get(0).getFileName()); - UUID attachementId = attachments.getAttachments().get(0).getAttachmentID(); - String contentType = attachments.getAttachments().get(0).getMimeType(); - ByteArrayInputStream InvoiceAttachmentInput = accountingApi.getInvoiceAttachmentById(accessToken, - xeroTenantId, invoiceID, attachementId, contentType); - - String InvoiceAttachmentFileName = attachments.getAttachments().get(0).getFileName(); - String InvoiceAttachmentSaveFilePath = saveFile(InvoiceAttachmentInput, InvoiceAttachmentFileName); - messages.add("Get Invoice attachment - save it here: " + InvoiceAttachmentSaveFilePath); - - } else if (object.equals("InvoiceReminders")) { - // INVOICE REMINDER - try { - InvoiceReminders invReminders = accountingApi.getInvoiceReminders(accessToken, xeroTenantId); - messages.add("Get a Invoice Reminder - Is Enabled: " - + invReminders.getInvoiceReminders().get(0).getEnabled()); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Items")) { - // ITEM - try { - // Create Items - Items myItems = new Items(); - Item myItem = new Item(); - myItem.setCode("abc" + loadRandomNum()); - myItem.setDescription("foobar"); - myItem.setName("Hello" + loadRandomNum()); - myItems.addItemsItem(myItem); - Items newItems = accountingApi.createItem(accessToken, xeroTenantId, myItems); - messages.add("Create new item - Description : " + newItems.getItems().get(0).getDescription()); - UUID newItemId = newItems.getItems().get(0).getItemID(); - - // Update Item - newItems.getItems().get(0).setDescription("Barfoo"); - Items updateItem = accountingApi.updateItem(accessToken, xeroTenantId, newItemId, newItems); - messages.add("Update item - Description : " + updateItem.getItems().get(0).getDescription()); - - // Get All Items - Items items = accountingApi.getItems(accessToken, xeroTenantId, ifModifiedSince, where, order, null); - messages.add("Get all items - Total : " + items.getItems().size()); - - // Get One Item - UUID itemId = items.getItems().get(0).getItemID(); - Items oneItem = accountingApi.getItem(accessToken, xeroTenantId, itemId); - messages.add("Get one item - Description : " + oneItem.getItems().get(0).getDescription()); - - // Get Invoice History - HistoryRecords history = accountingApi.getItemHistory(accessToken, xeroTenantId, itemId); - messages.add("History - count : " + history.getHistoryRecords().size()); - - // Create Invoice History - // Error: "The document with the supplied id was not found for this endpoint. - /* - * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord - * newHistoryRecord = new HistoryRecord(); - * newHistoryRecord.setDetails("Hello World"); - * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords - * createdHistory = accountingApi.createItemHistory(itemId,newHistoryRecords); - * messages.add("History - note added to : " + - * createdHistory.getHistoryRecords().get(0).getDetails()); - */ - - // Delete - accountingApi.deleteItem(accessToken, xeroTenantId, newItemId); - messages.add("Delete one item - no content in response"); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Journals")) { - // JOURNAL - try { - - boolean paymentsOnly = false; - // GET all Journals - Journals journals = accountingApi.getJournals(accessToken, xeroTenantId, ifModifiedSince, null, - paymentsOnly); - messages.add("Get Journals - total : " + journals.getJournals().size()); - - // GET Journal with offset - Journals journalsOffset = accountingApi.getJournals(accessToken, xeroTenantId, ifModifiedSince, null, - paymentsOnly); - messages.add("Get Journals offset - total : " + journalsOffset.getJournals().size()); - // 404 ERROR - /* - * // GET one Journal UUID journalId = - * journals.getJournals().get(0).getJournalID(); Journals oneJournal = - * accountingApi.getJournal(journalId); - * messages.add("Get one Journal - number : " + - * oneJournal.getJournals().get(0).getJournalNumber()); - */ - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("LinkedTransactions")) { - - /* LINKED TRANSACTION */ - try { - // Create Linked Transaction - where = "Type==\"EXPENSE\""; - Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); - where = null; - - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - Invoices newInvoices = new Invoices(); - Invoice myInvoice = new Invoice(); - - LineItem li = new LineItem(); - li.setAccountCode(accounts.getAccounts().get(0).getCode()); - li.setDescription("Acme Tires"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - myInvoice.addLineItemsItem(li); - myInvoice.setContact(useContact); - LocalDate dueDate = LocalDate.of(2018, Month.OCTOBER, 10); - myInvoice.setDueDate(dueDate); - LocalDate todayDate = LocalDate.now(); - myInvoice.setDate(todayDate); - myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCPAY); - myInvoice.setReference("One Fish, Two Fish"); - myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); - newInvoices.addInvoicesItem(myInvoice); - - Invoices newInvoice = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoices, - summarizeErrors); - - UUID sourceTransactionID1 = newInvoice.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID1 = newInvoice.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - LinkedTransactions newLinkedTransactions = new LinkedTransactions(); - LinkedTransaction newLinkedTransaction = new LinkedTransaction(); - newLinkedTransaction.setSourceTransactionID(sourceTransactionID1); - newLinkedTransaction.setSourceLineItemID(sourceLineItemID1); - newLinkedTransactions.addLinkedTransactionsItem(newLinkedTransaction); - - LinkedTransactions createdLinkedTransaction = accountingApi.createLinkedTransaction(accessToken, - xeroTenantId, newLinkedTransactions); - messages.add("Create LinkedTransaction - Status : " - + createdLinkedTransaction.getLinkedTransactions().get(0).getStatus()); - - // Created Linked Transaction 2 - Contact contact = new Contact(); - contact.setName("Foo" + loadRandomNum()); - contact.setEmailAddress("sid" + loadRandomNum() + "@blah.com"); - Contacts newContact = accountingApi.createContact(accessToken, xeroTenantId, contact); - UUID newContactID = newContact.getContacts().get(0).getContactID(); - - Invoices newInvoice2 = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoices, - summarizeErrors); - - UUID sourceTransactionID2 = newInvoice2.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID2 = newInvoice2.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - LinkedTransactions newLinkedTransactions2 = new LinkedTransactions(); - LinkedTransaction newLinkedTransaction2 = new LinkedTransaction(); - newLinkedTransaction2.setSourceTransactionID(sourceTransactionID2); - newLinkedTransaction2.setSourceLineItemID(sourceLineItemID2); - newLinkedTransaction2.setContactID(newContactID); - newLinkedTransactions2.addLinkedTransactionsItem(newLinkedTransaction2); - - LinkedTransactions createdLinkedTransaction2 = accountingApi.createLinkedTransaction(accessToken, - xeroTenantId, newLinkedTransactions2); - messages.add("Create LinkedTransaction 2 - Status : " - + createdLinkedTransaction2.getLinkedTransactions().get(0).getStatus()); - - // Created Linked Transaction 3 - Invoices newInvoicesAccRec = new Invoices(); - Invoice myInvoiceAccRec = new Invoice(); - - myInvoiceAccRec.addLineItemsItem(li); - myInvoiceAccRec.setContact(useContact); - - myInvoiceAccRec.setDueDate(dueDate); - myInvoiceAccRec.setDate(todayDate); - - myInvoiceAccRec.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); - myInvoiceAccRec.setStatus(com.xero.models.accounting.Invoice.StatusEnum.AUTHORISED); - newInvoicesAccRec.addInvoicesItem(myInvoiceAccRec); - - Invoices newInvoiceAccRec = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoicesAccRec, - summarizeErrors); - UUID sourceTransactionID4 = newInvoiceAccRec.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID4 = newInvoiceAccRec.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - - Invoices newInvoice3 = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoices, - summarizeErrors); - - UUID sourceTransactionID3 = newInvoice3.getInvoices().get(0).getInvoiceID(); - UUID sourceLineItemID3 = newInvoice3.getInvoices().get(0).getLineItems().get(0).getLineItemID(); - LinkedTransactions newLinkedTransactions3 = new LinkedTransactions(); - LinkedTransaction newLinkedTransaction3 = new LinkedTransaction(); - newLinkedTransaction3.setSourceTransactionID(sourceTransactionID3); - newLinkedTransaction3.setSourceLineItemID(sourceLineItemID3); - newLinkedTransaction3.setContactID(useContact.getContactID()); - newLinkedTransaction3.setTargetTransactionID(sourceTransactionID4); - newLinkedTransaction3.setTargetLineItemID(sourceLineItemID4); - newLinkedTransactions3.addLinkedTransactionsItem(newLinkedTransaction3); - - LinkedTransactions createdLinkedTransaction3 = accountingApi.createLinkedTransaction(accessToken, - xeroTenantId, newLinkedTransactions3); - messages.add("Create LinkedTransaction 3 - Status : " - + createdLinkedTransaction3.getLinkedTransactions().get(0).getStatus()); - - // GET all Link Transactions - - int page = 1; - String linkedTransactionID = null; - String sourceTransactionID = null; - String targetTransactionID = null; - String status = null; - String contactID = null; - LinkedTransactions linkTransactions = accountingApi.getLinkedTransactions(accessToken, xeroTenantId, - page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID); - messages.add("Get Link Transactions - total : " + linkTransactions.getLinkedTransactions().size()); - - // GET all Link Transactions - UUID linkedTransactionID2 = linkTransactions.getLinkedTransactions().get(0).getLinkedTransactionID(); - LinkedTransactions oneLinkTransaction = accountingApi.getLinkedTransaction(accessToken, xeroTenantId, - linkedTransactionID2); - messages.add("Get one Link Transaction - Status : " - + oneLinkTransaction.getLinkedTransactions().get(0).getStatus()); - // 500 Error - /* - * // DELETE LINKEDTRANSACTION UUID newLinkedTransactionID = - * createdLinkedTransaction.getLinkedTransactions().get(0). - * getLinkedTransactionID(); - * accountingApi.deleteLinkedTransaction(newLinkedTransactionID); - * messages.add("Delete LinkedTransaction - no content in response"); - */ - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("ManualJournals")) { - // MANUAL JOURNAL - try { - // Create Manual Journal - where = "Type==\"EXPENSE\" && Status ==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); - String accountCode = accounts.getAccounts().get(0).getCode(); - where = null; - ManualJournals manualJournals = new ManualJournals(); - ManualJournal manualJournal = new ManualJournal(); - LocalDate currDate = LocalDate.now(); - manualJournal.setDate(currDate); - manualJournal.setNarration("Foo bar"); - - ManualJournalLine credit = new ManualJournalLine(); - credit.setDescription("Hello there"); - credit.setAccountCode(accountCode); - credit.setLineAmount(100.00); - manualJournal.addJournalLinesItem(credit); - - ManualJournalLine debit = new ManualJournalLine(); - debit.setDescription("Goodbye"); - debit.setAccountCode(accountCode); - debit.setLineAmount(-100.00); - manualJournal.addJournalLinesItem(debit); - manualJournals.addManualJournalsItem(manualJournal); - ManualJournals createdManualJournals = accountingApi.createManualJournal(accessToken, xeroTenantId, - manualJournals); - UUID newManualJournalId = createdManualJournals.getManualJournals().get(0).getManualJournalID(); - messages.add("Create Manual Journal - Narration : " - + createdManualJournals.getManualJournals().get(0).getNarration()); - - // GET all Manual Journal - ManualJournals getManualJournals = accountingApi.getManualJournals(accessToken, xeroTenantId, - ifModifiedSince, where, order, null); - messages.add("Get Manual Journal - total : " + getManualJournals.getManualJournals().size()); - - // GET one Manual Journal - UUID manualJournalId = getManualJournals.getManualJournals().get(0).getManualJournalID(); - ManualJournals oneManualJournal = accountingApi.getManualJournal(accessToken, xeroTenantId, - manualJournalId); - messages.add("Get one Manual Journal - Narration : " - + oneManualJournal.getManualJournals().get(0).getNarration()); - - // Update Manual Journal - ManualJournals updateManualJournals = new ManualJournals(); - ManualJournal updateManualJournal = new ManualJournal(); - updateManualJournal.setManualJournalID(newManualJournalId); - updateManualJournal.setNarration("Hello Xero"); - updateManualJournals.addManualJournalsItem(updateManualJournal); - ManualJournals updatedManualJournal = accountingApi.updateManualJournal(accessToken, xeroTenantId, - newManualJournalId, updateManualJournals); - messages.add("Update Manual Journal - Narration : " - + updatedManualJournal.getManualJournals().get(0).getNarration()); - - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Organisations")) { - // Organisation - try { - Organisations organisations = accountingApi.getOrganisations(accessToken, xeroTenantId); - messages.add("Get a Organisation - Name : " + organisations.getOrganisations().get(0).getName()); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Overpayments")) { - // OVERPAYMENT - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, - order); - Account bankAccount = new Account(); - bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); - where = null; - - where = "SystemAccount==\"DEBTORS\""; - Accounts arAccounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); - Account arAccount = arAccounts.getAccounts().get(0); - where = null; - - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, ids, - null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // Maker sure we have at least 2 banks - if (accountsWhere.getAccounts().size() > 0) { - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode(arAccount.getCode()); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setUnitAmount(20.00); - lineItems.add(li); - - BankTransaction bt = new BankTransaction(); - bt.setBankAccount(bankAccount); - bt.setContact(useContact); - bt.setLineItems(lineItems); - bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_OVERPAYMENT); - BankTransactions bts = new BankTransactions(); - bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(accessToken, xeroTenantId, - bts, summarizeErrors); - - Overpayments overpayments = accountingApi.getOverpayments(accessToken, xeroTenantId, ifModifiedSince, - where, order, null, null); - messages.add("Get a Overpayments - Count : " + overpayments.getOverpayments().size()); - - if (overpayments.getOverpayments().size() > 0) { - UUID overpaymentId = overpayments.getOverpayments().get(2).getOverpaymentID(); - Overpayments oneOverpayment = accountingApi.getOverpayment(accessToken, xeroTenantId, - overpaymentId); - messages.add("Get one Overpayment - Total : " + oneOverpayment.getOverpayments().get(0).getTotal()); - - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, - order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, - null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - where = null; - - Allocations allocations = new Allocations(); - Allocation allocation = new Allocation(); - allocation.setAmount(1.0); - LocalDate currDate = LocalDate.now(); - allocation.setDate(currDate); - allocation.setInvoice(inv); - allocations.addAllocationsItem(allocation); - - Allocations newAllocation = accountingApi.createOverpaymentAllocation(accessToken, xeroTenantId, - overpaymentId, allocations); - messages.add("Create OverPayment allocation - Amt : " - + newAllocation.getAllocations().get(0).getAmount()); - - // Get History - HistoryRecords history = accountingApi.getOverpaymentHistory(accessToken, xeroTenantId, - overpaymentId); - messages.add("History - count : " + history.getHistoryRecords().size()); - - // Create History - // Error: "The document with the supplied id was not found for this endpoint. - /* - * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord - * newHistoryRecord = new HistoryRecord(); - * newHistoryRecord.setDetails("Hello World"); - * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords - * createdHistory = - * accountingApi.createOverpaymentHistory(overpaymentId,newHistoryRecords); - * messages.add("History - note added to : " + - * createdHistory.getHistoryRecords().get(0).getDetails()); - */ - } - } - - } else if (object.equals("Payments")) { - /* Payment */ - try { - - // CREATE payment - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, - order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - where = null; - - where = "EnablePaymentsToAccount==true"; - Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, - order); - Account paymentAccount = new Account(); - paymentAccount.setCode(accountsWhere.getAccounts().get(0).getCode()); - where = null; - - Payments createPayments = new Payments(); - Payment createPayment = new Payment(); - createPayment.setAccount(paymentAccount); - createPayment.setInvoice(inv); - createPayment.setAmount(1.00); - - LocalDate currDate = LocalDate.now(); - createPayment.setDate(currDate); - createPayments.addPaymentsItem(createPayment); - - Payments newPayments = accountingApi.createPayment(accessToken, xeroTenantId, createPayments); - messages.add("Create Payments - Amt : " + newPayments.getPayments().get(0).getAmount()); - - // GET all Payments - Payments payments = accountingApi.getPayments(accessToken, xeroTenantId, ifModifiedSince, where, order); - messages.add("Get Payments - Total : " + payments.getPayments().size()); - - // GET one Payment - UUID paymentID = payments.getPayments().get(0).getPaymentID(); - Payments onePayment = accountingApi.getPayment(accessToken, xeroTenantId, paymentID); - messages.add("Get Payments - Amount : " + onePayment.getPayments().get(0).getAmount()); - - // Get History - HistoryRecords allHistory = accountingApi.getPaymentHistory(accessToken, xeroTenantId, paymentID); - messages.add("History - count : " + allHistory.getHistoryRecords().size()); - - // Create History - /* - * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord - * newHistoryRecord = new HistoryRecord(); - * newHistoryRecord.setDetails("Hello World"); - * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords - * newHistory = accountingApi.createPaymentHistory(paymentID,newHistoryRecords); - * messages.add("History - note added to : " + - * newHistory.getHistoryRecords().get(0).getDetails()); - */ - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("PaymentServices")) { - // Payment Services - try { - // CREATE PaymentService - PaymentServices newPaymentServices = new PaymentServices(); - PaymentService newPaymentService = new PaymentService(); - newPaymentService.setPaymentServiceName("PayUp" + loadRandomNum()); - newPaymentService.setPaymentServiceUrl("https://www.payupnow.com/"); - newPaymentService.setPayNowText("Time To PayUp"); - newPaymentServices.addPaymentServicesItem(newPaymentService); - PaymentServices createdPaymentService = accountingApi.createPaymentService(accessToken, xeroTenantId, - newPaymentServices); - messages.add("Create PaymentServices - name : " - + createdPaymentService.getPaymentServices().get(0).getPaymentServiceName()); - - // GET all Payments - PaymentServices paymentServices = accountingApi.getPaymentServices(accessToken, xeroTenantId); - messages.add("Get PaymentServices - Total : " + paymentServices.getPaymentServices().size()); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Prepayments")) { - /* PREPAYMENT */ - try { - where = "Status==\"ACTIVE\"&&Type==\"BANK\""; - Accounts accountsWhere = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, - order); - Account bankAccount = new Account(); - bankAccount.setAccountID(accountsWhere.getAccounts().get(0).getAccountID()); - where = null; - - where = "Type==\"EXPENSE\""; - Accounts arAccounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, - order); - Account arAccount = arAccounts.getAccounts().get(0); - where = null; - - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // Maker sure we have at least 2 banks - if (accountsWhere.getAccounts().size() > 0) { - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode(arAccount.getCode()); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setTaxType("NONE"); - li.setUnitAmount(20.00); - lineItems.add(li); - - BankTransaction bt = new BankTransaction(); - bt.setBankAccount(bankAccount); - bt.setContact(useContact); - bt.setLineItems(lineItems); - bt.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE_PREPAYMENT); - BankTransactions bts = new BankTransactions(); - bts.addBankTransactionsItem(bt); - BankTransactions newBankTransaction = accountingApi.createBankTransaction(accessToken, xeroTenantId, - bts, summarizeErrors); - where = "Status==\"AUTHORISED\" && TYPE==\"RECEIVE-PREPAYMENT\""; - Prepayments prepayments = accountingApi.getPrepayments(accessToken, xeroTenantId, ifModifiedSince, - where, order, null, null); - messages.add("Get a Prepayments - Count : " + prepayments.getPrepayments().size()); - where = null; - if (prepayments.getPrepayments().size() > 0) { - UUID prepaymentId = prepayments.getPrepayments().get(0).getPrepaymentID(); - Prepayments onePrepayment = accountingApi.getPrepayment(accessToken, xeroTenantId, - prepaymentId); - messages.add( - "Get one Prepayment - Total : " + onePrepayment.getPrepayments().get(0).getTotal()); - where = "Status==\"AUTHORISED\"&&Type==\"ACCREC\""; - Invoices allInvoices = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, - where, order, ids, invoiceNumbers, contactIDs, statuses, null, includeArchived, - createdByMyApp, null); - Invoice inv = new Invoice(); - inv.setInvoiceID(allInvoices.getInvoices().get(0).getInvoiceID()); - where = null; - - Allocations allocations = new Allocations(); - Allocation allocation = new Allocation(); - allocation.setAmount(1.0); - LocalDate currDate = LocalDate.now(); - allocation.setDate(currDate); - allocation.setInvoice(inv); - allocations.addAllocationsItem(allocation); - - // Allocations newAllocation = - // accountingApi.createPrepaymentAllocation(prepaymentId, allocations); - // messages.add("Create PrePayment allocation - Amt : " + - // newAllocation.getAllocations().get(0).getAmount()); - - // Get History - HistoryRecords history = accountingApi.getPrepaymentHistory(accessToken, xeroTenantId, - prepaymentId); - messages.add("History - count : " + history.getHistoryRecords().size()); - - // Create History - // Error: "The document with the supplied id was not found for this end point. - /* - * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord - * newHistoryRecord = new HistoryRecord(); - * newHistoryRecord.setDetails("Hello World"); - * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords - * createdHistory = - * accountingApi.createPrepaymentHistory(prepaymentId,newHistoryRecords); - * messages.add("History - note added to : " + - * createdHistory.getHistoryRecords().get(0).getDetails()); - */ - } - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("PurchaseOrders")) { - // PURCHASE ORDERS - try { - // CREATE Purchase Order - where = "Type==\"EXPENSE\""; - Accounts arAccounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, - order); - Account arAccount = arAccounts.getAccounts().get(0); - where = null; - - PurchaseOrders purchaseOrders = new PurchaseOrders(); - PurchaseOrder purchaseOrder = new PurchaseOrder(); - LocalDate currDate = LocalDate.now(); - purchaseOrder.setDate(currDate); - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - purchaseOrder.setContact(useContact); - - List lineItems = new ArrayList<>(); - LineItem li = new LineItem(); - li.setAccountCode(arAccount.getCode()); - li.setDescription("Foobar"); - li.setQuantity(1.0); - li.setUnitAmount(20.00); - lineItems.add(li); - purchaseOrder.setLineItems(lineItems); - purchaseOrders.addPurchaseOrdersItem(purchaseOrder); - PurchaseOrders createdPurchaseOrders = accountingApi.createPurchaseOrder(accessToken, xeroTenantId, - purchaseOrders, summarizeErrors); - messages.add("Create Purchase order - total : " - + createdPurchaseOrders.getPurchaseOrders().get(0).getTotal()); - - // UPDATE Purchase Orders - UUID newPurchaseOrderID = createdPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); - createdPurchaseOrders.getPurchaseOrders().get(0).setAttentionTo("Jimmy"); - PurchaseOrders updatePurchaseOrders = accountingApi.updatePurchaseOrder(accessToken, xeroTenantId, - newPurchaseOrderID, createdPurchaseOrders); - messages.add("Update Purchase order - attn : " - + updatePurchaseOrders.getPurchaseOrders().get(0).getAttentionTo()); - - // GET Purchase Orders - String status = null; - String dateFrom = null; - String dateTo = null; - PurchaseOrders allPurchaseOrders = accountingApi.getPurchaseOrders(accessToken, xeroTenantId, - ifModifiedSince, status, dateFrom, dateTo, order, null); - messages.add("Get Purchase orders - Count : " + allPurchaseOrders.getPurchaseOrders().size()); - - // GET one Purchase Order - UUID purchaseOrderID = allPurchaseOrders.getPurchaseOrders().get(0).getPurchaseOrderID(); - PurchaseOrders onePurchaseOrder = accountingApi.getPurchaseOrder(accessToken, xeroTenantId, - purchaseOrderID); - messages.add( - "Get one Purchase order - Total : " + onePurchaseOrder.getPurchaseOrders().get(0).getTotal()); - - // DELETE Purchase Orders - createdPurchaseOrders.getPurchaseOrders().get(0) - .setStatus(com.xero.models.accounting.PurchaseOrder.StatusEnum.DELETED); - PurchaseOrders deletePurchaseOrders = accountingApi.updatePurchaseOrder(accessToken, xeroTenantId, - newPurchaseOrderID, createdPurchaseOrders); - messages.add("Delete Purchase order - Status : " - + deletePurchaseOrders.getPurchaseOrders().get(0).getStatus()); - - // Get History - HistoryRecords history = accountingApi.getInvoiceHistory(accessToken, xeroTenantId, purchaseOrderID); - messages.add("History - count : " + history.getHistoryRecords().size()); - - // Create History - HistoryRecords newHistoryRecords = new HistoryRecords(); - HistoryRecord newHistoryRecord = new HistoryRecord(); - newHistoryRecord.setDetails("Hello World"); - newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); - HistoryRecords newHistory = accountingApi.createPurchaseOrderHistory(accessToken, xeroTenantId, - purchaseOrderID, newHistoryRecords); - messages.add("History - note added to : " + newHistory.getHistoryRecords().get(0).getDetails()); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Receipts")) { - /* RECEIPTS */ - try { - // Create - // where = "IsSubscriber==true"; - Users users = accountingApi.getUsers(accessToken, xeroTenantId, ifModifiedSince, where, order); - where = null; - - where = "ShowInExpenseClaims==true && Status==\"ACTIVE\""; - Accounts accounts = accountingApi.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order); - where = null; - - User useUser = new User(); - useUser.setUserID(users.getUsers().get(0).getUserID()); - - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - // CREATE NEW RECEIPT - Receipts receipts = new Receipts(); - Receipt receipt = new Receipt(); - - LineItem li = new LineItem(); - li.setAccountCode(accounts.getAccounts().get(0).getCode()); - li.setDescription("Foobar"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - receipt.addLineItemsItem(li); - receipt.setUser(useUser); - receipt.lineAmountTypes(LineAmountTypes.NOTAX); - receipt.contact(useContact); - receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT); - receipts.addReceiptsItem(receipt); - Receipts newReceipts = accountingApi.createReceipt(accessToken, xeroTenantId, receipts); - messages.add("Create Receipts - Total : " + newReceipts.getReceipts().get(0).getTotal()); - - // UPDATE Receipts - UUID newReceiptId = newReceipts.getReceipts().get(0).getReceiptID(); - newReceipts.getReceipts().get(0).setReference("Foobar"); - Receipts updateReceipts = accountingApi.updateReceipt(accessToken, xeroTenantId, newReceiptId, - newReceipts); - messages.add("Create Receipts - Ref : " + updateReceipts.getReceipts().get(0).getReference()); - - // GET all Receipts - Receipts allReceipts = accountingApi.getReceipts(accessToken, xeroTenantId, ifModifiedSince, where, - order, null); - messages.add("Create Receipts - Count : " + allReceipts.getReceipts().size()); - - // GET one Receipts - UUID receiptID = allReceipts.getReceipts().get(0).getReceiptID(); - Receipts oneReceipts = accountingApi.getReceipt(accessToken, xeroTenantId, receiptID); - messages.add("Create Receipts - Total : " + oneReceipts.getReceipts().get(0).getTotal()); - - // Get History - HistoryRecords history = accountingApi.getReceiptHistory(accessToken, xeroTenantId, receiptID); - messages.add("History - count : " + history.getHistoryRecords().size()); - - // Create History - // Error: "The document with the supplied id was not found for this endpoint. - /* - * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord - * newHistoryRecord = new HistoryRecord(); - * newHistoryRecord.setDetails("Hello World"); - * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords - * newHistory = accountingApi.createReceiptHistory(receiptID, - * newHistoryRecords); messages.add("History - note added to : " + - * newHistory.getHistoryRecords().get(0).getDetails()); - */ - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("RepeatingInvoices")) { - /* REPEATING INVOICE */ - try { - // GET all Repeating Invoices - RepeatingInvoices repeatingInvoices = accountingApi.getRepeatingInvoices(accessToken, xeroTenantId, - where, order); - if (repeatingInvoices.getRepeatingInvoices().size() > 0) { - messages.add("Repeating Invoice - count : " + repeatingInvoices.getRepeatingInvoices().size()); - - // GET one Repeating Invoices - UUID repeatingInvoiceID = repeatingInvoices.getRepeatingInvoices().get(0).getRepeatingInvoiceID(); - RepeatingInvoices repeatingInvoice = accountingApi.getRepeatingInvoice(accessToken, xeroTenantId, - repeatingInvoiceID); - messages.add( - "Repeating Invoice - total : " + repeatingInvoice.getRepeatingInvoices().get(0).getTotal()); - - // Get History - HistoryRecords history = accountingApi.getRepeatingInvoiceHistory(accessToken, xeroTenantId, - repeatingInvoiceID); - messages.add("History - count : " + history.getHistoryRecords().size()); - - // Create History - // Error: "The document with the supplied id was not found for this endpoint. - /* - * HistoryRecords newHistoryRecords = new HistoryRecords(); HistoryRecord - * newHistoryRecord = new HistoryRecord(); - * newHistoryRecord.setDetails("Hello World"); - * newHistoryRecords.addHistoryRecordsItem(newHistoryRecord); HistoryRecords - * newHistory = accountingApi.createRepeatingInvoiceHistory(repeatingInvoiceID, - * newHistoryRecords); messages.add("History - note added to : " + - * newHistory.getHistoryRecords().get(0).getDetails()); - */ - } else { - messages.add("Zero repeating Invoices found"); - - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Reports")) { - - /* REPORTS */ - try { - - /* - * // TenNinetyNine - US Only String reportYear = null; Reports reports = - * accountingApi.getReportTenNinetyNine(reportYear); - * System.out.println(reports.toString()); - */ - // AgedPayablesByContact - String date = null; - String fromDate = null; - String toDate = null; - String profitLossTimeframe = null; - String trackingOptionID1 = null; - String trackingOptionID2 = null; - boolean standardLayout = false; - boolean paymentsOnly = false; - String trackingCategoryID = null; - String trackingCategoryID2 = null; - String trackingOptionID = null; - - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, null, includeArchived); - UUID contactId = contacts.getContacts().get(0).getContactID(); - LocalDate xDate = LocalDate.now(); - LocalDate xFromDate = LocalDate.now(); - LocalDate xToDate = LocalDate.now(); - - ReportWithRows reportAgedPayablesByContact = accountingApi.getReportAgedPayablesByContact(accessToken, - xeroTenantId, contactId, xDate, xFromDate, xToDate); - messages.add("Get a Reports - Name:" + reportAgedPayablesByContact.getReports().get(0).getReportName()); - - // AgedReceivablesByContact - ReportWithRows reportAgedReceivablesByContact = accountingApi.getReportAgedReceivablesByContact( - accessToken, xeroTenantId, contactId, xDate, xFromDate, xToDate); - messages.add( - "Get a Reports - Name:" + reportAgedReceivablesByContact.getReports().get(0).getReportName()); - - // reportBalanceSheet - ReportWithRows reportBalanceSheet = accountingApi.getReportBalanceSheet(accessToken, xeroTenantId, - toDate, 3, "MONTH", trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly); - messages.add("Get a Reports - Name:" + reportBalanceSheet.getReports().get(0).getReportName()); - - // reportBankSummary - ReportWithRows reportBankSummary = accountingApi.getReportBankSummary(accessToken, xeroTenantId, - xToDate, null, null); - messages.add("Get a Reports - Name:" + reportBankSummary.getReports().get(0).getReportName()); - - // reportBASorGSTlist - AU and NZ only - ReportWithRows reportTax = accountingApi.getReportBASorGSTList(accessToken, xeroTenantId); - System.out.println(reportTax.toString()); - - // reportBudgetSummary - int budgetPeriod = 1; - int budgetTimeframe = 3; - ReportWithRows reportBudgetSummary = accountingApi.getReportBudgetSummary(accessToken, xeroTenantId, - xToDate, budgetPeriod, budgetTimeframe); - messages.add("Get a Reports - Name:" + reportBudgetSummary.getReports().get(0).getReportName()); - - // reportExecutiveSummary - ReportWithRows reportExecutiveSummary = accountingApi.getReportExecutiveSummary(accessToken, - xeroTenantId, xToDate); - messages.add("Get a Reports - Name:" + reportExecutiveSummary.getReports().get(0).getReportName()); - - // reportProfitandLoss - fromDate = "2018-01-01"; - toDate = "2018-12-31"; - profitLossTimeframe = "MONTH"; - standardLayout = true; - paymentsOnly = false; - ReportWithRows reportProfitLoss = accountingApi.getReportProfitAndLoss(accessToken, xeroTenantId, - xFromDate, xToDate, null, profitLossTimeframe, trackingCategoryID, trackingCategoryID2, - trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); - messages.add("Get a Reports - Name:" + reportProfitLoss.getReports().get(0).getReportName()); - fromDate = null; - toDate = null; - - // reportTrialBalance - ReportWithRows reportTrialBalance = accountingApi.getReportTrialBalance(accessToken, xeroTenantId, - xToDate, paymentsOnly); - messages.add("Get a Reports - Name:" + reportTrialBalance.getReports().get(0).getReportName()); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("TrackingCategories")) { - // TRACKING CATEGORIES - try { - // GET Tracking Categories - TrackingCategories trackingCategories = accountingApi.getTrackingCategories(accessToken, xeroTenantId, - where, order, includeArchived); - int count = trackingCategories.getTrackingCategories().size(); - - if (count == 2) { - // DELETE Tracking Categories - UUID trackingCategoryID = trackingCategories.getTrackingCategories().get(0).getTrackingCategoryID(); - TrackingCategories deletedTrackingCategories = accountingApi.deleteTrackingCategory(accessToken, - xeroTenantId, trackingCategoryID); - messages.add("DELETED tracking categories - status : " - + deletedTrackingCategories.getTrackingCategories().get(0).getStatus()); - } - - // CREATE Tracking Categories - TrackingCategory newTrackingCategory = new TrackingCategory(); - newTrackingCategory.setName("Foo" + loadRandomNum()); - TrackingCategories createdTrackingCategories = accountingApi.createTrackingCategory(accessToken, - xeroTenantId, newTrackingCategory); - messages.add("CREATED tracking categories - name : " - + createdTrackingCategories.getTrackingCategories().get(0).getName()); - - // UPDATE Tracking Categories - UUID newTrackingCategoryID = createdTrackingCategories.getTrackingCategories().get(0) - .getTrackingCategoryID(); - newTrackingCategory.setName("Foo" + loadRandomNum()); - TrackingCategories updatedTrackingCategories = accountingApi.updateTrackingCategory(accessToken, - xeroTenantId, newTrackingCategoryID, newTrackingCategory); - messages.add("UPDATED tracking categories - name : " - + updatedTrackingCategories.getTrackingCategories().get(0).getName()); - - // GET one Tracking Categories - if (count > 0) { - UUID oneTrackingCategoryID = trackingCategories.getTrackingCategories().get(0) - .getTrackingCategoryID(); - TrackingCategories oneTrackingCategories = accountingApi.getTrackingCategory(accessToken, - xeroTenantId, oneTrackingCategoryID); - messages.add("GET ONE tracking categories - name : " - + oneTrackingCategories.getTrackingCategories().get(0).getName()); - - // Create one Option - TrackingOption option = new TrackingOption(); - option.setName("Bar" + loadRandomNum()); - TrackingOptions newTrackingOptions = accountingApi.createTrackingOptions(accessToken, xeroTenantId, - oneTrackingCategoryID, option); - messages.add("CREATE option - name : " + newTrackingOptions.getOptions().get(0).getName()); - - // DELETE All options - // UUID newOptionId = - // newTrackingOptions.getOptions().get(0).getTrackingOptionID(); - // TrackingOptions deleteOptions = - // accountingApi.deleteTrackingOptions(oneTrackingCategoryID, newOptionId); - // messages.add("DELETE one option - Status : " + - // deleteOptions.getOptions().get(0).getStatus()); - } - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("TaxRates")) { - // TAX RATE - try { - // CREATE Tax Rate - TaxRates newTaxRates = new TaxRates(); - TaxRate newTaxRate = new TaxRate(); - TaxComponent rate01 = new TaxComponent(); - rate01.setName("State Tax"); - rate01.setRate(2.25); - newTaxRate.setName("SDKTax" + loadRandomNum()); - newTaxRate.addTaxComponentsItem(rate01); - newTaxRates.addTaxRatesItem(newTaxRate); - - TaxRates createdTaxRate = accountingApi.createTaxRate(accessToken, xeroTenantId, newTaxRates); - messages.add("CREATE TaxRate - name : " + createdTaxRate.getTaxRates().get(0).getName()); - - // UDPATE Tax Rate - newTaxRates.getTaxRates().get(0).setStatus(com.xero.models.accounting.TaxRate.StatusEnum.DELETED); - TaxRates updatedTaxRate = accountingApi.updateTaxRate(accessToken, xeroTenantId, newTaxRates); - messages.add("UPDATED TaxRate - status : " + updatedTaxRate.getTaxRates().get(0).getStatus()); - - // GET Tax Rate - String taxType = null; - TaxRates taxRates = accountingApi.getTaxRates(accessToken, xeroTenantId, where, order, taxType); - messages.add("GET TaxRate - cnt : " + taxRates.getTaxRates().size()); - - // GET Tax Rate - taxType = "CAPEXINPUT2"; - TaxRates taxRatesByType = accountingApi.getTaxRates(accessToken, xeroTenantId, where, order, taxType); - messages.add("GET TaxRate by Cap Purchase Type : " + taxRatesByType.getTaxRates().size()); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Users")) { - // USER - try { - // GET Users - Users users = accountingApi.getUsers(accessToken, xeroTenantId, ifModifiedSince, where, order); - messages.add("GET Users - cnt : " + users.getUsers().size()); - - // GET One User - UUID userID = users.getUsers().get(0).getUserID(); - Users user = accountingApi.getUser(accessToken, xeroTenantId, userID); - messages.add("GET Users - First Name : " + user.getUsers().get(0).getFirstName()); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } else if (object.equals("Errors")) { - - try { - Contact contact = new Contact(); - contact.setName("Sidney Maestre"); - Contacts createContact1 = accountingApi.createContact(accessToken, xeroTenantId, contact); - Contacts createContact2 = accountingApi.createContact(accessToken, xeroTenantId, contact); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - Contacts contacts = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, null, includeArchived); - Contact useContact = new Contact(); - useContact.setContactID(contacts.getContacts().get(0).getContactID()); - - Invoices newInvoices = new Invoices(); - Invoice myInvoice = new Invoice(); - - LineItem li = new LineItem(); - li.setAccountCode("123456789"); - li.setDescription("Acme Tires"); - li.setQuantity(2.0); - li.setUnitAmount(20.00); - li.setLineAmount(40.00); - li.setTaxType("NONE"); - - myInvoice.addLineItemsItem(li); - myInvoice.setContact(useContact); - myInvoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); - myInvoice.setReference("One Fish, Two Fish"); - myInvoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.SUBMITTED); - newInvoices.addInvoicesItem(myInvoice); - - Invoices newInvoice = accountingApi.createInvoice(accessToken, xeroTenantId, newInvoices, true); - messages.add("Create invoice - Reference : " + newInvoice.getInvoices().get(0).getReference()); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - try { - UUID badContactId = UUID.fromString("bd2270c3-0000-4c11-9cfb-000b551c3f51"); - Contacts badContacts = accountingApi.getContact(accessToken, xeroTenantId, badContactId); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - Contacts ContactList = accountingApi.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, - ids, null, includeArchived); - int num4 = findRandomNum(ContactList.getContacts().size()); - UUID contactId = ContactList.getContacts().get(num4).getContactID(); - try { - for (int i = 80; i > 1; i--) { - Contacts allMyContacts = accountingApi.getContact(accessToken, xeroTenantId, contactId); - } - messages.add("Congrats - you made over 60 calls without hitting rate limit"); - } catch (XeroApiException xe) { - this.addError(xe, messages); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } - - for (int i = 0; i < messages.size(); i++) { - System.out.println(messages.get(i)); - respWriter.println("

" + messages.get(i) + "

"); - } - - respWriter.println("
end processing request
"); - respWriter.println("
"); - } - - protected void addToMapIfNotNull(Map map, String key, Object value) { - if (value != null) { - map.put(key, value.toString()); - } - } - - protected void addError(XeroApiException xe, ArrayList messages) { - messages.add("Xero Exception: " + xe.getResponseCode()); - for (Element item : xe.getError().getElements()) { - for (ValidationError err : item.getValidationErrors()) { - messages.add("Error Msg: " + err.getMessage()); - } - } - } - - protected String saveFile(ByteArrayInputStream input, String fileName) { - String saveFilePath = null; - File f = new File("./"); - String dirPath; - try { - dirPath = f.getCanonicalPath(); - - FileOutputStream output = new FileOutputStream(fileName); - - int DEFAULT_BUFFER_SIZE = 1024; - byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; - int n = 0; - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - while (n >= 0) { - output.write(buffer, 0, n); - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - } - input.close(); - output.close(); - - saveFilePath = dirPath + File.separator + fileName; - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return saveFilePath; - } - - public static int loadRandomNum() { - Random randomGenerator = new Random(); - int randomInt = randomGenerator.nextInt(100000); - return randomInt; - } - - public static int findRandomNum(int total) { - Random randomGenerator = new Random(); - int randomInt = randomGenerator.nextInt(total); - return randomInt; - } -} diff --git a/src/main/java/com/xero/example/Authorization.java b/src/main/java/com/xero/example/Authorization.java deleted file mode 100644 index beaddb53..00000000 --- a/src/main/java/com/xero/example/Authorization.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.xero.example; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Random; - -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.google.api.client.auth.oauth2.AuthorizationCodeFlow; -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.ClientParametersAuthentication; -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.JsonFactory; -import com.google.api.client.json.jackson2.JacksonFactory; -import com.google.api.client.util.store.DataStoreFactory; -import com.google.api.client.util.store.MemoryDataStoreFactory; - -@WebServlet("/Authorization") -public class Authorization extends HttpServlet { - private static final long serialVersionUID = 1L; - final String clientId = "--YOUR_CLIENT_ID--"; - final String clientSecret = "--YOUR_CLIENT_SECRET--"; - final String redirectURI = "--YOUR_REDIRECT_URI--"; - - final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; - final String AUTHORIZATION_SERVER_URL = "https://login.xero.com/identity/connect/authorize"; - final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport(); - final JsonFactory JSON_FACTORY = new JacksonFactory(); - final String secretState = "secret" + new Random().nextInt(999_999); - - /** - * @see HttpServlet#HttpServlet() - */ - public Authorization() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - ArrayList scopeList = new ArrayList(); - scopeList.add("openid"); - scopeList.add("email"); - scopeList.add("profile"); - scopeList.add("offline_access"); - scopeList.add("accounting.settings"); - scopeList.add("accounting.transactions"); - scopeList.add("accounting.contacts"); - scopeList.add("accounting.journals.read"); - scopeList.add("accounting.reports.read"); - scopeList.add("accounting.attachments"); - scopeList.add("paymentservices"); - - DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory(); - AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(), - HTTP_TRANSPORT, JSON_FACTORY, new GenericUrl(TOKEN_SERVER_URL), - new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL) - .setScopes(scopeList).setDataStoreFactory(DATA_STORE_FACTORY).build(); - - String url = flow.newAuthorizationUrl().setClientId(clientId).setScopes(scopeList).setState(secretState) - .setRedirectUri(redirectURI).build(); - - response.sendRedirect(url); - } -} diff --git a/src/main/java/com/xero/example/Callback.java b/src/main/java/com/xero/example/Callback.java deleted file mode 100644 index 5ef4abf9..00000000 --- a/src/main/java/com/xero/example/Callback.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.xero.example; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.google.api.client.auth.oauth2.AuthorizationCodeFlow; -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.ClientParametersAuthentication; -import com.google.api.client.auth.oauth2.TokenResponse; -import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.JsonFactory; -import com.google.api.client.json.jackson2.JacksonFactory; -import com.google.api.client.util.store.DataStoreFactory; -import com.google.api.client.util.store.MemoryDataStoreFactory; -import com.xero.api.ApiClient; -import com.xero.api.client.IdentityApi; -import com.xero.models.identity.Connection; - -@WebServlet("/Callback") -public class Callback extends HttpServlet { - private static final long serialVersionUID = 1L; - final String clientId = "--YOUR_CLIENT_ID--"; - final String clientSecret = "--YOUR_CLIENT_SECRET--"; - final String redirectURI = "--YOUR_REDIRECT_URI--"; - final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; - final String AUTHORIZATION_SERVER_URL = "https://login.xero.com/identity/connect/authorize"; - final NetHttpTransport HTTP_TRANSPORT = new NetHttpTransport(); - final JsonFactory JSON_FACTORY = new JacksonFactory(); - - /** - * @see HttpServlet#HttpServlet() - */ - public Callback() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - String code = "123"; - if (request.getParameter("code") != null) { - code = request.getParameter("code"); - } - - ArrayList scopeList = new ArrayList(); - scopeList.add("openid"); - scopeList.add("email"); - scopeList.add("profile"); - scopeList.add("offline_access"); - scopeList.add("accounting.settings"); - scopeList.add("accounting.transactions"); - scopeList.add("accounting.contacts"); - scopeList.add("accounting.journals.read"); - scopeList.add("accounting.reports.read"); - scopeList.add("accounting.attachments"); - scopeList.add("paymentservices"); - - DataStoreFactory DATA_STORE_FACTORY = new MemoryDataStoreFactory(); - - AuthorizationCodeFlow flow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(), - HTTP_TRANSPORT, JSON_FACTORY, new GenericUrl(TOKEN_SERVER_URL), - new ClientParametersAuthentication(clientId, clientSecret), clientId, AUTHORIZATION_SERVER_URL) - .setScopes(scopeList).setDataStoreFactory(DATA_STORE_FACTORY).build(); - - TokenResponse tokenResponse = flow.newTokenRequest(code).setRedirectUri(redirectURI).execute(); - - HttpTransport httpTransport = new NetHttpTransport(); - JsonFactory jsonFactory = new JacksonFactory(); - GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport) - .setJsonFactory(jsonFactory).setClientSecrets(clientId, clientSecret).build(); - credential.setAccessToken(tokenResponse.getAccessToken()); - credential.setRefreshToken(tokenResponse.getRefreshToken()); - credential.setExpiresInSeconds(tokenResponse.getExpiresInSeconds()); - - // Create requestFactory with credentials - HttpTransport transport = new NetHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - - // Init IdentityApi client - ApiClient defaultClient = new ApiClient("https://api.xero.com", null, null, null, requestFactory); - IdentityApi idApi = new IdentityApi(defaultClient); - List connection = idApi.getConnections(); - - TokenStorage store = new TokenStorage(); - store.saveItem(response, "jwt_token", tokenResponse.toPrettyString()); - store.saveItem(response, "access_token", tokenResponse.getAccessToken()); - store.saveItem(response, "refresh_token", tokenResponse.getRefreshToken()); - store.saveItem(response, "expires_in_seconds", tokenResponse.getExpiresInSeconds().toString()); - store.saveItem(response, "xero_tenant_id", connection.get(0).getTenantId().toString()); - - response.sendRedirect("./AuthenticatedResource"); - } -} diff --git a/src/main/java/com/xero/example/TokenRefresh.java b/src/main/java/com/xero/example/TokenRefresh.java deleted file mode 100644 index 9bf791ce..00000000 --- a/src/main/java/com/xero/example/TokenRefresh.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.xero.example; - -import java.io.IOException; - -import javax.servlet.http.HttpServletResponse; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.auth0.jwt.JWT; -import com.auth0.jwt.exceptions.JWTDecodeException; -import com.auth0.jwt.interfaces.DecodedJWT; -import com.google.api.client.auth.oauth2.RefreshTokenRequest; -import com.google.api.client.auth.oauth2.TokenResponse; -import com.google.api.client.auth.oauth2.TokenResponseException; -import com.google.api.client.http.BasicAuthentication; -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.jackson2.JacksonFactory; - -public class TokenRefresh { - final static Logger logger = LogManager.getLogger(AuthenticatedResource.class); - final String clientId = "--YOUR_CLIENT_ID--"; - final String clientSecret = "--YOUR_CLIENT_SECRET--"; - final String TOKEN_SERVER_URL = "https://identity.xero.com/connect/token"; - - public TokenRefresh() { - super(); - } - - public String checkToken(String accessToken, String refreshToken, HttpServletResponse response) throws IOException { - String currToken = null; - - try { - DecodedJWT jwt = JWT.decode(accessToken); - - if (jwt.getExpiresAt().getTime() > System.currentTimeMillis()) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ Refresh Token : NOT NEEDED - return current token -------------------"); - } - currToken = accessToken; - } else { - if (logger.isDebugEnabled()) { - logger.debug("------------------ Refresh Token : BEGIN -------------------"); - } - try { - TokenResponse tokenResponse = new RefreshTokenRequest(new NetHttpTransport(), new JacksonFactory(), - new GenericUrl(TOKEN_SERVER_URL), refreshToken) - .setClientAuthentication(new BasicAuthentication(this.clientId, this.clientSecret)) - .execute(); - if (logger.isDebugEnabled()) { - logger.debug("------------------ Refresh Token : SUCCESS -------------------"); - } - - // DEMO PURPOSE ONLY - You'll need to implement your own token storage solution - TokenStorage store = new TokenStorage(); - store.saveItem(response, "jwt_token", tokenResponse.toPrettyString()); - store.saveItem(response, "access_token", tokenResponse.getAccessToken()); - store.saveItem(response, "refresh_token", tokenResponse.getRefreshToken()); - store.saveItem(response, "expires_in_seconds", tokenResponse.getExpiresInSeconds().toString()); - - currToken = tokenResponse.getAccessToken(); - } catch (TokenResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug("------------------ Refresh Token : EXCEPTION -------------------"); - } - if (e.getDetails() != null) { - if (logger.isDebugEnabled()) { - logger.debug("Error: " + e.getDetails().getError()); - } - if (e.getDetails().getErrorDescription() != null) { - if (logger.isDebugEnabled()) { - logger.debug(e.getDetails().getErrorDescription()); - } - } - if (e.getDetails().getErrorUri() != null) { - - if (logger.isDebugEnabled()) { - logger.debug(e.getDetails().getErrorUri()); - } - } - } else { - if (logger.isDebugEnabled()) { - logger.debug("------------------ Refresh Token : EXCEPTION -------------------"); - logger.debug(e.getMessage()); - } - } - } - } - - } catch (JWTDecodeException exception) { - if (logger.isDebugEnabled()) { - logger.debug("------------------ Refresh Token : INVALID TOKEN -------------------"); - logger.debug(exception.getMessage()); - } - } - - return currToken; - } - -} diff --git a/src/main/java/com/xero/example/TokenStorage.java b/src/main/java/com/xero/example/TokenStorage.java deleted file mode 100644 index 27252d67..00000000 --- a/src/main/java/com/xero/example/TokenStorage.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.xero.example; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class TokenStorage { - - public TokenStorage() { - super(); - } - - public String get(HttpServletRequest request, String key) { - String item = null; - Cookie[] cookies = request.getCookies(); - if (cookies != null) { - for (int i = 0; i < cookies.length; i++) { - if (cookies[i].getName().equals(key)) { - item = cookies[i].getValue(); - } - } - } - return item; - } - - public void clear(HttpServletResponse response) { - HashMap map = new HashMap(); - map.put("tempToken", ""); - map.put("tempTokenSecret", ""); - map.put("sessionHandle", ""); - map.put("tokenTimestamp", ""); - - save(response, map); - } - - public void saveItem(HttpServletResponse response, String key, String value) { - Cookie t = new Cookie(key, value); - response.addCookie(t); - } - - public void save(HttpServletResponse response, HashMap map) { - Set> set = map.entrySet(); - Iterator> iterator = set.iterator(); - - while (iterator.hasNext()) { - Map.Entry mentry = iterator.next(); - String key = (String) mentry.getKey(); - String value = (String) mentry.getValue(); - - Cookie t = new Cookie(key, value); - response.addCookie(t); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/xero/models/accounting/Invoice.java b/src/main/java/com/xero/models/accounting/Invoice.java index 4aea66e8..72daad04 100644 --- a/src/main/java/com/xero/models/accounting/Invoice.java +++ b/src/main/java/com/xero/models/accounting/Invoice.java @@ -49,7 +49,11 @@ public class Invoice { public enum TypeEnum { ACCREC("ACCREC"), - ACCPAY("ACCPAY"); + ACCPAY("ACCPAY"), + + ACCPAYCREDIT("ACCPAYCREDIT"), + + AROVERPAYMENT("AROVERPAYMENT"); private String value; @@ -186,6 +190,10 @@ public static StatusEnum fromValue(String value) { private LocalDate plannedPaymentDate; + @JsonProperty("CISDeduction") + private Double ciSDeduction; + + @JsonProperty("SubTotal") private Double subTotal; @@ -558,6 +566,15 @@ public void setPlannedPaymentDate(LocalDate plannedPaymentDate) { this.plannedPaymentDate = plannedPaymentDate; } + /** + * CIS deduction for UK contractors + * @return ciSDeduction + **/ + @ApiModelProperty(value = "CIS deduction for UK contractors") + public Double getCiSDeduction() { + return ciSDeduction; + } + /** * Total of invoice excluding taxes * @return subTotal @@ -825,6 +842,7 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.sentToContact, invoice.sentToContact) && Objects.equals(this.expectedPaymentDate, invoice.expectedPaymentDate) && Objects.equals(this.plannedPaymentDate, invoice.plannedPaymentDate) && + Objects.equals(this.ciSDeduction, invoice.ciSDeduction) && Objects.equals(this.subTotal, invoice.subTotal) && Objects.equals(this.totalTax, invoice.totalTax) && Objects.equals(this.total, invoice.total) && @@ -849,7 +867,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(type, contact, lineItems, date, dueDate, lineAmountTypes, invoiceNumber, reference, brandingThemeID, url, currencyCode, currencyRate, status, sentToContact, expectedPaymentDate, plannedPaymentDate, subTotal, totalTax, total, totalDiscount, invoiceID, hasAttachments, isDiscounted, payments, prepayments, overpayments, amountDue, amountPaid, fullyPaidOnDate, amountCredited, updatedDateUTC, creditNotes, attachments, hasErrors, statusAttributeString, validationErrors); + return Objects.hash(type, contact, lineItems, date, dueDate, lineAmountTypes, invoiceNumber, reference, brandingThemeID, url, currencyCode, currencyRate, status, sentToContact, expectedPaymentDate, plannedPaymentDate, ciSDeduction, subTotal, totalTax, total, totalDiscount, invoiceID, hasAttachments, isDiscounted, payments, prepayments, overpayments, amountDue, amountPaid, fullyPaidOnDate, amountCredited, updatedDateUTC, creditNotes, attachments, hasErrors, statusAttributeString, validationErrors); } @@ -873,6 +891,7 @@ public String toString() { sb.append(" sentToContact: ").append(toIndentedString(sentToContact)).append("\n"); sb.append(" expectedPaymentDate: ").append(toIndentedString(expectedPaymentDate)).append("\n"); sb.append(" plannedPaymentDate: ").append(toIndentedString(plannedPaymentDate)).append("\n"); + sb.append(" ciSDeduction: ").append(toIndentedString(ciSDeduction)).append("\n"); sb.append(" subTotal: ").append(toIndentedString(subTotal)).append("\n"); sb.append(" totalTax: ").append(toIndentedString(totalTax)).append("\n"); sb.append(" total: ").append(toIndentedString(total)).append("\n"); diff --git a/src/main/java/com/xero/models/accounting/Overpayment.java b/src/main/java/com/xero/models/accounting/Overpayment.java index da18a76b..7eac5648 100644 --- a/src/main/java/com/xero/models/accounting/Overpayment.java +++ b/src/main/java/com/xero/models/accounting/Overpayment.java @@ -46,7 +46,9 @@ public class Overpayment { public enum TypeEnum { RECEIVE_OVERPAYMENT("RECEIVE-OVERPAYMENT"), - SPEND_OVERPAYMENT("SPEND-OVERPAYMENT"); + SPEND_OVERPAYMENT("SPEND-OVERPAYMENT"), + + AROVERPAYMENT("AROVERPAYMENT"); private String value; diff --git a/src/main/java/com/xero/models/accounting/Prepayment.java b/src/main/java/com/xero/models/accounting/Prepayment.java index 6606c382..5b8e2976 100644 --- a/src/main/java/com/xero/models/accounting/Prepayment.java +++ b/src/main/java/com/xero/models/accounting/Prepayment.java @@ -45,7 +45,11 @@ public class Prepayment { public enum TypeEnum { RECEIVE_PREPAYMENT("RECEIVE-PREPAYMENT"), - SPEND_PREPAYMENT("SPEND-PREPAYMENT"); + SPEND_PREPAYMENT("SPEND-PREPAYMENT"), + + ARPREPAYMENT("ARPREPAYMENT"), + + APPREPAYMENT("APPREPAYMENT"); private String value; diff --git a/src/main/java/com/xero/models/accounting/Receipt.java b/src/main/java/com/xero/models/accounting/Receipt.java index 9eeca8f8..8d8cac8f 100644 --- a/src/main/java/com/xero/models/accounting/Receipt.java +++ b/src/main/java/com/xero/models/accounting/Receipt.java @@ -87,7 +87,7 @@ public enum StatusEnum { SUBMITTED("SUBMITTED"), - AUTHORIZED("AUTHORIZED"), + AUTHORISED("AUTHORISED"), DECLINED("DECLINED"); diff --git a/src/main/java/com/xero/models/accounting/Report.java b/src/main/java/com/xero/models/accounting/Report.java index 55350c12..de076efc 100644 --- a/src/main/java/com/xero/models/accounting/Report.java +++ b/src/main/java/com/xero/models/accounting/Report.java @@ -23,6 +23,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; +import java.util.UUID; import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -34,7 +35,7 @@ public class Report { @JsonProperty("ReportID") - private String reportID; + private UUID reportID; @JsonProperty("ReportName") @@ -93,7 +94,7 @@ public static ReportTypeEnum fromValue(String value) { @JsonProperty("Contacts") private List contacts = new ArrayList(); - public Report reportID(String reportID) { + public Report reportID(UUID reportID) { this.reportID = reportID; return this; } @@ -103,11 +104,11 @@ public Report reportID(String reportID) { * @return reportID **/ @ApiModelProperty(value = "See Prepayment Types") - public String getReportID() { + public UUID getReportID() { return reportID; } - public void setReportID(String reportID) { + public void setReportID(UUID reportID) { this.reportID = reportID; } diff --git a/src/main/java/com/xero/models/accounting/ReportFields.java b/src/main/java/com/xero/models/accounting/ReportFields.java index 250e10e9..a5a3757d 100644 --- a/src/main/java/com/xero/models/accounting/ReportFields.java +++ b/src/main/java/com/xero/models/accounting/ReportFields.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -30,7 +31,7 @@ public class ReportFields { @JsonProperty("FieldID") - private String fieldID; + private UUID fieldID; @JsonProperty("Description") @@ -40,7 +41,7 @@ public class ReportFields { @JsonProperty("Value") private String value; - public ReportFields fieldID(String fieldID) { + public ReportFields fieldID(UUID fieldID) { this.fieldID = fieldID; return this; } @@ -50,11 +51,11 @@ public ReportFields fieldID(String fieldID) { * @return fieldID **/ @ApiModelProperty(value = "") - public String getFieldID() { + public UUID getFieldID() { return fieldID; } - public void setFieldID(String fieldID) { + public void setFieldID(UUID fieldID) { this.fieldID = fieldID; } diff --git a/src/main/java/com/xero/models/accounting/ReportWithRow.java b/src/main/java/com/xero/models/accounting/ReportWithRow.java index 33ba4acc..5d400537 100644 --- a/src/main/java/com/xero/models/accounting/ReportWithRow.java +++ b/src/main/java/com/xero/models/accounting/ReportWithRow.java @@ -24,6 +24,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; +import java.util.UUID; import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -35,7 +36,7 @@ public class ReportWithRow { @JsonProperty("ReportID") - private String reportID; + private UUID reportID; @JsonProperty("ReportName") @@ -69,7 +70,7 @@ public class ReportWithRow { @JsonProperty("Fields") private List fields = new ArrayList(); - public ReportWithRow reportID(String reportID) { + public ReportWithRow reportID(UUID reportID) { this.reportID = reportID; return this; } @@ -79,11 +80,11 @@ public ReportWithRow reportID(String reportID) { * @return reportID **/ @ApiModelProperty(value = "Report id") - public String getReportID() { + public UUID getReportID() { return reportID; } - public void setReportID(String reportID) { + public void setReportID(UUID reportID) { this.reportID = reportID; } diff --git a/src/main/java/com/xero/models/accounting/User.java b/src/main/java/com/xero/models/accounting/User.java index cd56d02b..01f337b6 100644 --- a/src/main/java/com/xero/models/accounting/User.java +++ b/src/main/java/com/xero/models/accounting/User.java @@ -68,7 +68,9 @@ public enum OrganisationRoleEnum { MANAGEDCLIENT("MANAGEDCLIENT"), - CASHBOOKCLIENT("CASHBOOKCLIENT"); + CASHBOOKCLIENT("CASHBOOKCLIENT"), + + UNKNOWN("UNKNOWN"); private String value; From d27fe970f0a83c5da7c8442712d1d8a2b6ca09ef Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Fri, 6 Sep 2019 15:06:58 -0700 Subject: [PATCH 60/76] updated reports and tests --- .../com/xero/api/client/AccountingApi.java | 18 +++--------------- .../com/xero/models/accounting/Report.java | 9 ++++----- .../xero/models/accounting/ReportWithRow.java | 9 ++++----- .../AccountingApiBankTransactionTest.java | 4 ++-- .../api/client/AccountingApiContactsTest.java | 2 +- .../client/AccountingApiCreditNotesTest.java | 4 ++-- .../api/client/AccountingApiEmployeesTest.java | 4 ++-- .../client/AccountingApiExpenseClaimsTest.java | 3 +-- .../api/client/AccountingApiInvoicesTest.java | 15 +++++++-------- .../api/client/AccountingApiItemsTest.java | 4 ++-- .../AccountingApiPurchaseOrdersTest.java | 5 ++--- .../api/client/AccountingApiReportsTest.java | 16 ++++++++-------- 12 files changed, 38 insertions(+), 55 deletions(-) diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index c2c410f3..ec99b115 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -1963,15 +1963,14 @@ public HttpResponse createExpenseClaimsForHttpResponse(String accessToken, Stri *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant * @param invoice The invoice parameter - * @param summarizeErrors shows validation errors for each invoice * @param accessToken Authorization token for user set in header of each request * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API **/ - public Invoices createInvoice(String accessToken, String xeroTenantId, Invoice invoice, Boolean summarizeErrors) throws IOException { + public Invoices createInvoice(String accessToken, String xeroTenantId, Invoice invoice) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createInvoiceForHttpResponse(accessToken, xeroTenantId, invoice, summarizeErrors); + HttpResponse response = createInvoiceForHttpResponse(accessToken, xeroTenantId, invoice); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1982,7 +1981,7 @@ public Invoices createInvoice(String accessToken, String xeroTenantId, Invoice return null; } - public HttpResponse createInvoiceForHttpResponse(String accessToken, String xeroTenantId, Invoice invoice, Boolean summarizeErrors) throws IOException { + public HttpResponse createInvoiceForHttpResponse(String accessToken, String xeroTenantId, Invoice invoice) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoice"); @@ -2000,17 +1999,6 @@ public HttpResponse createInvoiceForHttpResponse(String accessToken, String xer String correctPath = "/Invoices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - if (summarizeErrors != null) { - String key = "SummarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); - } 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); diff --git a/src/main/java/com/xero/models/accounting/Report.java b/src/main/java/com/xero/models/accounting/Report.java index de076efc..55350c12 100644 --- a/src/main/java/com/xero/models/accounting/Report.java +++ b/src/main/java/com/xero/models/accounting/Report.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import java.util.UUID; import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -35,7 +34,7 @@ public class Report { @JsonProperty("ReportID") - private UUID reportID; + private String reportID; @JsonProperty("ReportName") @@ -94,7 +93,7 @@ public static ReportTypeEnum fromValue(String value) { @JsonProperty("Contacts") private List contacts = new ArrayList(); - public Report reportID(UUID reportID) { + public Report reportID(String reportID) { this.reportID = reportID; return this; } @@ -104,11 +103,11 @@ public Report reportID(UUID reportID) { * @return reportID **/ @ApiModelProperty(value = "See Prepayment Types") - public UUID getReportID() { + public String getReportID() { return reportID; } - public void setReportID(UUID reportID) { + public void setReportID(String reportID) { this.reportID = reportID; } diff --git a/src/main/java/com/xero/models/accounting/ReportWithRow.java b/src/main/java/com/xero/models/accounting/ReportWithRow.java index 5d400537..33ba4acc 100644 --- a/src/main/java/com/xero/models/accounting/ReportWithRow.java +++ b/src/main/java/com/xero/models/accounting/ReportWithRow.java @@ -24,7 +24,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import java.util.UUID; import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -36,7 +35,7 @@ public class ReportWithRow { @JsonProperty("ReportID") - private UUID reportID; + private String reportID; @JsonProperty("ReportName") @@ -70,7 +69,7 @@ public class ReportWithRow { @JsonProperty("Fields") private List fields = new ArrayList(); - public ReportWithRow reportID(UUID reportID) { + public ReportWithRow reportID(String reportID) { this.reportID = reportID; return this; } @@ -80,11 +79,11 @@ public ReportWithRow reportID(UUID reportID) { * @return reportID **/ @ApiModelProperty(value = "Report id") - public UUID getReportID() { + public String getReportID() { return reportID; } - public void setReportID(UUID reportID) { + public void setReportID(String reportID) { this.reportID = reportID; } diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java index ad76e738..48c7d8d9 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java @@ -135,8 +135,8 @@ public void testUpdateBankTransaction() throws Exception { @Test public void testCreateBankTransaction() throws Exception { System.out.println("@Test - createBankTransaction"); - BankTransactions newBankTransactions = new BankTransactions(); - BankTransactions response = accountingApi.createBankTransaction(accessToken,xeroTenantId,newBankTransactions,null); + BankTransaction newBankTransaction = new BankTransaction(); + BankTransactions response = accountingApi.createBankTransaction(accessToken,xeroTenantId,newBankTransaction); assertThat(response.getBankTransactions().get(0).getBankTransactionID(), is(equalTo(UUID.fromString("1289c190-e46d-434b-9628-463ffdb52f00")))); assertThat(response.getBankTransactions().get(0).getStatus(), is(equalTo(com.xero.models.accounting.BankTransaction.StatusEnum.AUTHORISED))); diff --git a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java index ba7115a7..0fae54cc 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java @@ -91,7 +91,7 @@ public void getContactsTest() throws IOException { OffsetDateTime ifModifiedSince = null; String where = null; String order = null; - String ids = null; + List ids = new ArrayList(); Boolean includeArchived = null; Contacts response = accountingApi.getContacts(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, null, includeArchived); diff --git a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java index 6371584d..df932670 100644 --- a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java @@ -88,8 +88,8 @@ public void tearDown() { public void createCreditNoteTest() throws IOException { System.out.println("@Test - createCreditNote"); Boolean summarizeErrors = null; - CreditNotes creditNotes = new CreditNotes(); - CreditNotes response = accountingApi.createCreditNote(accessToken,xeroTenantId,creditNotes, summarizeErrors); + CreditNote creditNote = new CreditNote(); + CreditNotes response = accountingApi.createCreditNote(accessToken,xeroTenantId,creditNote); assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT))); assertThat(response.getCreditNotes().get(0).getStatus(), is(equalTo(com.xero.models.accounting.CreditNote.StatusEnum.DRAFT))); diff --git a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java index a7d176e9..6ec6f7ac 100644 --- a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java @@ -83,8 +83,8 @@ public void tearDown() { @Test public void createEmployeeTest() throws IOException { System.out.println("@Test - createEmployee"); - Employees employees = new Employees(); - Employees response = accountingApi.createEmployee(accessToken,xeroTenantId,employees); + Employee employee = new Employee(); + Employees response = accountingApi.createEmployee(accessToken,xeroTenantId,employee); assertThat(response.getEmployees().get(0).getEmployeeID(), is(equalTo(UUID.fromString("e1ada26b-a10e-4065-a941-af34b53740e3")))); assertThat(response.getEmployees().get(0).getStatus(), is(equalTo(com.xero.models.accounting.Employee.StatusEnum.ACTIVE))); diff --git a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java index 21380366..73b5672a 100644 --- a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java @@ -87,8 +87,7 @@ public void tearDown() { public void createExpenseClaimTest() throws IOException { System.out.println("@Test - createExpenseClaim"); ExpenseClaims expenseClaims = new ExpenseClaims(); - Boolean summarizeErrors = null; - ExpenseClaims response = accountingApi.createExpenseClaim(accessToken,xeroTenantId,expenseClaims, summarizeErrors); + ExpenseClaims response = accountingApi.createExpenseClaims(accessToken,xeroTenantId,expenseClaims); assertThat(response.getExpenseClaims().get(0).getExpenseClaimID(), is(equalTo(UUID.fromString("646b15ab-b874-4e13-82ae-f4385b2ac4b6")))); assertThat(response.getExpenseClaims().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED))); diff --git a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java index 1313078c..0df0420a 100644 --- a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java @@ -86,9 +86,8 @@ public void tearDown() { @Test public void createInvoiceTest() throws IOException { System.out.println("@Test - createInvoice"); - Invoices invoices = new Invoices(); - Boolean summarizeErrors = null; - Invoices response = accountingApi.createInvoice(accessToken,xeroTenantId,invoices, summarizeErrors); + Invoice invoice = new Invoice(); + Invoices response = accountingApi.createInvoice(accessToken,xeroTenantId,invoice); assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2019, 03, 10)))); @@ -247,15 +246,15 @@ public void getInvoicesTest() throws IOException { OffsetDateTime ifModifiedSince = null; String where = null; String order = null; - String ids = null; - String invoiceNumbers = null; - String contactIDs = null; - String statuses = null; + List ids = new ArrayList(); + List invoiceNumbers = new ArrayList(); + List contactIDs = new ArrayList(); + List statuses = new ArrayList(); Integer page = null; Boolean includeArchived = null; Boolean createdByMyApp = null; Integer unitdp = null; - Invoices response = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); + Invoices response = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp); assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC))); assertThat(response.getInvoices().get(0).getDate(), is(equalTo(LocalDate.of(2018,10,19)))); diff --git a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java index 736395ac..739bf369 100644 --- a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java @@ -83,8 +83,8 @@ public void tearDown() { @Test public void createItemTest() throws IOException { System.out.println("@Test - createItem"); - Items items = new Items(); - Items response = accountingApi.createItem(accessToken,xeroTenantId,items); + Item item = new Item(); + Items response = accountingApi.createItem(accessToken,xeroTenantId,item); assertThat(response.getItems().get(0).getCode(), is(equalTo("abc65591"))); assertThat(response.getItems().get(0).getName(), is(equalTo("Hello11350"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java index 99e7defc..d8096b1b 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java @@ -82,9 +82,8 @@ public void tearDown() { @Test public void createPurchaseOrderTest() throws IOException { System.out.println("@Test - createPurchaseOrder"); - PurchaseOrders purchaseOrders = new PurchaseOrders(); - Boolean summarizeErrors = null; - PurchaseOrders response = accountingApi.createPurchaseOrder(accessToken,xeroTenantId,purchaseOrders, summarizeErrors); + PurchaseOrder purchaseOrder = new PurchaseOrder(); + PurchaseOrders response = accountingApi.createPurchaseOrder(accessToken,xeroTenantId,purchaseOrder); // TODO: test validations assertThat(response.getPurchaseOrders().get(0).getContact().getContactID(), is(equalTo(UUID.fromString("430fa14a-f945-44d3-9f97-5df5e28441b8")))); diff --git a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java index 7bae38f7..515cc48c 100644 --- a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java @@ -106,7 +106,7 @@ public void getReportAgedPayablesByContactTest() throws IOException { assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getValue(), is(equalTo("2018-10-09T00:00:00"))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("invoiceID"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("1f3960ae-0537-4438-a4dd-76d785e6d7d8"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue().toString(), is(equalTo("1f3960ae-0537-4438-a4dd-76d785e6d7d8"))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SUMMARYROW))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(0).getValue(), is(equalTo("Total"))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(4).getValue(), is(equalTo("250.00"))); @@ -141,7 +141,7 @@ public void getReportAgedReceivablesByContactTest() throws IOException { assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getValue(), is(equalTo("2018-05-13T00:00:00"))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("invoiceID"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("40ebad47-24e2-4dc9-a5f5-579df427671b"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue().toString(), is(equalTo("40ebad47-24e2-4dc9-a5f5-579df427671b"))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(0).getValue(), is(equalTo("2019-04-23T00:00:00"))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(1).getCells().get(4).getValue(), is(equalTo("50.00"))); @@ -181,7 +181,7 @@ public void getReportBalanceSheetTest() throws IOException { assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Country Savings"))); assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); - assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("041207d2-3d61-4e5d-8c1a-b9236955a71c"))); + assertThat(response.getReports().get(0).getRows().get(2).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue().toString(), is(equalTo("041207d2-3d61-4e5d-8c1a-b9236955a71c"))); //System.out.println(response.getReports().toString()); } @@ -211,7 +211,7 @@ public void getReportBankSummaryTest() throws IOException { assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big City Bank"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("accountID"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("03f9cf1e-2deb-4bf1-b0a8-b57f08672eb8"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue().toString(), is(equalTo("03f9cf1e-2deb-4bf1-b0a8-b57f08672eb8"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SUMMARYROW))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(0).getValue(), is(equalTo("Total"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(4).getValue(), is(equalTo("10.00"))); @@ -298,7 +298,7 @@ public void getReportTrialBalanceTest() throws IOException { assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big Expense (002)"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue().toString(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); //System.out.println(response.getReports().get(0).toString()); } @@ -335,7 +335,7 @@ public void getReportBudgetSummaryTest() throws IOException { assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big Expense"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue().toString(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); //System.out.println(response.toString()); } @@ -371,10 +371,10 @@ public void getReportProfitAndLossTest() throws IOException { assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big Expense"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue().toString(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getValue(), is(equalTo("480.00"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getAttributes().get(0).getId(), is(equalTo("account"))); - assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getAttributes().get(0).getValue(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); + assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getAttributes().get(0).getValue().toString(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); //System.out.println(response.toString()); } From 195ba3f347aefc05c0b4653aa505af27bdd4de02 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Sat, 5 Oct 2019 15:02:21 +1000 Subject: [PATCH 61/76] Update create methods to match plural array requestBody Change operationId aka method name createLinkedTransaction becomes createLinkedTransactions createManualJournal become createManualJournals createOverpaymentAllocation becomes createOverpaymentAllocations createPayment becomes createPayments Add updateTrackingOptions method Add AVALARA Enum --- README.md | 2 +- .../com/xero/api/client/AccountingApi.java | 323 +++++++++++------- .../models/accounting/BankTransaction.java | 4 +- .../com/xero/models/accounting/TaxRate.java | 4 +- 4 files changed, 205 insertions(+), 128 deletions(-) diff --git a/README.md b/README.md index 209cf480..f185c43d 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Follow these steps to create your Xero app * Agree to terms and condition and click "Create App". * Click "Generate a secret" button. * Copy your client id and client secret and save for use later. -* Click the "Save" button. You secret is now hidden. +* Click the "Save" button. Your secret is now hidden. ### Add Xero-Java Dependency diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index ec99b115..e0fcd95e 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -2425,10 +2425,10 @@ public HttpResponse createItemsForHttpResponse(String accessToken, String xeroT * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API **/ - public LinkedTransactions createLinkedTransaction(String accessToken, String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { + public LinkedTransactions createLinkedTransactions(String accessToken, String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createLinkedTransactionForHttpResponse(accessToken, xeroTenantId, linkedTransactions); + HttpResponse response = createLinkedTransactionsForHttpResponse(accessToken, xeroTenantId, linkedTransactions); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -2439,16 +2439,16 @@ public LinkedTransactions createLinkedTransaction(String accessToken, String xe return null; } - public HttpResponse createLinkedTransactionForHttpResponse(String accessToken, String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { + public HttpResponse createLinkedTransactionsForHttpResponse(String accessToken, String xeroTenantId, LinkedTransactions linkedTransactions) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransactions"); }// verify the required parameter 'linkedTransactions' is set if (linkedTransactions == null) { - throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransaction"); + throw new IllegalArgumentException("Missing the required parameter 'linkedTransactions' when calling createLinkedTransactions"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createLinkedTransaction"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createLinkedTransactions"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -2475,19 +2475,21 @@ public HttpResponse createLinkedTransactionForHttpResponse(String accessToken, } /** - * Allows you to create a manual journal - *

200 - Success - return response of type ManualJournals array with newly created ManualJournal + * Allows you to create a specified Attachment on ManualJournal by file name + *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param manualJournals The manualJournals parameter + * @param manualJournalID Unique identifier for a ManualJournal + * @param fileName The name of the file being attached to a ManualJournal + * @param body Byte array of file in body of request * @param accessToken Authorization token for user set in header of each request - * @return ManualJournals + * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API **/ - public ManualJournals createManualJournal(String accessToken, String xeroTenantId, ManualJournals manualJournals) throws IOException { + public Attachments createManualJournalAttachmentByFileName(String accessToken, String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createManualJournalForHttpResponse(accessToken, xeroTenantId, manualJournals); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(accessToken, xeroTenantId, manualJournalID, fileName, body); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -2498,33 +2500,47 @@ public ManualJournals createManualJournal(String accessToken, String xeroTenant return null; } - public HttpResponse createManualJournalForHttpResponse(String accessToken, String xeroTenantId, ManualJournals manualJournals) throws IOException { + public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String accessToken, String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); - }// verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournal"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'fileName' is set + if (fileName == null) { + throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); + }// verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createManualJournal"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createManualJournalAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/ManualJournals"; + String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("ManualJournalID", manualJournalID); + uriVariables.put("FileName", fileName); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); + java.nio.file.Path bodyPath = body.toPath(); + String mimeType = Files.probeContentType(bodyPath); HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(manualJournals); + content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); @@ -2534,21 +2550,19 @@ public HttpResponse createManualJournalForHttpResponse(String accessToken, Stri } /** - * Allows you to create a specified Attachment on ManualJournal by file name - *

200 - Success - return response of type Attachments array with a newly created Attachment for a ManualJournals + * Allows you to create a manual journal + *

200 - Success - return response of type ManualJournals array with newly created ManualJournal *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName The name of the file being attached to a ManualJournal - * @param body Byte array of file in body of request + * @param manualJournals The manualJournals parameter * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API **/ - public Attachments createManualJournalAttachmentByFileName(String accessToken, String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { + public ManualJournals createManualJournals(String accessToken, String xeroTenantId, ManualJournals manualJournals) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse(accessToken, xeroTenantId, manualJournalID, fileName, body); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createManualJournalsForHttpResponse(accessToken, xeroTenantId, manualJournals); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -2559,47 +2573,33 @@ public Attachments createManualJournalAttachmentByFileName(String accessToken, return null; } - public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(String accessToken, String xeroTenantId, UUID manualJournalID, String fileName, File body) throws IOException { + public HttpResponse createManualJournalsForHttpResponse(String accessToken, String xeroTenantId, ManualJournals manualJournals) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException("Missing the required parameter 'manualJournalID' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createManualJournalAttachmentByFileName"); - }// verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException("Missing the required parameter 'body' when calling createManualJournalAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournals"); + }// verify the required parameter 'manualJournals' is set + if (manualJournals == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournals' when calling createManualJournals"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createManualJournalAttachmentByFileName"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createManualJournals"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"; - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - + String correctPath = "/ManualJournals"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = Files.probeContentType(bodyPath); HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(manualJournals); - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); @@ -2619,10 +2619,10 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin * @return Allocations * @throws IOException if an error occurs while attempting to invoke the API **/ - public Allocations createOverpaymentAllocation(String accessToken, String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { + public Allocations createOverpaymentAllocations(String accessToken, String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createOverpaymentAllocationForHttpResponse(accessToken, xeroTenantId, overpaymentID, allocations); + HttpResponse response = createOverpaymentAllocationsForHttpResponse(accessToken, xeroTenantId, overpaymentID, allocations); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -2633,19 +2633,19 @@ public Allocations createOverpaymentAllocation(String accessToken, String xeroT return null; } - public HttpResponse createOverpaymentAllocationForHttpResponse(String accessToken, String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { + public HttpResponse createOverpaymentAllocationsForHttpResponse(String accessToken, String xeroTenantId, UUID overpaymentID, Allocations allocations) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocations"); }// verify the required parameter 'overpaymentID' is set if (overpaymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocations"); }// verify the required parameter 'allocations' is set if (allocations == null) { - throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocation"); + throw new IllegalArgumentException("Missing the required parameter 'allocations' when calling createOverpaymentAllocations"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createOverpaymentAllocation"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createOverpaymentAllocations"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -2745,19 +2745,20 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String accessToken, } /** - * Allows you to create payments for invoices and credit notes - *

200 - Success - return response of type Payments array for newly created Payment - *

400 - A failed request due to validation error + * Allows you to create a history record for a payment + *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments + *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Payments * @param xeroTenantId Xero identifier for Tenant - * @param payments The payments parameter + * @param paymentID Unique identifier for a Payment + * @param historyRecords The historyRecords parameter * @param accessToken Authorization token for user set in header of each request - * @return Payments + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payments createPayment(String accessToken, String xeroTenantId, Payments payments) throws IOException { + public HistoryRecords createPaymentHistory(String accessToken, String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createPaymentForHttpResponse(accessToken, xeroTenantId, payments); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createPaymentHistoryForHttpResponse(accessToken, xeroTenantId, paymentID, historyRecords); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -2768,32 +2769,40 @@ public Payments createPayment(String accessToken, String xeroTenantId, Payments return null; } - public HttpResponse createPaymentForHttpResponse(String accessToken, String xeroTenantId, Payments payments) throws IOException { + public HttpResponse createPaymentHistoryForHttpResponse(String accessToken, String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); - }// verify the required parameter 'payments' is set - if (payments == null) { - throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayment"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); + }// verify the required parameter 'paymentID' is set + if (paymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); + }// verify the required parameter 'historyRecords' is set + if (historyRecords == null) { + throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPayment"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPaymentHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/Payments"; + String correctPath = "/Payments/{PaymentID}/History"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PaymentID", paymentID); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); + String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payments); + content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -2804,20 +2813,19 @@ public HttpResponse createPaymentForHttpResponse(String accessToken, String xer } /** - * Allows you to create a history record for a payment - *

200 - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Payments - *

400 - A failed request due to validation error - API is not able to create HistoryRecord for Payments + * Allows you to create payment services + *

200 - Success - return response of type PaymentServices array for newly created PaymentService + *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param paymentID Unique identifier for a Payment - * @param historyRecords The historyRecords parameter + * @param paymentServices The paymentServices parameter * @param accessToken Authorization token for user set in header of each request - * @return HistoryRecords + * @return PaymentServices * @throws IOException if an error occurs while attempting to invoke the API **/ - public HistoryRecords createPaymentHistory(String accessToken, String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { + public PaymentServices createPaymentService(String accessToken, String xeroTenantId, PaymentServices paymentServices) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createPaymentHistoryForHttpResponse(accessToken, xeroTenantId, paymentID, historyRecords); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createPaymentServiceForHttpResponse(accessToken, xeroTenantId, paymentServices); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -2828,40 +2836,32 @@ public HistoryRecords createPaymentHistory(String accessToken, String xeroTenan return null; } - public HttpResponse createPaymentHistoryForHttpResponse(String accessToken, String xeroTenantId, UUID paymentID, HistoryRecords historyRecords) throws IOException { + public HttpResponse createPaymentServiceForHttpResponse(String accessToken, String xeroTenantId, PaymentServices paymentServices) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentHistory"); - }// verify the required parameter 'paymentID' is set - if (paymentID == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling createPaymentHistory"); - }// verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException("Missing the required parameter 'historyRecords' when calling createPaymentHistory"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); + }// verify the required parameter 'paymentServices' is set + if (paymentServices == null) { + throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPaymentHistory"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPaymentService"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/Payments/{PaymentID}/History"; - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PaymentID", paymentID); - + String correctPath = "/PaymentServices"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); + content = apiClient.new JacksonJsonHttpContent(paymentServices); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -2872,19 +2872,19 @@ public HttpResponse createPaymentHistoryForHttpResponse(String accessToken, Str } /** - * Allows you to create payment services - *

200 - Success - return response of type PaymentServices array for newly created PaymentService + * Allows you to create payments for invoices and credit notes + *

200 - Success - return response of type Payments array for newly created Payment *

400 - A failed request due to validation error * @param xeroTenantId Xero identifier for Tenant - * @param paymentServices The paymentServices parameter + * @param payments The payments parameter * @param accessToken Authorization token for user set in header of each request - * @return PaymentServices + * @return Payments * @throws IOException if an error occurs while attempting to invoke the API **/ - public PaymentServices createPaymentService(String accessToken, String xeroTenantId, PaymentServices paymentServices) throws IOException { + public Payments createPayments(String accessToken, String xeroTenantId, Payments payments) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createPaymentServiceForHttpResponse(accessToken, xeroTenantId, paymentServices); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createPaymentsForHttpResponse(accessToken, xeroTenantId, payments); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -2895,23 +2895,23 @@ public PaymentServices createPaymentService(String accessToken, String xeroTena return null; } - public HttpResponse createPaymentServiceForHttpResponse(String accessToken, String xeroTenantId, PaymentServices paymentServices) throws IOException { + public HttpResponse createPaymentsForHttpResponse(String accessToken, String xeroTenantId, Payments payments) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPaymentService"); - }// verify the required parameter 'paymentServices' is set - if (paymentServices == null) { - throw new IllegalArgumentException("Missing the required parameter 'paymentServices' when calling createPaymentService"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayments"); + }// verify the required parameter 'payments' is set + if (payments == null) { + throw new IllegalArgumentException("Missing the required parameter 'payments' when calling createPayments"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPaymentService"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPayments"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/PaymentServices"; + String correctPath = "/Payments"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -2920,7 +2920,7 @@ public HttpResponse createPaymentServiceForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(paymentServices); + content = apiClient.new JacksonJsonHttpContent(payments); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -3619,10 +3619,10 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String accessTo * @return TaxRates * @throws IOException if an error occurs while attempting to invoke the API **/ - public TaxRates createTaxRate(String accessToken, String xeroTenantId, TaxRates taxRates) throws IOException { + public TaxRates createTaxRates(String accessToken, String xeroTenantId, TaxRates taxRates) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createTaxRateForHttpResponse(accessToken, xeroTenantId, taxRates); + HttpResponse response = createTaxRatesForHttpResponse(accessToken, xeroTenantId, taxRates); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -3633,16 +3633,16 @@ public TaxRates createTaxRate(String accessToken, String xeroTenantId, TaxRates return null; } - public HttpResponse createTaxRateForHttpResponse(String accessToken, String xeroTenantId, TaxRates taxRates) throws IOException { + public HttpResponse createTaxRatesForHttpResponse(String accessToken, String xeroTenantId, TaxRates taxRates) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRates"); }// verify the required parameter 'taxRates' is set if (taxRates == null) { - throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRate"); + throw new IllegalArgumentException("Missing the required parameter 'taxRates' when calling createTaxRates"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createTaxRate"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createTaxRates"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -13933,6 +13933,79 @@ public HttpResponse updateTrackingCategoryForHttpResponse(String accessToken, S return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } + /** + * Allows you to update options for a specified tracking category + *

200 - Success - return response of type TrackingOptions array of options for a specified category + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param trackingCategoryID Unique identifier for a TrackingCategory + * @param trackingOptionID Unique identifier for a Tracking Option + * @param trackingOption The trackingOption parameter + * @param accessToken Authorization token for user set in header of each request + * @return TrackingOptions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TrackingOptions updateTrackingOptions(String accessToken, String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, TrackingOption trackingOption) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = updateTrackingOptionsForHttpResponse(accessToken, xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse updateTrackingOptionsForHttpResponse(String accessToken, String xeroTenantId, UUID trackingCategoryID, UUID trackingOptionID, TrackingOption trackingOption) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTrackingOptions"); + }// verify the required parameter 'trackingCategoryID' is set + if (trackingCategoryID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingCategoryID' when calling updateTrackingOptions"); + }// verify the required parameter 'trackingOptionID' is set + if (trackingOptionID == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOptionID' when calling updateTrackingOptions"); + }// verify the required parameter 'trackingOption' is set + if (trackingOption == null) { + throw new IllegalArgumentException("Missing the required parameter 'trackingOption' when calling updateTrackingOptions"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updateTrackingOptions"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TrackingCategoryID", trackingCategoryID); + uriVariables.put("TrackingOptionID", trackingOptionID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(trackingOption); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + public ByteArrayInputStream convertInputToByteArray(InputStream is) throws IOException { byte[] bytes = IOUtils.toByteArray(is); diff --git a/src/main/java/com/xero/models/accounting/BankTransaction.java b/src/main/java/com/xero/models/accounting/BankTransaction.java index 0e0e6ba1..726df0d9 100644 --- a/src/main/java/com/xero/models/accounting/BankTransaction.java +++ b/src/main/java/com/xero/models/accounting/BankTransaction.java @@ -132,7 +132,9 @@ public static TypeEnum fromValue(String value) { public enum StatusEnum { AUTHORISED("AUTHORISED"), - DELETED("DELETED"); + DELETED("DELETED"), + + VOIDED("VOIDED"); private String value; diff --git a/src/main/java/com/xero/models/accounting/TaxRate.java b/src/main/java/com/xero/models/accounting/TaxRate.java index fbb38608..75968feb 100644 --- a/src/main/java/com/xero/models/accounting/TaxRate.java +++ b/src/main/java/com/xero/models/accounting/TaxRate.java @@ -118,7 +118,9 @@ public enum ReportTaxTypeEnum { NONE("NONE"), - GSTONIMPORTS("GSTONIMPORTS"); + GSTONIMPORTS("GSTONIMPORTS"), + + AVALARA("AVALARA"); private String value; From c80cd045f6fb0ba5c0c24c5f65cd492d1d671a01 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Sat, 5 Oct 2019 15:14:58 +1000 Subject: [PATCH 62/76] update unit test --- pom.xml | 2 +- src/main/java/com/xero/api/client/AccountingApi.java | 2 +- .../api/client/AccountingApiLinkedTransactionsTest.java | 6 +++--- .../xero/api/client/AccountingApiManualJournalsTest.java | 6 +++--- .../com/xero/api/client/AccountingApiOverpaymentsTest.java | 6 +++--- .../java/com/xero/api/client/AccountingApiPaymentsTest.java | 6 +++--- .../java/com/xero/api/client/AccountingApiTaxRatesTest.java | 6 +++--- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pom.xml b/pom.xml index c331a3bb..df75ac72 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.xeroapi xero-java jar - 3.0.1 + 3.0.2 Xero-Java SDK This is the official Java SDK for Xero API https://github.com/XeroAPI/Xero-Java diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index e0fcd95e..c73e69a1 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -94,7 +94,7 @@ public class AccountingApi { private ApiClient apiClient; private static AccountingApi instance = null; private String userAgent = "Default"; - private String version = "3.0.0-beta-9"; + private String version = "3.0.2"; public AccountingApi() { this(new ApiClient()); diff --git a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java index bbe8b487..2caab161 100644 --- a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java @@ -81,10 +81,10 @@ public void tearDown() { } @Test - public void createLinkedTransactionTest() throws IOException { - System.out.println("@Test - createLinkedTransaction"); + public void createLinkedTransactionsTest() throws IOException { + System.out.println("@Test - createLinkedTransactions"); LinkedTransactions linkedTransactions = new LinkedTransactions(); - LinkedTransactions response = accountingApi.createLinkedTransaction(accessToken,xeroTenantId,linkedTransactions); + LinkedTransactions response = accountingApi.createLinkedTransactions(accessToken,xeroTenantId,linkedTransactions); assertThat(response.getLinkedTransactions().get(0).getSourceTransactionID(), is(equalTo(UUID.fromString("a848644a-f20f-4630-98c3-386bd7505631")))); assertThat(response.getLinkedTransactions().get(0).getSourceLineItemID(), is(equalTo(UUID.fromString("b0df260d-3cc8-4ced-9bd6-41924f624ed3")))); diff --git a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java index b837c920..7cec0993 100644 --- a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java @@ -85,10 +85,10 @@ public void tearDown() { } @Test - public void createManualJournalTest() throws IOException { - System.out.println("@Test - createManualJournal"); + public void createManualJournalsTest() throws IOException { + System.out.println("@Test - createManualJournals"); ManualJournals manualJournals = new ManualJournals(); - ManualJournals response = accountingApi.createManualJournal(accessToken,xeroTenantId,manualJournals); + ManualJournals response = accountingApi.createManualJournals(accessToken,xeroTenantId,manualJournals); assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Foo bar"))); assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount(), is(equalTo(100.0))); diff --git a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java index 12879fad..b3494128 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java @@ -85,11 +85,11 @@ public void tearDown() { } @Test - public void createOverpaymentAllocationTest() throws IOException { - System.out.println("@Test - createOverpaymentAllocation"); + public void createOverpaymentAllocationsTest() throws IOException { + System.out.println("@Test - createOverpaymentAllocations"); UUID overpaymentID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); Allocations allocations = new Allocations(); - Allocations response = accountingApi.createOverpaymentAllocation(accessToken,xeroTenantId,overpaymentID, allocations); + Allocations response = accountingApi.createOverpaymentAllocations(accessToken,xeroTenantId,overpaymentID, allocations); // TODO: test validations assertThat(response.getAllocations().get(0).getInvoice().getInvoiceID(), is(equalTo(UUID.fromString("c45720a1-ade3-4a38-a064-d15489be6841")))); diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java index cf74b74a..5df0939c 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java @@ -81,10 +81,10 @@ public void tearDown() { } @Test - public void createPaymentTest() throws IOException { - System.out.println("@Test - createPayment"); + public void createPaymentsTest() throws IOException { + System.out.println("@Test - createPayments"); Payments payments = new Payments(); - Payments response = accountingApi.createPayment(accessToken,xeroTenantId,payments); + Payments response = accountingApi.createPayments(accessToken,xeroTenantId,payments); assertThat(response.getPayments().get(0).getInvoice().getInvoiceNumber(), is(equalTo("INV-0004"))); assertThat(response.getPayments().get(0).getAccount().getCode(), is(equalTo("970"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java index bcc680a6..64f0573b 100644 --- a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java @@ -80,10 +80,10 @@ public void tearDown() { } @Test - public void createTaxRateTest() throws IOException { - System.out.println("@Test - createTaxRate"); + public void createTaxRatesTest() throws IOException { + System.out.println("@Test - createTaxRates"); TaxRates taxRates = new TaxRates(); - TaxRates response = accountingApi.createTaxRate(accessToken,xeroTenantId,taxRates); + TaxRates response = accountingApi.createTaxRates(accessToken,xeroTenantId,taxRates); assertThat(response.getTaxRates().get(0).getName(), is(equalTo("SDKTax29067"))); assertThat(response.getTaxRates().get(0).getTaxType(), is(equalTo("TAX002"))); From a95b09613ea59510101eacbd6a030ee20fa94add Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Sat, 5 Oct 2019 17:00:54 +1000 Subject: [PATCH 63/76] new singluar and plural methods --- .../com/xero/api/client/AccountingApi.java | 319 +++++++++++++++++- 1 file changed, 314 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index c73e69a1..8742d7ca 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -4,6 +4,7 @@ import com.xero.models.accounting.Account; import com.xero.models.accounting.Accounts; +import com.xero.models.accounting.Allocation; import com.xero.models.accounting.Allocations; import com.xero.models.accounting.Attachments; import com.xero.models.accounting.BankTransaction; @@ -32,13 +33,16 @@ import com.xero.models.accounting.Item; import com.xero.models.accounting.Items; import com.xero.models.accounting.Journals; +import com.xero.models.accounting.LinkedTransaction; import com.xero.models.accounting.LinkedTransactions; import org.threeten.bp.LocalDate; +import com.xero.models.accounting.ManualJournal; import com.xero.models.accounting.ManualJournals; import org.threeten.bp.OffsetDateTime; import com.xero.models.accounting.OnlineInvoices; import com.xero.models.accounting.Organisations; import com.xero.models.accounting.Overpayments; +import com.xero.models.accounting.Payment; import com.xero.models.accounting.PaymentService; import com.xero.models.accounting.PaymentServices; import com.xero.models.accounting.Payments; @@ -50,6 +54,7 @@ import com.xero.models.accounting.ReportWithRows; import com.xero.models.accounting.Reports; import com.xero.models.accounting.RequestEmpty; +import com.xero.models.accounting.TaxRate; import com.xero.models.accounting.TaxRates; import com.xero.models.accounting.TrackingCategories; import com.xero.models.accounting.TrackingCategory; @@ -2408,6 +2413,65 @@ public HttpResponse createItemsForHttpResponse(String accessToken, String xeroT content = apiClient.new JacksonJsonHttpContent(items); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to create linked transactions (billable expenses) + *

200 - Success - return response of type LinkedTransactions array with newly created LinkedTransaction + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param linkedTransaction The linkedTransaction parameter + * @param accessToken Authorization token for user set in header of each request + * @return LinkedTransactions + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LinkedTransactions createLinkedTransaction(String accessToken, String xeroTenantId, LinkedTransaction linkedTransaction) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createLinkedTransactionForHttpResponse(accessToken, xeroTenantId, linkedTransaction); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createLinkedTransactionForHttpResponse(String accessToken, String xeroTenantId, LinkedTransaction linkedTransaction) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLinkedTransaction"); + }// verify the required parameter 'linkedTransaction' is set + if (linkedTransaction == null) { + throw new IllegalArgumentException("Missing the required parameter 'linkedTransaction' when calling createLinkedTransaction"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createLinkedTransaction"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/LinkedTransactions"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(linkedTransaction); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2455,7 +2519,7 @@ public HttpResponse createLinkedTransactionsForHttpResponse(String accessToken, headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/LinkedTransactions"; + String correctPath = "/LinkedTransactions#bulk"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -2467,6 +2531,65 @@ public HttpResponse createLinkedTransactionsForHttpResponse(String accessToken, content = apiClient.new JacksonJsonHttpContent(linkedTransactions); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to create a manual journal + *

200 - Success - return response of type ManualJournals array with newly created ManualJournal + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param manualJournal The manualJournal parameter + * @param accessToken Authorization token for user set in header of each request + * @return ManualJournals + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public ManualJournals createManualJournal(String accessToken, String xeroTenantId, ManualJournal manualJournal) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createManualJournalForHttpResponse(accessToken, xeroTenantId, manualJournal); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createManualJournalForHttpResponse(String accessToken, String xeroTenantId, ManualJournal manualJournal) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createManualJournal"); + }// verify the required parameter 'manualJournal' is set + if (manualJournal == null) { + throw new IllegalArgumentException("Missing the required parameter 'manualJournal' when calling createManualJournal"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createManualJournal"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/ManualJournals"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(manualJournal); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2589,7 +2712,7 @@ public HttpResponse createManualJournalsForHttpResponse(String accessToken, Str headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/ManualJournals"; + String correctPath = "/ManualJournals#bulk"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -2601,6 +2724,74 @@ public HttpResponse createManualJournalsForHttpResponse(String accessToken, Str content = apiClient.new JacksonJsonHttpContent(manualJournals); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to retrieve Allocations for overpayments + *

200 - Success - return response of type Allocations array with all Allocation for Overpayments + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param overpaymentID Unique identifier for a Overpayment + * @param allocation The allocation parameter + * @param accessToken Authorization token for user set in header of each request + * @return Allocations + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Allocations createOverpaymentAllocation(String accessToken, String xeroTenantId, UUID overpaymentID, Allocation allocation) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createOverpaymentAllocationForHttpResponse(accessToken, xeroTenantId, overpaymentID, allocation); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createOverpaymentAllocationForHttpResponse(String accessToken, String xeroTenantId, UUID overpaymentID, Allocation allocation) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createOverpaymentAllocation"); + }// verify the required parameter 'overpaymentID' is set + if (overpaymentID == null) { + throw new IllegalArgumentException("Missing the required parameter 'overpaymentID' when calling createOverpaymentAllocation"); + }// verify the required parameter 'allocation' is set + if (allocation == null) { + throw new IllegalArgumentException("Missing the required parameter 'allocation' when calling createOverpaymentAllocation"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createOverpaymentAllocation"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Overpayments/{OverpaymentID}/Allocations"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("OverpaymentID", overpaymentID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(allocation); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2652,7 +2843,7 @@ public HttpResponse createOverpaymentAllocationsForHttpResponse(String accessTok headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/Overpayments/{OverpaymentID}/Allocations"; + String correctPath = "/Overpayments/{OverpaymentID}/Allocations#bulk"; // create a map of path variables final Map uriVariables = new HashMap(); @@ -2737,6 +2928,65 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String accessToken, content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to create payments for invoices and credit notes + *

200 - Success - return response of type Payments array for newly created Payment + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param payment The payment parameter + * @param accessToken Authorization token for user set in header of each request + * @return Payments + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payments createPayment(String accessToken, String xeroTenantId, Payment payment) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createPaymentForHttpResponse(accessToken, xeroTenantId, payment); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createPaymentForHttpResponse(String accessToken, String xeroTenantId, Payment payment) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayment"); + }// verify the required parameter 'payment' is set + if (payment == null) { + throw new IllegalArgumentException("Missing the required parameter 'payment' when calling createPayment"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPayment"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Payments"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(payment); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2911,7 +3161,7 @@ public HttpResponse createPaymentsForHttpResponse(String accessToken, String xe headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/Payments"; + String correctPath = "/Payments#bulk"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -3602,6 +3852,65 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String accessTo content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to create Tax Rates + *

200 - Success - return response of type TaxRates array newly created TaxRate + *

400 - A failed request due to validation error + * @param xeroTenantId Xero identifier for Tenant + * @param taxRate The taxRate parameter + * @param accessToken Authorization token for user set in header of each request + * @return TaxRates + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public TaxRates createTaxRate(String accessToken, String xeroTenantId, TaxRate taxRate) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createTaxRateForHttpResponse(accessToken, xeroTenantId, taxRate); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createTaxRateForHttpResponse(String accessToken, String xeroTenantId, TaxRate taxRate) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createTaxRate"); + }// verify the required parameter 'taxRate' is set + if (taxRate == null) { + throw new IllegalArgumentException("Missing the required parameter 'taxRate' when calling createTaxRate"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createTaxRate"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/TaxRates"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(taxRate); + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3649,7 +3958,7 @@ public HttpResponse createTaxRatesForHttpResponse(String accessToken, String xe headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/TaxRates"; + String correctPath = "/TaxRates#bulk"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); From 6cb2ce6bf8df20b29675cea898704f768ffe5568 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Mon, 7 Oct 2019 14:53:43 -0700 Subject: [PATCH 64/76] Update pom.xml --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index df75ac72..c9b55364 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.xeroapi xero-java jar - 3.0.2 + 3.0.3 Xero-Java SDK This is the official Java SDK for Xero API https://github.com/XeroAPI/Xero-Java @@ -304,7 +304,7 @@ 1.0.0 9.7.0 2.1.0 - 2.9.9 + 2.9.10 1.0.1 From 0ee23a4d4aa933857837caf54b87aa0bdc0baeeb Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Mon, 7 Oct 2019 14:54:32 -0700 Subject: [PATCH 65/76] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c9b55364..2d68a7da 100644 --- a/pom.xml +++ b/pom.xml @@ -294,7 +294,7 @@ 1.5.17 1.23.0 2.25.1 - 2.9.9 + 2.9.10 2.6.4 4.12 4.5.3 From deded34b80fdc941f12e129f63231d4954188990 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Mon, 7 Oct 2019 14:55:36 -0700 Subject: [PATCH 66/76] Update pom.xml --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2d68a7da..57dd9982 100644 --- a/pom.xml +++ b/pom.xml @@ -299,7 +299,6 @@ 4.12 4.5.3 2.27 - 2.9.9.2 2.6.4 1.0.0 9.7.0 From 973c1333ab491020723a25b0ae20d3298067934a Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Mon, 7 Oct 2019 14:58:02 -0700 Subject: [PATCH 67/76] fix security issue with jackson and bump version --- pom.xml | 3 +-- src/main/java/com/xero/api/client/AccountingApi.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 57dd9982..57b97a77 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.xeroapi xero-java jar - 3.0.3 + 3.0.4 Xero-Java SDK This is the official Java SDK for Xero API https://github.com/XeroAPI/Xero-Java @@ -303,7 +303,6 @@ 1.0.0 9.7.0 2.1.0 - 2.9.10 1.0.1 diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index 8742d7ca..0e95d6d5 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -99,7 +99,7 @@ public class AccountingApi { private ApiClient apiClient; private static AccountingApi instance = null; private String userAgent = "Default"; - private String version = "3.0.2"; + private String version = "3.0.4"; public AccountingApi() { this(new ApiClient()); From 1a1edfade2a9bdc350c52c09f96f4265fcbcc048 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Fri, 11 Oct 2019 15:52:35 -0700 Subject: [PATCH 68/76] Updating BankFeeds API support --- .../com/xero/api/client/BankFeedsApi.java | 262 ++++++++++-------- .../bankfeeds/CreditDebitIndicator.java | 3 +- .../com/xero/models/bankfeeds/EndBalance.java | 11 +- .../java/com/xero/models/bankfeeds/Error.java | 18 +- .../xero/models/bankfeeds/FeedConnection.java | 49 ++-- .../com/xero/models/bankfeeds/Pagination.java | 16 +- .../xero/models/bankfeeds/StartBalance.java | 15 +- .../com/xero/models/bankfeeds/Statement.java | 57 ++-- .../xero/models/bankfeeds/StatementLine.java | 39 +-- .../xero/models/bankfeeds/StatementLines.java | 103 +++++++ 10 files changed, 358 insertions(+), 215 deletions(-) create mode 100644 src/main/java/com/xero/models/bankfeeds/StatementLines.java diff --git a/src/main/java/com/xero/api/client/BankFeedsApi.java b/src/main/java/com/xero/api/client/BankFeedsApi.java index 6c3a1596..cb9fb7e9 100644 --- a/src/main/java/com/xero/api/client/BankFeedsApi.java +++ b/src/main/java/com/xero/api/client/BankFeedsApi.java @@ -8,20 +8,27 @@ import com.xero.models.bankfeeds.Statement; import com.xero.models.bankfeeds.Statements; +import com.xero.api.XeroApiException; +import com.xero.api.XeroApiExceptionHandler; + import com.fasterxml.jackson.core.type.TypeReference; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpContent; import com.google.api.client.http.HttpMethods; +import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpResponse; +import com.google.api.client.http.HttpResponseException; +import com.google.api.client.http.HttpTransport; import com.google.api.client.http.FileContent; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; import javax.ws.rs.core.UriBuilder; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.nio.file.Files; -import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.util.Collection; @@ -36,14 +43,21 @@ public class BankFeedsApi { private ApiClient apiClient; - private String xeroTenantId; + private static BankFeedsApi instance = null; private String userAgent = "Default"; - private String version = "3.0.0-beta-7"; + private String version = "3.0.4"; public BankFeedsApi() { this(new ApiClient()); } + public static BankFeedsApi getInstance(ApiClient apiClient) { + if (instance == null) { + instance = new BankFeedsApi(apiClient); + } + return instance; + } + public BankFeedsApi(ApiClient apiClient) { this.apiClient = apiClient; } @@ -56,14 +70,6 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } - public String getXeroTenantId() { - return xeroTenantId; - } - - public void setXeroTenantId(String xeroTenantId) { - this.xeroTenantId = xeroTenantId; - } - public void setUserAgent(String userAgent) { this.userAgent = userAgent; } @@ -72,40 +78,18 @@ public String getUserAgent() { return this.userAgent + "[Xero-Java-" + this.version + "]"; } - private static String convertStreamToString(InputStream is) { - - BufferedReader reader = new BufferedReader(new InputStreamReader(is)); - StringBuilder sb = new StringBuilder(); - - String line = null; - try { - while ((line = reader.readLine()) != null) { - sb.append(line + "\n"); - } - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - is.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - return sb.toString(); - } - - /** * create one or more new feed connection - * By passing in the appropriate body, you can create one or more new feed connections in the system - *

201 - feed connection created + * By passing in the FeedConnections array object in the body, you can create one or more new feed connections + *

201 - success new feed connection(s)response *

400 - invalid input, object invalid - * @param feedConnections Feed Connection(s) to add + * @param xeroTenantId Xero identifier for Tenant + * @param feedConnections Feed Connection(s) array object in the body * @return FeedConnections * @throws IOException if an error occurs while attempting to invoke the API **/ - public FeedConnections createFeedConnections(FeedConnections feedConnections) throws IOException { - HttpResponse response = createFeedConnectionsForHttpResponse(feedConnections); + public FeedConnections createFeedConnections(String accessToken, String xeroTenantId, FeedConnections feedConnections) throws IOException { + HttpResponse response = createFeedConnectionsForHttpResponse(accessToken,xeroTenantId, feedConnections); //InputStream instream = response.getContent(); //String result = convertStreamToString(instream); //System.out.println("RESPONSE: " + result); @@ -114,13 +98,19 @@ public FeedConnections createFeedConnections(FeedConnections feedConnections) t return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createFeedConnectionsForHttpResponse( FeedConnections feedConnections) throws IOException { - // verify the required parameter 'feedConnections' is set + public HttpResponse createFeedConnectionsForHttpResponse(String accessToken, String xeroTenantId, FeedConnections feedConnections) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createFeedConnections"); + }// verify the required parameter 'feedConnections' is set if (feedConnections == null) { throw new IllegalArgumentException("Missing the required parameter 'feedConnections' when calling createFeedConnections"); } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createFeedConnections"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -137,26 +127,28 @@ public HttpResponse createFeedConnectionsForHttpResponse( FeedConnections feedCo content = apiClient.new JacksonJsonHttpContent(feedConnections); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - - /** - *

202 - Success + *

202 - Success returns Statements array of objects in response *

400 - Statement failed validation *

403 - Invalid application or feed connection *

409 - Duplicate statement received *

413 - Statement exceeds size limit *

422 - Unprocessable Entity *

500 - Intermittent Xero Error - * @param statements Feed Connection(s) to add + * @param xeroTenantId Xero identifier for Tenant + * @param statements Statements array of objects in the body * @return Statements * @throws IOException if an error occurs while attempting to invoke the API **/ - public Statements createStatements(Statements statements) throws IOException { - HttpResponse response = createStatementsForHttpResponse(statements); + public Statements createStatements(String accessToken, String xeroTenantId, Statements statements) throws IOException { + HttpResponse response = createStatementsForHttpResponse(accessToken,xeroTenantId, statements); //InputStream instream = response.getContent(); //String result = convertStreamToString(instream); //System.out.println("RESPONSE: " + result); @@ -165,10 +157,16 @@ public Statements createStatements(Statements statements) throws IOException { return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse createStatementsForHttpResponse( Statements statements) throws IOException { - + public HttpResponse createStatementsForHttpResponse(String accessToken, String xeroTenantId, Statements statements) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createStatements"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createStatements"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -185,23 +183,25 @@ public HttpResponse createStatementsForHttpResponse( Statements statements) thro content = apiClient.new JacksonJsonHttpContent(statements); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - - /** - * delete an exsiting feed connection - * By passing in the appropriate body, you can create a new feed connections in the system - *

202 - create results matching body content + * Delete an exsiting feed connection + * By passing in FeedConnections array object in the body, you can delete a feed connection. + *

202 - Success response for deleted feed connection *

400 - bad input parameter - * @param feedConnections Feed Connections to delete + * @param xeroTenantId Xero identifier for Tenant + * @param feedConnections Feed Connections array object in the body * @return FeedConnections * @throws IOException if an error occurs while attempting to invoke the API **/ - public FeedConnections deleteFeedConnections(FeedConnections feedConnections) throws IOException { - HttpResponse response = deleteFeedConnectionsForHttpResponse(feedConnections); + public FeedConnections deleteFeedConnections(String accessToken, String xeroTenantId, FeedConnections feedConnections) throws IOException { + HttpResponse response = deleteFeedConnectionsForHttpResponse(accessToken,xeroTenantId, feedConnections); //InputStream instream = response.getContent(); //String result = convertStreamToString(instream); //System.out.println("RESPONSE: " + result); @@ -210,13 +210,19 @@ public FeedConnections deleteFeedConnections(FeedConnections feedConnections) t return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse deleteFeedConnectionsForHttpResponse( FeedConnections feedConnections) throws IOException { - // verify the required parameter 'feedConnections' is set + public HttpResponse deleteFeedConnectionsForHttpResponse(String accessToken, String xeroTenantId, FeedConnections feedConnections) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deleteFeedConnections"); + }// verify the required parameter 'feedConnections' is set if (feedConnections == null) { throw new IllegalArgumentException("Missing the required parameter 'feedConnections' when calling deleteFeedConnections"); } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling deleteFeedConnections"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -233,23 +239,25 @@ public HttpResponse deleteFeedConnectionsForHttpResponse( FeedConnections feedCo content = apiClient.new JacksonJsonHttpContent(feedConnections); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); } - - /** - * get single feed connection by id - * By passing in a FeedConnection Id options, you can search for available feed connections in the system - *

200 - search results matching criteria + * Retrive single feed connection based on unique id provided + * By passing in a FeedConnection Id options, you can search for matching feed connections + *

200 - success returns a FeedConnection object matching the id in response *

400 - bad input parameter + * @param xeroTenantId Xero identifier for Tenant * @param id feed connection id for single object * @return FeedConnection * @throws IOException if an error occurs while attempting to invoke the API **/ - public FeedConnection getFeedConnection(String id) throws IOException { - HttpResponse response = getFeedConnectionForHttpResponse(id); + public FeedConnection getFeedConnection(String accessToken, String xeroTenantId, String id) throws IOException { + HttpResponse response = getFeedConnectionForHttpResponse(accessToken,xeroTenantId, id); //InputStream instream = response.getContent(); //String result = convertStreamToString(instream); //System.out.println("RESPONSE: " + result); @@ -258,13 +266,19 @@ public FeedConnection getFeedConnection(String id) throws IOException { return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getFeedConnectionForHttpResponse( String id) throws IOException { - // verify the required parameter 'id' is set + public HttpResponse getFeedConnectionForHttpResponse(String accessToken, String xeroTenantId, String id) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getFeedConnection"); + }// verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException("Missing the required parameter 'id' when calling getFeedConnection"); } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getFeedConnection"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -284,24 +298,26 @@ public HttpResponse getFeedConnectionForHttpResponse( String id) throws IOExcept + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** * searches feed connections * By passing in the appropriate options, you can search for available feed connections in the system - *

201 - search results matching criteria - *

400 - bad input parameter + *

201 - search results matching criteria returned with pagination and items array + *

400 - validation error response + * @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 10. Example - https://api.xero.com/bankfeeds.xro/1.0/FeedConnections?page=1 to get the second set of the records. When page value is not a number or a negative number, by default, the first set of records is returned. * @param pageSize Page size which specifies how many records per page will be returned (default 10). Example - https://api.xero.com/bankfeeds.xro/1.0/FeedConnections?pageSize=100 to specify page size of 100. * @return FeedConnections * @throws IOException if an error occurs while attempting to invoke the API **/ - public FeedConnections getFeedConnections(Integer page, Integer pageSize) throws IOException { - HttpResponse response = getFeedConnectionsForHttpResponse(page, pageSize); + public FeedConnections getFeedConnections(String accessToken, String xeroTenantId, Integer page, Integer pageSize) throws IOException { + HttpResponse response = getFeedConnectionsForHttpResponse(accessToken,xeroTenantId, page, pageSize); //InputStream instream = response.getContent(); //String result = convertStreamToString(instream); //System.out.println("RESPONSE: " + result); @@ -310,10 +326,16 @@ public FeedConnections getFeedConnections(Integer page, Integer pageSize) throw return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getFeedConnectionsForHttpResponse( Integer page, Integer pageSize) throws IOException { - + public HttpResponse getFeedConnectionsForHttpResponse(String accessToken, String xeroTenantId, Integer page, Integer pageSize) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getFeedConnections"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getFeedConnections"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -349,21 +371,25 @@ public HttpResponse getFeedConnectionsForHttpResponse( Integer page, Integer pa + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** + * Retrive single statement based on unique id provided + * By passing in a statement id, you can search for matching statements *

200 - search results matching id for single statement *

404 - Statement not found - * @param statementId The statementId parameter + * @param xeroTenantId Xero identifier for Tenant + * @param statementId statement id for single object * @return Statement * @throws IOException if an error occurs while attempting to invoke the API **/ - public Statement getStatement(String statementId) throws IOException { - HttpResponse response = getStatementForHttpResponse(statementId); + public Statement getStatement(String accessToken, String xeroTenantId, String statementId) throws IOException { + HttpResponse response = getStatementForHttpResponse(accessToken,xeroTenantId, statementId); //InputStream instream = response.getContent(); //String result = convertStreamToString(instream); //System.out.println("RESPONSE: " + result); @@ -372,13 +398,19 @@ public Statement getStatement(String statementId) throws IOException { return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getStatementForHttpResponse( String statementId) throws IOException { - // verify the required parameter 'statementId' is set + public HttpResponse getStatementForHttpResponse(String accessToken, String xeroTenantId, String statementId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getStatement"); + }// verify the required parameter 'statementId' is set if (statementId == null) { throw new IllegalArgumentException("Missing the required parameter 'statementId' when calling getStatement"); } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getStatement"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -398,25 +430,28 @@ public HttpResponse getStatementForHttpResponse( String statementId) throws IOEx + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - /** - *

200 - search results matching criteria + * Retrive all statements based on unique search criteria + * By passing in parameters, you can search for matching statements + *

200 - success returns Statements array of objects response *

400 - bad input parameter - * @param page The page parameter - * @param pageSize The pageSize parameter + * @param xeroTenantId Xero identifier for Tenant + * @param page unique id for single object + * @param pageSize Page size which specifies how many records per page will be returned (default 10). Example - https://api.xero.com/bankfeeds.xro/1.0/Statements?pageSize=100 to specify page size of 100. * @param xeroApplicationId The xeroApplicationId parameter - * @param xeroTenantId The xeroTenantId parameter * @param xeroUserId The xeroUserId parameter * @return Statements * @throws IOException if an error occurs while attempting to invoke the API **/ - public Statements getStatements(Integer page, Integer pageSize, String xeroApplicationId, String xeroTenantId, String xeroUserId) throws IOException { - HttpResponse response = getStatementsForHttpResponse(page, pageSize, xeroApplicationId, xeroTenantId, xeroUserId); + public Statements getStatements(String accessToken, String xeroTenantId, Integer page, Integer pageSize, String xeroApplicationId, String xeroUserId) throws IOException { + HttpResponse response = getStatementsForHttpResponse(accessToken,xeroTenantId, page, pageSize, xeroApplicationId, xeroUserId); //InputStream instream = response.getContent(); //String result = convertStreamToString(instream); //System.out.println("RESPONSE: " + result); @@ -425,10 +460,16 @@ public Statements getStatements(Integer page, Integer pageSize, String xeroAppl return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } - public HttpResponse getStatementsForHttpResponse( Integer page, Integer pageSize, String xeroApplicationId, String xeroTenantId, String xeroUserId) throws IOException { - + public HttpResponse getStatementsForHttpResponse(String accessToken, String xeroTenantId, Integer page, Integer pageSize, String xeroApplicationId, String xeroUserId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getStatements"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getStatements"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); + headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); @@ -464,12 +505,13 @@ public HttpResponse getStatementsForHttpResponse( Integer page, Integer pageSiz + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - public ByteArrayInputStream convertInputToByteArray(InputStream is) throws IOException { byte[] bytes = IOUtils.toByteArray(is); diff --git a/src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java b/src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java index ab2c92c6..9ba67cbb 100644 --- a/src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java +++ b/src/main/java/com/xero/models/bankfeeds/CreditDebitIndicator.java @@ -15,12 +15,13 @@ import java.util.Objects; import java.util.Arrays; +import io.swagger.annotations.ApiModel; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; /** - * Gets or Sets CreditDebitIndicator + * If the statement balances are credit or debit, the CreditDebitIndicator should be specified from the perspective of the Customer. */ public enum CreditDebitIndicator { diff --git a/src/main/java/com/xero/models/bankfeeds/EndBalance.java b/src/main/java/com/xero/models/bankfeeds/EndBalance.java index f1ae5746..abc06af4 100644 --- a/src/main/java/com/xero/models/bankfeeds/EndBalance.java +++ b/src/main/java/com/xero/models/bankfeeds/EndBalance.java @@ -25,17 +25,18 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * EndBalance + * The StartBalance plus all the Statement Line Amounts should be equal to the EndBalance Amount. */ +@ApiModel(description = "The StartBalance plus all the Statement Line Amounts should be equal to the EndBalance Amount.") public class EndBalance { @JsonProperty("amount") - private String amount; + private Double amount; @JsonProperty("creditDebitIndicator") private CreditDebitIndicator creditDebitIndicator; - public EndBalance amount(String amount) { + public EndBalance amount(Double amount) { this.amount = amount; return this; } @@ -45,11 +46,11 @@ public EndBalance amount(String amount) { * @return amount **/ @ApiModelProperty(example = "10.1340", value = "") - public String getAmount() { + public Double getAmount() { return amount; } - public void setAmount(String amount) { + public void setAmount(Double amount) { this.amount = amount; } diff --git a/src/main/java/com/xero/models/bankfeeds/Error.java b/src/main/java/com/xero/models/bankfeeds/Error.java index f80bd313..7e805552 100644 --- a/src/main/java/com/xero/models/bankfeeds/Error.java +++ b/src/main/java/com/xero/models/bankfeeds/Error.java @@ -39,7 +39,7 @@ public class Error { private String detail; /** - * Gets or Sets type + * Identifies the type of error. */ public enum TypeEnum { INVALID_REQUEST("invalid-request"), @@ -94,10 +94,10 @@ public Error title(String title) { } /** - * Get title + * Human readable high level error description. * @return title **/ - @ApiModelProperty(example = "Invalid Application", value = "") + @ApiModelProperty(example = "Invalid Application", value = "Human readable high level error description.") public String getTitle() { return title; } @@ -112,10 +112,10 @@ public Error status(Integer status) { } /** - * Get status + * The numeric HTTP Status Code, e.g. 404 * @return status **/ - @ApiModelProperty(example = "403", value = "") + @ApiModelProperty(example = "403", value = "The numeric HTTP Status Code, e.g. 404") public Integer getStatus() { return status; } @@ -130,10 +130,10 @@ public Error detail(String detail) { } /** - * Get detail + * Human readable detailed error description. * @return detail **/ - @ApiModelProperty(example = "The application has not been configured to use these API endpoints.", value = "") + @ApiModelProperty(example = "The application has not been configured to use these API endpoints.", value = "Human readable detailed error description.") public String getDetail() { return detail; } @@ -148,10 +148,10 @@ public Error type(TypeEnum type) { } /** - * Get type + * Identifies the type of error. * @return type **/ - @ApiModelProperty(example = "invalid-application", value = "") + @ApiModelProperty(example = "invalid-application", value = "Identifies the type of error.") public TypeEnum getType() { return type; } diff --git a/src/main/java/com/xero/models/bankfeeds/FeedConnection.java b/src/main/java/com/xero/models/bankfeeds/FeedConnection.java index f2e172dd..4ef08265 100644 --- a/src/main/java/com/xero/models/bankfeeds/FeedConnection.java +++ b/src/main/java/com/xero/models/bankfeeds/FeedConnection.java @@ -21,6 +21,7 @@ import com.xero.models.bankfeeds.Error; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -42,10 +43,10 @@ public class FeedConnection { private String accountName; @JsonProperty("accountId") - private String accountId; + private UUID accountId; /** - * Gets or Sets accountType + * High level bank account type - BANK CREDITCARD BANK encompasses all bank account types other than credit cards. */ public enum AccountTypeEnum { BANK("BANK"), @@ -89,7 +90,7 @@ public static AccountTypeEnum fromValue(String value) { private String country; /** - * Gets or Sets status + * the current status of the feed connection */ public enum StatusEnum { PENDING("PENDING"), @@ -135,10 +136,10 @@ public FeedConnection id(String id) { } /** - * Get id + * GUID used to identify the Account. * @return id **/ - @ApiModelProperty(example = "0d3cf8d-95dc-4466-8dc0-47e6d1197e28", required = true, value = "") + @ApiModelProperty(example = "0d3cf8d-95dc-4466-8dc0-47e6d1197e28", required = true, value = "GUID used to identify the Account.") public String getId() { return id; } @@ -153,10 +154,10 @@ public FeedConnection accountToken(String accountToken) { } /** - * Get accountToken + * This account identifier is generated by the financial institute (FI). This must be unique for your financial institute. * @return accountToken **/ - @ApiModelProperty(example = "10000123", value = "") + @ApiModelProperty(example = "10000123", value = "This account identifier is generated by the financial institute (FI). This must be unique for your financial institute.") public String getAccountToken() { return accountToken; } @@ -171,10 +172,10 @@ public FeedConnection accountNumber(String accountNumber) { } /** - * Get accountNumber + * String(40) when AccountType is BANK String(4) when AccountType is CREDITCARD The Account Number is used to match the feed to a Xero Bank Account. The API will create a new Xero Bank Account if a match to an existing Xero Bank Account is not found. Only the last 4 digits must be supplied for Credit Card numbers. Must be included if AccountId is not specified. * @return accountNumber **/ - @ApiModelProperty(example = "3809087654321500", value = "") + @ApiModelProperty(example = "3809087654321500", value = "String(40) when AccountType is BANK String(4) when AccountType is CREDITCARD The Account Number is used to match the feed to a Xero Bank Account. The API will create a new Xero Bank Account if a match to an existing Xero Bank Account is not found. Only the last 4 digits must be supplied for Credit Card numbers. Must be included if AccountId is not specified.") public String getAccountNumber() { return accountNumber; } @@ -189,10 +190,10 @@ public FeedConnection accountName(String accountName) { } /** - * Get accountName + * The Account Name will be used for the creation of a new Xero Bank Account if a matching Xero Bank Account is not found. * @return accountName **/ - @ApiModelProperty(example = "Joe's Savings Account", value = "") + @ApiModelProperty(example = "Joe's Savings Account", value = "The Account Name will be used for the creation of a new Xero Bank Account if a matching Xero Bank Account is not found.") public String getAccountName() { return accountName; } @@ -201,21 +202,21 @@ public void setAccountName(String accountName) { this.accountName = accountName; } - public FeedConnection accountId(String accountId) { + public FeedConnection accountId(UUID accountId) { this.accountId = accountId; return this; } /** - * Get accountId + * Xero identifier for a bank account in Xero. Must be included if AccountNumber is not specified. * @return accountId **/ - @ApiModelProperty(example = "079a88ea-276d-41fb-a1f1-366ef3e22921", value = "") - public String getAccountId() { + @ApiModelProperty(example = "079a88ea-276d-41fb-a1f1-366ef3e22921", value = "Xero identifier for a bank account in Xero. Must be included if AccountNumber is not specified.") + public UUID getAccountId() { return accountId; } - public void setAccountId(String accountId) { + public void setAccountId(UUID accountId) { this.accountId = accountId; } @@ -225,10 +226,10 @@ public FeedConnection accountType(AccountTypeEnum accountType) { } /** - * Get accountType + * High level bank account type - BANK CREDITCARD BANK encompasses all bank account types other than credit cards. * @return accountType **/ - @ApiModelProperty(example = "BANK", value = "") + @ApiModelProperty(example = "BANK", value = "High level bank account type - BANK CREDITCARD BANK encompasses all bank account types other than credit cards.") public AccountTypeEnum getAccountType() { return accountType; } @@ -243,10 +244,10 @@ public FeedConnection currency(String currency) { } /** - * Get currency + * ISO-4217 currency code, e.g. USD, AUD. * @return currency **/ - @ApiModelProperty(example = "AUD", value = "") + @ApiModelProperty(example = "AUD", value = "ISO-4217 currency code, e.g. USD, AUD.") public String getCurrency() { return currency; } @@ -261,10 +262,10 @@ public FeedConnection country(String country) { } /** - * Get country + * ISO-3166 alpha-2 country code, e.g. US, AU This element is required only when the Application supports multi-region. Talk to your Partner Manager to confirm if this is the case. * @return country **/ - @ApiModelProperty(example = "GB", value = "") + @ApiModelProperty(example = "GB", value = "ISO-3166 alpha-2 country code, e.g. US, AU This element is required only when the Application supports multi-region. Talk to your Partner Manager to confirm if this is the case.") public String getCountry() { return country; } @@ -279,10 +280,10 @@ public FeedConnection status(StatusEnum status) { } /** - * Get status + * the current status of the feed connection * @return status **/ - @ApiModelProperty(example = "REJECTED", value = "") + @ApiModelProperty(example = "REJECTED", value = "the current status of the feed connection") public StatusEnum getStatus() { return status; } diff --git a/src/main/java/com/xero/models/bankfeeds/Pagination.java b/src/main/java/com/xero/models/bankfeeds/Pagination.java index b45ff526..7eb76598 100644 --- a/src/main/java/com/xero/models/bankfeeds/Pagination.java +++ b/src/main/java/com/xero/models/bankfeeds/Pagination.java @@ -46,10 +46,10 @@ public Pagination page(Integer page) { } /** - * Get page + * Page number which specifies the set of records to retrieve. Example - https://api.xero.com/bankfeeds.xro/1.0/Statements?page=2 to get the second set of the records. When page value is not a number or a negative number, by default, the first set of records is returned. * @return page **/ - @ApiModelProperty(example = "1", value = "") + @ApiModelProperty(example = "1", value = "Page number which specifies the set of records to retrieve. Example - https://api.xero.com/bankfeeds.xro/1.0/Statements?page=2 to get the second set of the records. When page value is not a number or a negative number, by default, the first set of records is returned.") public Integer getPage() { return page; } @@ -64,10 +64,10 @@ public Pagination pageSize(Integer pageSize) { } /** - * Get pageSize + * Page size which specifies how many records per page will be returned (default 50). Example - https://api.xero.com/bankfeeds.xro/1.0/Statements?pageSize=100 to specify page size of 100. * @return pageSize **/ - @ApiModelProperty(example = "10", value = "") + @ApiModelProperty(example = "10", value = "Page size which specifies how many records per page will be returned (default 50). Example - https://api.xero.com/bankfeeds.xro/1.0/Statements?pageSize=100 to specify page size of 100.") public Integer getPageSize() { return pageSize; } @@ -82,10 +82,10 @@ public Pagination pageCount(Integer pageCount) { } /** - * Get pageCount + * Number of pages available * @return pageCount **/ - @ApiModelProperty(example = "1", value = "") + @ApiModelProperty(example = "1", value = "Number of pages available") public Integer getPageCount() { return pageCount; } @@ -100,10 +100,10 @@ public Pagination itemCount(Integer itemCount) { } /** - * Get itemCount + * Number of items returned * @return itemCount **/ - @ApiModelProperty(example = "2", value = "") + @ApiModelProperty(example = "2", value = "Number of items returned") public Integer getItemCount() { return itemCount; } diff --git a/src/main/java/com/xero/models/bankfeeds/StartBalance.java b/src/main/java/com/xero/models/bankfeeds/StartBalance.java index f6b1c0a2..0d89f310 100644 --- a/src/main/java/com/xero/models/bankfeeds/StartBalance.java +++ b/src/main/java/com/xero/models/bankfeeds/StartBalance.java @@ -25,31 +25,32 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * StartBalance + * The starting balance of the statement */ +@ApiModel(description = "The starting balance of the statement") public class StartBalance { @JsonProperty("amount") - private String amount; + private Double amount; @JsonProperty("creditDebitIndicator") private CreditDebitIndicator creditDebitIndicator; - public StartBalance amount(String amount) { + public StartBalance amount(Double amount) { this.amount = amount; return this; } /** - * Get amount + * decimal(19,4) unsigned Opening/closing balance amount. * @return amount **/ - @ApiModelProperty(example = "9.0000", value = "") - public String getAmount() { + @ApiModelProperty(example = "9.0000", value = "decimal(19,4) unsigned Opening/closing balance amount.") + public Double getAmount() { return amount; } - public void setAmount(String amount) { + public void setAmount(Double amount) { this.amount = amount; } diff --git a/src/main/java/com/xero/models/bankfeeds/Statement.java b/src/main/java/com/xero/models/bankfeeds/Statement.java index 624d8e4b..28a9aa0b 100644 --- a/src/main/java/com/xero/models/bankfeeds/Statement.java +++ b/src/main/java/com/xero/models/bankfeeds/Statement.java @@ -21,11 +21,12 @@ import com.xero.models.bankfeeds.EndBalance; import com.xero.models.bankfeeds.Error; import com.xero.models.bankfeeds.StartBalance; -import com.xero.models.bankfeeds.StatementLine; +import com.xero.models.bankfeeds.StatementLines; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; +import java.util.UUID; import org.threeten.bp.LocalDate; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -36,13 +37,13 @@ public class Statement { @JsonProperty("id") - private String id; + private UUID id; @JsonProperty("feedConnectionId") - private String feedConnectionId; + private UUID feedConnectionId; /** - * Gets or Sets status + * Current status of statements */ public enum StatusEnum { PENDING("PENDING"), @@ -94,7 +95,7 @@ public static StatusEnum fromValue(String value) { private EndBalance endBalance = null; @JsonProperty("statementLines") - private List statementLines = new ArrayList(); + private StatementLines statementLines = null; @JsonProperty("errors") private List errors = new ArrayList(); @@ -102,39 +103,39 @@ public static StatusEnum fromValue(String value) { @JsonProperty("statementLineCount") private Integer statementLineCount; - public Statement id(String id) { + public Statement id(UUID id) { this.id = id; return this; } /** - * Get id + * GUID used to identify the Statement. * @return id **/ - @ApiModelProperty(example = "ba4f3127-5e46-427d-80ea-dea2fcd26afe", required = true, value = "") - public String getId() { + @ApiModelProperty(example = "ba4f3127-5e46-427d-80ea-dea2fcd26afe", required = true, value = "GUID used to identify the Statement.") + public UUID getId() { return id; } - public void setId(String id) { + public void setId(UUID id) { this.id = id; } - public Statement feedConnectionId(String feedConnectionId) { + public Statement feedConnectionId(UUID feedConnectionId) { this.feedConnectionId = feedConnectionId; return this; } /** - * Get feedConnectionId + * The Xero generated feed connection Id that identifies the Xero Bank Account Container into which the statement should be delivered. This is obtained by calling GET FeedConnections. * @return feedConnectionId **/ - @ApiModelProperty(example = "87cb0dc8-fa32-409c-b622-19f8de8dcc83", value = "") - public String getFeedConnectionId() { + @ApiModelProperty(example = "87cb0dc8-fa32-409c-b622-19f8de8dcc83", value = "The Xero generated feed connection Id that identifies the Xero Bank Account Container into which the statement should be delivered. This is obtained by calling GET FeedConnections.") + public UUID getFeedConnectionId() { return feedConnectionId; } - public void setFeedConnectionId(String feedConnectionId) { + public void setFeedConnectionId(UUID feedConnectionId) { this.feedConnectionId = feedConnectionId; } @@ -144,10 +145,10 @@ public Statement status(StatusEnum status) { } /** - * Get status + * Current status of statements * @return status **/ - @ApiModelProperty(example = "PENDING", value = "") + @ApiModelProperty(example = "PENDING", value = "Current status of statements") public StatusEnum getStatus() { return status; } @@ -162,10 +163,10 @@ public Statement startDate(LocalDate startDate) { } /** - * Get startDate + * Opening balance date (can be no older than one year from the current date) ISO-8601 YYYY-MM-DD * @return startDate **/ - @ApiModelProperty(value = "") + @ApiModelProperty(value = "Opening balance date (can be no older than one year from the current date) ISO-8601 YYYY-MM-DD") public LocalDate getStartDate() { return startDate; } @@ -180,10 +181,10 @@ public Statement endDate(LocalDate endDate) { } /** - * Get endDate + * Closing balance date ISO-8601 YYYY-MM-DD * @return endDate **/ - @ApiModelProperty(value = "") + @ApiModelProperty(value = "Closing balance date ISO-8601 YYYY-MM-DD") public LocalDate getEndDate() { return endDate; } @@ -228,29 +229,21 @@ public void setEndBalance(EndBalance endBalance) { this.endBalance = endBalance; } - public Statement statementLines(List statementLines) { + public Statement statementLines(StatementLines statementLines) { this.statementLines = statementLines; return this; } - public Statement addStatementLinesItem(StatementLine statementLinesItem) { - if (this.statementLines == null) { - this.statementLines = new ArrayList(); - } - this.statementLines.add(statementLinesItem); - return this; - } - /** * Get statementLines * @return statementLines **/ @ApiModelProperty(value = "") - public List getStatementLines() { + public StatementLines getStatementLines() { return statementLines; } - public void setStatementLines(List statementLines) { + public void setStatementLines(StatementLines statementLines) { this.statementLines = statementLines; } diff --git a/src/main/java/com/xero/models/bankfeeds/StatementLine.java b/src/main/java/com/xero/models/bankfeeds/StatementLine.java index 01c58100..516c29b9 100644 --- a/src/main/java/com/xero/models/bankfeeds/StatementLine.java +++ b/src/main/java/com/xero/models/bankfeeds/StatementLine.java @@ -26,8 +26,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * StatementLine + * the lines details for a statement */ +@ApiModel(description = "the lines details for a statement") public class StatementLine { @JsonProperty("postedDate") @@ -37,7 +38,7 @@ public class StatementLine { private String description; @JsonProperty("amount") - private String amount; + private Double amount; @JsonProperty("creditDebitIndicator") private CreditDebitIndicator creditDebitIndicator; @@ -60,10 +61,10 @@ public StatementLine postedDate(LocalDate postedDate) { } /** - * Get postedDate + * The date that the transaction was processed or cleared as seen in internet banking ISO-8601 YYYY-MM-DD * @return postedDate **/ - @ApiModelProperty(value = "") + @ApiModelProperty(value = "The date that the transaction was processed or cleared as seen in internet banking ISO-8601 YYYY-MM-DD") public LocalDate getPostedDate() { return postedDate; } @@ -78,10 +79,10 @@ public StatementLine description(String description) { } /** - * Get description + * Transaction description * @return description **/ - @ApiModelProperty(example = "Description for statement line 2", value = "") + @ApiModelProperty(example = "Description for statement line 2", value = "Transaction description") public String getDescription() { return description; } @@ -90,21 +91,21 @@ public void setDescription(String description) { this.description = description; } - public StatementLine amount(String amount) { + public StatementLine amount(Double amount) { this.amount = amount; return this; } /** - * Get amount + * Transaction amount * @return amount **/ - @ApiModelProperty(example = "5.00", value = "") - public String getAmount() { + @ApiModelProperty(example = "5.00", value = "Transaction amount") + public Double getAmount() { return amount; } - public void setAmount(String amount) { + public void setAmount(Double amount) { this.amount = amount; } @@ -132,10 +133,10 @@ public StatementLine transactionId(String transactionId) { } /** - * Get transactionId + * Financial institute's internal transaction identifier. If provided this field is factored into duplicate detection. * @return transactionId **/ - @ApiModelProperty(example = "transaction-id-2", value = "") + @ApiModelProperty(example = "transaction-id-2", value = "Financial institute's internal transaction identifier. If provided this field is factored into duplicate detection.") public String getTransactionId() { return transactionId; } @@ -150,10 +151,10 @@ public StatementLine payeeName(String payeeName) { } /** - * Get payeeName + * Typically the merchant or payee name * @return payeeName **/ - @ApiModelProperty(example = "Payee name for statement line 2", value = "") + @ApiModelProperty(example = "Payee name for statement line 2", value = "Typically the merchant or payee name") public String getPayeeName() { return payeeName; } @@ -168,10 +169,10 @@ public StatementLine reference(String reference) { } /** - * Get reference + * Optional field to enhance the Description * @return reference **/ - @ApiModelProperty(example = "Reference for statement line 2", value = "") + @ApiModelProperty(example = "Reference for statement line 2", value = "Optional field to enhance the Description") public String getReference() { return reference; } @@ -186,10 +187,10 @@ public StatementLine chequeNumber(String chequeNumber) { } /** - * Get chequeNumber + * The cheque/check number * @return chequeNumber **/ - @ApiModelProperty(example = "021", value = "") + @ApiModelProperty(example = "021", value = "The cheque/check number") public String getChequeNumber() { return chequeNumber; } diff --git a/src/main/java/com/xero/models/bankfeeds/StatementLines.java b/src/main/java/com/xero/models/bankfeeds/StatementLines.java new file mode 100644 index 00000000..c94d1666 --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/StatementLines.java @@ -0,0 +1,103 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.bankfeeds.StatementLine; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * StatementLines + */ + +public class StatementLines { + @JsonProperty("StatementLine") + private List statementLine = new ArrayList(); + + public StatementLines statementLine(List statementLine) { + this.statementLine = statementLine; + return this; + } + + public StatementLines addStatementLineItem(StatementLine statementLineItem) { + if (this.statementLine == null) { + this.statementLine = new ArrayList(); + } + this.statementLine.add(statementLineItem); + return this; + } + + /** + * Get statementLine + * @return statementLine + **/ + @ApiModelProperty(value = "") + public List getStatementLine() { + return statementLine; + } + + public void setStatementLine(List statementLine) { + this.statementLine = statementLine; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StatementLines statementLines = (StatementLines) o; + return Objects.equals(this.statementLine, statementLines.statementLine); + } + + @Override + public int hashCode() { + return Objects.hash(statementLine); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatementLines {\n"); + sb.append(" statementLine: ").append(toIndentedString(statementLine)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + From 1c2cd238ff9a39cecbb0e6a8f36e8313c1c50aee Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Wed, 16 Oct 2019 16:54:32 -0700 Subject: [PATCH 69/76] Update BankFeed methods and models --- .../com/xero/api/client/BankFeedsApi.java | 154 ++++++++---------- .../xero/models/bankfeeds/FeedConnection.java | 10 +- .../com/xero/models/bankfeeds/Statement.java | 18 +- .../xero/models/bankfeeds/StatementLines.java | 103 ------------ 4 files changed, 87 insertions(+), 198 deletions(-) delete mode 100644 src/main/java/com/xero/models/bankfeeds/StatementLines.java diff --git a/src/main/java/com/xero/api/client/BankFeedsApi.java b/src/main/java/com/xero/api/client/BankFeedsApi.java index cb9fb7e9..294ad42b 100644 --- a/src/main/java/com/xero/api/client/BankFeedsApi.java +++ b/src/main/java/com/xero/api/client/BankFeedsApi.java @@ -7,6 +7,7 @@ import com.xero.models.bankfeeds.FeedConnections; import com.xero.models.bankfeeds.Statement; import com.xero.models.bankfeeds.Statements; +import java.util.UUID; import com.xero.api.XeroApiException; import com.xero.api.XeroApiExceptionHandler; @@ -89,13 +90,15 @@ public String getUserAgent() { * @throws IOException if an error occurs while attempting to invoke the API **/ public FeedConnections createFeedConnections(String accessToken, String xeroTenantId, FeedConnections feedConnections) throws IOException { - HttpResponse response = createFeedConnectionsForHttpResponse(accessToken,xeroTenantId, feedConnections); - //InputStream instream = response.getContent(); - //String result = convertStreamToString(instream); - //System.out.println("RESPONSE: " + result); - //instream.close(); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + TypeReference typeRef = new TypeReference() {}; + try { + HttpResponse response = createFeedConnectionsForHttpResponse(accessToken,xeroTenantId, feedConnections); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + return apiClient.getObjectMapper().readValue(e.getContent(), typeRef); + } catch (IOException ioe) { + throw ioe; + } } public HttpResponse createFeedConnectionsForHttpResponse(String accessToken, String xeroTenantId, FeedConnections feedConnections) throws IOException { @@ -118,15 +121,10 @@ public HttpResponse createFeedConnectionsForHttpResponse(String accessToken, St UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - - - //HttpContent content = new FileContent(mimeType, body); HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(feedConnections); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -148,13 +146,15 @@ public HttpResponse createFeedConnectionsForHttpResponse(String accessToken, St * @throws IOException if an error occurs while attempting to invoke the API **/ public Statements createStatements(String accessToken, String xeroTenantId, Statements statements) throws IOException { - HttpResponse response = createStatementsForHttpResponse(accessToken,xeroTenantId, statements); - //InputStream instream = response.getContent(); - //String result = convertStreamToString(instream); - //System.out.println("RESPONSE: " + result); - //instream.close(); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + TypeReference typeRef = new TypeReference() {}; + try { + HttpResponse response = createStatementsForHttpResponse(accessToken,xeroTenantId, statements); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + return apiClient.getObjectMapper().readValue(e.getContent(), typeRef); + } catch (IOException ioe) { + throw ioe; + } } public HttpResponse createStatementsForHttpResponse(String accessToken, String xeroTenantId, Statements statements) throws IOException { @@ -174,15 +174,10 @@ public HttpResponse createStatementsForHttpResponse(String accessToken, String UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - - - //HttpContent content = new FileContent(mimeType, body); HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(statements); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -201,13 +196,15 @@ public HttpResponse createStatementsForHttpResponse(String accessToken, String * @throws IOException if an error occurs while attempting to invoke the API **/ public FeedConnections deleteFeedConnections(String accessToken, String xeroTenantId, FeedConnections feedConnections) throws IOException { - HttpResponse response = deleteFeedConnectionsForHttpResponse(accessToken,xeroTenantId, feedConnections); - //InputStream instream = response.getContent(); - //String result = convertStreamToString(instream); - //System.out.println("RESPONSE: " + result); - //instream.close(); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + TypeReference typeRef = new TypeReference() {}; + try { + HttpResponse response = deleteFeedConnectionsForHttpResponse(accessToken,xeroTenantId, feedConnections); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + return apiClient.getObjectMapper().readValue(e.getContent(), typeRef); + } catch (IOException ioe) { + throw ioe; + } } public HttpResponse deleteFeedConnectionsForHttpResponse(String accessToken, String xeroTenantId, FeedConnections feedConnections) throws IOException { @@ -230,15 +227,10 @@ public HttpResponse deleteFeedConnectionsForHttpResponse(String accessToken, St UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - - - //HttpContent content = new FileContent(mimeType, body); HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(feedConnections); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -252,21 +244,23 @@ public HttpResponse deleteFeedConnectionsForHttpResponse(String accessToken, St *

200 - success returns a FeedConnection object matching the id in response *

400 - bad input parameter * @param xeroTenantId Xero identifier for Tenant - * @param id feed connection id for single object + * @param id Unique identifier for retrieving single object * @return FeedConnection * @throws IOException if an error occurs while attempting to invoke the API **/ - public FeedConnection getFeedConnection(String accessToken, String xeroTenantId, String id) throws IOException { - HttpResponse response = getFeedConnectionForHttpResponse(accessToken,xeroTenantId, id); - //InputStream instream = response.getContent(); - //String result = convertStreamToString(instream); - //System.out.println("RESPONSE: " + result); - //instream.close(); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public FeedConnection getFeedConnection(String accessToken, String xeroTenantId, UUID id) throws IOException { + TypeReference typeRef = new TypeReference() {}; + try { + HttpResponse response = getFeedConnectionForHttpResponse(accessToken,xeroTenantId, id); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + return apiClient.getObjectMapper().readValue(e.getContent(), typeRef); + } catch (IOException ioe) { + throw ioe; + } } - public HttpResponse getFeedConnectionForHttpResponse(String accessToken, String xeroTenantId, String id) throws IOException { + public HttpResponse getFeedConnectionForHttpResponse(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 getFeedConnection"); @@ -291,13 +285,9 @@ public HttpResponse getFeedConnectionForHttpResponse(String accessToken, String UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - - - //HttpContent content = new FileContent(mimeType, body); HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -317,13 +307,15 @@ public HttpResponse getFeedConnectionForHttpResponse(String accessToken, String * @throws IOException if an error occurs while attempting to invoke the API **/ public FeedConnections getFeedConnections(String accessToken, String xeroTenantId, Integer page, Integer pageSize) throws IOException { - HttpResponse response = getFeedConnectionsForHttpResponse(accessToken,xeroTenantId, page, pageSize); - //InputStream instream = response.getContent(); - //String result = convertStreamToString(instream); - //System.out.println("RESPONSE: " + result); - //instream.close(); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + TypeReference typeRef = new TypeReference() {}; + try { + HttpResponse response = getFeedConnectionsForHttpResponse(accessToken,xeroTenantId, page, pageSize); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + return apiClient.getObjectMapper().readValue(e.getContent(), typeRef); + } catch (IOException ioe) { + throw ioe; + } } public HttpResponse getFeedConnectionsForHttpResponse(String accessToken, String xeroTenantId, Integer page, Integer pageSize) throws IOException { @@ -364,13 +356,9 @@ public HttpResponse getFeedConnectionsForHttpResponse(String accessToken, Strin } String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - - - //HttpContent content = new FileContent(mimeType, body); HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -388,17 +376,19 @@ public HttpResponse getFeedConnectionsForHttpResponse(String accessToken, Strin * @return Statement * @throws IOException if an error occurs while attempting to invoke the API **/ - public Statement getStatement(String accessToken, String xeroTenantId, String statementId) throws IOException { - HttpResponse response = getStatementForHttpResponse(accessToken,xeroTenantId, statementId); - //InputStream instream = response.getContent(); - //String result = convertStreamToString(instream); - //System.out.println("RESPONSE: " + result); - //instream.close(); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public Statement getStatement(String accessToken, String xeroTenantId, UUID statementId) throws IOException { + TypeReference typeRef = new TypeReference() {}; + try { + HttpResponse response = getStatementForHttpResponse(accessToken,xeroTenantId, statementId); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + return apiClient.getObjectMapper().readValue(e.getContent(), typeRef); + } catch (IOException ioe) { + throw ioe; + } } - public HttpResponse getStatementForHttpResponse(String accessToken, String xeroTenantId, String statementId) throws IOException { + public HttpResponse getStatementForHttpResponse(String accessToken, String xeroTenantId, UUID statementId) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getStatement"); @@ -423,13 +413,9 @@ public HttpResponse getStatementForHttpResponse(String accessToken, String xero UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); - - - //HttpContent content = new FileContent(mimeType, body); HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -451,13 +437,15 @@ public HttpResponse getStatementForHttpResponse(String accessToken, String xero * @throws IOException if an error occurs while attempting to invoke the API **/ public Statements getStatements(String accessToken, String xeroTenantId, Integer page, Integer pageSize, String xeroApplicationId, String xeroUserId) throws IOException { - HttpResponse response = getStatementsForHttpResponse(accessToken,xeroTenantId, page, pageSize, xeroApplicationId, xeroUserId); - //InputStream instream = response.getContent(); - //String result = convertStreamToString(instream); - //System.out.println("RESPONSE: " + result); - //instream.close(); - TypeReference typeRef = new TypeReference() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + TypeReference typeRef = new TypeReference() {}; + try { + HttpResponse response = getStatementsForHttpResponse(accessToken,xeroTenantId, page, pageSize, xeroApplicationId, xeroUserId); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + return apiClient.getObjectMapper().readValue(e.getContent(), typeRef); + } catch (IOException ioe) { + throw ioe; + } } public HttpResponse getStatementsForHttpResponse(String accessToken, String xeroTenantId, Integer page, Integer pageSize, String xeroApplicationId, String xeroUserId) throws IOException { @@ -498,13 +486,9 @@ public HttpResponse getStatementsForHttpResponse(String accessToken, String xer } String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - - - //HttpContent content = new FileContent(mimeType, body); HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); diff --git a/src/main/java/com/xero/models/bankfeeds/FeedConnection.java b/src/main/java/com/xero/models/bankfeeds/FeedConnection.java index 4ef08265..9ddd3a7f 100644 --- a/src/main/java/com/xero/models/bankfeeds/FeedConnection.java +++ b/src/main/java/com/xero/models/bankfeeds/FeedConnection.java @@ -31,7 +31,7 @@ public class FeedConnection { @JsonProperty("id") - private String id; + private UUID id; @JsonProperty("accountToken") private String accountToken; @@ -130,7 +130,7 @@ public static StatusEnum fromValue(String value) { @JsonProperty("error") private Error error = null; - public FeedConnection id(String id) { + public FeedConnection id(UUID id) { this.id = id; return this; } @@ -139,12 +139,12 @@ public FeedConnection id(String id) { * GUID used to identify the Account. * @return id **/ - @ApiModelProperty(example = "0d3cf8d-95dc-4466-8dc0-47e6d1197e28", required = true, value = "GUID used to identify the Account.") - public String getId() { + @ApiModelProperty(example = "00d3cf8d-95dc-4466-8dc0-47e6d1197e28", required = true, value = "GUID used to identify the Account.") + public UUID getId() { return id; } - public void setId(String id) { + public void setId(UUID id) { this.id = id; } diff --git a/src/main/java/com/xero/models/bankfeeds/Statement.java b/src/main/java/com/xero/models/bankfeeds/Statement.java index 28a9aa0b..f679841e 100644 --- a/src/main/java/com/xero/models/bankfeeds/Statement.java +++ b/src/main/java/com/xero/models/bankfeeds/Statement.java @@ -21,7 +21,7 @@ import com.xero.models.bankfeeds.EndBalance; import com.xero.models.bankfeeds.Error; import com.xero.models.bankfeeds.StartBalance; -import com.xero.models.bankfeeds.StatementLines; +import com.xero.models.bankfeeds.StatementLine; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; @@ -95,7 +95,7 @@ public static StatusEnum fromValue(String value) { private EndBalance endBalance = null; @JsonProperty("statementLines") - private StatementLines statementLines = null; + private List statementLines = new ArrayList(); @JsonProperty("errors") private List errors = new ArrayList(); @@ -229,21 +229,29 @@ public void setEndBalance(EndBalance endBalance) { this.endBalance = endBalance; } - public Statement statementLines(StatementLines statementLines) { + public Statement statementLines(List statementLines) { this.statementLines = statementLines; return this; } + public Statement addStatementLinesItem(StatementLine statementLinesItem) { + if (this.statementLines == null) { + this.statementLines = new ArrayList(); + } + this.statementLines.add(statementLinesItem); + return this; + } + /** * Get statementLines * @return statementLines **/ @ApiModelProperty(value = "") - public StatementLines getStatementLines() { + public List getStatementLines() { return statementLines; } - public void setStatementLines(StatementLines statementLines) { + public void setStatementLines(List statementLines) { this.statementLines = statementLines; } diff --git a/src/main/java/com/xero/models/bankfeeds/StatementLines.java b/src/main/java/com/xero/models/bankfeeds/StatementLines.java deleted file mode 100644 index c94d1666..00000000 --- a/src/main/java/com/xero/models/bankfeeds/StatementLines.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Bank Feeds API - * The Xero Bank Feeds API - * - * The version of the OpenAPI document: 1.0.0 - * Contact: api@xero.com - * - * 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.models.bankfeeds; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.bankfeeds.StatementLine; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * StatementLines - */ - -public class StatementLines { - @JsonProperty("StatementLine") - private List statementLine = new ArrayList(); - - public StatementLines statementLine(List statementLine) { - this.statementLine = statementLine; - return this; - } - - public StatementLines addStatementLineItem(StatementLine statementLineItem) { - if (this.statementLine == null) { - this.statementLine = new ArrayList(); - } - this.statementLine.add(statementLineItem); - return this; - } - - /** - * Get statementLine - * @return statementLine - **/ - @ApiModelProperty(value = "") - public List getStatementLine() { - return statementLine; - } - - public void setStatementLine(List statementLine) { - this.statementLine = statementLine; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - StatementLines statementLines = (StatementLines) o; - return Objects.equals(this.statementLine, statementLines.statementLine); - } - - @Override - public int hashCode() { - return Objects.hash(statementLine); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class StatementLines {\n"); - sb.append(" statementLine: ").append(toIndentedString(statementLine)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - From 3d1f1033f9ea38525454de557e6b13ced39c7f02 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Sun, 20 Oct 2019 10:18:49 -0700 Subject: [PATCH 70/76] Add Bankfeed API unit tests --- pom.xml | 2 +- .../com/xero/api/client/AccountingApi.java | 2 +- .../com/xero/api/client/BankFeedsApi.java | 2 +- .../api/client/AccountingApiAccountsTest.java | 2 +- .../client/BankfeedApiFeedConnectionTest.java | 143 ++++++++++++++++++ .../api/client/BankfeedApiStatementTest.java | 124 +++++++++++++++ 6 files changed, 271 insertions(+), 4 deletions(-) create mode 100644 src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java create mode 100644 src/test/java/com/xero/api/client/BankfeedApiStatementTest.java diff --git a/pom.xml b/pom.xml index 57b97a77..8eb6fccc 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.xeroapi xero-java jar - 3.0.4 + 3.0.5 Xero-Java SDK This is the official Java SDK for Xero API https://github.com/XeroAPI/Xero-Java diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index 0e95d6d5..b184eb04 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -99,7 +99,7 @@ public class AccountingApi { private ApiClient apiClient; private static AccountingApi instance = null; private String userAgent = "Default"; - private String version = "3.0.4"; + private String version = "3.0.5"; public AccountingApi() { this(new ApiClient()); diff --git a/src/main/java/com/xero/api/client/BankFeedsApi.java b/src/main/java/com/xero/api/client/BankFeedsApi.java index 294ad42b..b2e685e1 100644 --- a/src/main/java/com/xero/api/client/BankFeedsApi.java +++ b/src/main/java/com/xero/api/client/BankFeedsApi.java @@ -46,7 +46,7 @@ public class BankFeedsApi { private ApiClient apiClient; private static BankFeedsApi instance = null; private String userAgent = "Default"; - private String version = "3.0.4"; + private String version = "3.0.5"; public BankFeedsApi() { this(new ApiClient()); diff --git a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java index 1000b133..f861c796 100644 --- a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java @@ -117,7 +117,7 @@ public void testCreateAccount() throws Exception { System.out.println("@Test - createAccount"); Account acct = new Account(); Accounts newAccount = accountingApi.createAccount(accessToken,xeroTenantId,acct); - assertThat(newAccount.getAccounts().get(0).getName(), is(equalTo("Foobar"))); + assertThat(newAccount.getAccounts().get(0).getName(), is(equalTo("Foobar"))); } @Test diff --git a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java new file mode 100644 index 00000000..fe6247c1 --- /dev/null +++ b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java @@ -0,0 +1,143 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.bankfeeds.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +public class BankfeedApiFeedConnectionTest { + + ApiClient defaultClient; + BankFeedsApi bankfeedsApi; + String accessToken; + String xeroTenantId; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + + // Set Access Token and Tenant Id + accessToken = "123"; + xeroTenantId = "xyz"; + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); + bankfeedsApi = BankFeedsApi.getInstance(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } +/* + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60000); + } catch(InterruptedException e) { + System.out.println(e); + } +*/ + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + bankfeedsApi = null; + defaultClient = null; + } + + @Test + public void testCreateFeedConnections() throws Exception { + System.out.println("@Test - createFeedConnections"); + + FeedConnections feedConnections = new FeedConnections(); + FeedConnections response = bankfeedsApi.createFeedConnections(accessToken,xeroTenantId,feedConnections); + assertThat(response.getItems().get(0).getId().toString(), (equalTo("2a19d46c-2a92-4e50-9401-dcf2cb895be7"))); + assertThat(response.getItems().get(0).getAccountToken(), (equalTo("foobar71760"))); + assertThat(response.getItems().get(0).getStatus(), is(equalTo(com.xero.models.bankfeeds.FeedConnection.StatusEnum.PENDING))); + } + + @Test + public void testGetFeedConnections() throws Exception { + System.out.println("@Test - getFeedConnections"); + FeedConnections response = bankfeedsApi.getFeedConnections(accessToken,xeroTenantId,null, null); + + assertThat(response.getPagination().getItemCount().toString(), (equalTo("39"))); + assertThat(response.getPagination().getPageCount().toString(), (equalTo("1"))); + assertThat(response.getPagination().getPage().toString(), (equalTo("1"))); + assertThat(response.getPagination().getPageSize().toString(), (equalTo("87654321"))); + assertThat(response.getItems().get(0).getId().toString(), (equalTo("c0eb97b5-4f97-465a-8268-276513c14396"))); + assertThat(response.getItems().get(0).getAccountToken(), (equalTo("foobar31306"))); + assertThat(response.getItems().get(0).getAccountNumber(), (equalTo("123496842"))); + assertThat(response.getItems().get(0).getAccountName(), (equalTo("SDK Bank 95921"))); + assertThat(response.getItems().get(0).getAccountId().toString(), (equalTo("aefbf6be-4285-4ca5-bf39-0f486c8515c7"))); + assertThat(response.getItems().get(0).getAccountType(), is(equalTo(com.xero.models.bankfeeds.FeedConnection.AccountTypeEnum.BANK))); + assertThat(response.getItems().get(0).getCurrency(), (equalTo("GBP"))); + assertThat(response.getItems().get(0).getCountry(), (equalTo("GB"))); + } + + @Test + public void testGetFeedConnection() throws Exception { + System.out.println("@Test - getFeedConnection"); + UUID feedConnectionId = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); + FeedConnection response = bankfeedsApi.getFeedConnection(accessToken,xeroTenantId,feedConnectionId); + + assertThat(response.getId().toString(), (equalTo("b58b685a-1bee-4904-91f1-fee30bb6ea52"))); + assertThat(response.getAccountToken(), (equalTo("foobar84778"))); + assertThat(response.getAccountNumber(), (equalTo("123434859"))); + assertThat(response.getAccountName(), (equalTo("SDK Bank 5517"))); + assertThat(response.getAccountId().toString(), (equalTo("f4c4d595-da94-493b-999a-19d1ae1f508a"))); + assertThat(response.getAccountType(), is(equalTo(com.xero.models.bankfeeds.FeedConnection.AccountTypeEnum.BANK))); + assertThat(response.getCurrency(), (equalTo("GBP"))); + assertThat(response.getCountry(), (equalTo("GB"))); + } + + @Test + public void testDeleteFeedConnection() throws Exception { + System.out.println("@Test - deleteFeedConnection"); + + FeedConnections deleteFeedConnections = new FeedConnections(); + FeedConnections response = bankfeedsApi.deleteFeedConnections(accessToken,xeroTenantId,deleteFeedConnections); + assertThat(response.getItems().get(0).getId().toString(), (equalTo("b4cc693b-24d9-42ec-a6d4-2943d253ff63"))); + assertThat(response.getItems().get(0).getStatus(), is(equalTo(com.xero.models.bankfeeds.FeedConnection.StatusEnum.PENDING))); + assertThat(response.getItems().get(1).getAccountToken(), (equalTo("10000125"))); + assertThat(response.getItems().get(1).getStatus(), is(equalTo(com.xero.models.bankfeeds.FeedConnection.StatusEnum.REJECTED))); + assertThat(response.getItems().get(1).getError().getDetail(), (equalTo("The AccountToken is connected to another Xero Bank Account associated with this bank. This Xero Bank Account belongs to a different Xero Organisation."))); + assertThat(response.getItems().get(1).getError().getTitle(), (equalTo("Feed connected in different organisation"))); + } +} diff --git a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java new file mode 100644 index 00000000..e01d25f9 --- /dev/null +++ b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java @@ -0,0 +1,124 @@ +package com.xero.api.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.*; + +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.core.Every.everyItem; + +import com.xero.api.ApiClient; +import com.xero.api.client.*; +import com.xero.models.bankfeeds.*; + +import java.io.File; +import java.net.URL; + +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; + +import org.threeten.bp.*; +import java.io.IOException; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.IOUtils; + +public class BankfeedApiStatementTest { + + ApiClient defaultClient; + BankFeedsApi bankfeedsApi; + String accessToken; + String xeroTenantId; + + private static boolean setUpIsDone = false; + + @Before + public void setUp() { + + // Set Access Token and Tenant Id + accessToken = "123"; + xeroTenantId = "xyz"; + + // Init AccountingApi client + defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); + bankfeedsApi = BankFeedsApi.getInstance(defaultClient); + + // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs + if (setUpIsDone) { + return; + } +/* + try { + System.out.println("Sleep for 60 seconds"); + Thread.sleep(60000); + } catch(InterruptedException e) { + System.out.println(e); + } +*/ + // do the setup + setUpIsDone = true; + } + + public void tearDown() { + bankfeedsApi = null; + defaultClient = null; + } + + @Test + public void testCreateStatements() throws Exception { + System.out.println("@Test - createStatements"); + + Statements newStatements = new Statements(); + Statements response = bankfeedsApi.createStatements(accessToken,xeroTenantId,newStatements); + assertThat(response.getItems().get(0).getId().toString(), (equalTo("d69b02b7-a30c-464a-99cf-ba9770373c61"))); + assertThat(response.getItems().get(0).getFeedConnectionId().toString(), (equalTo("6a4b9ff5-3a5f-4321-936b-4796163550f6"))); + assertThat(response.getItems().get(0).getStatus(), is(equalTo(com.xero.models.bankfeeds.Statement.StatusEnum.PENDING))); + } + + @Test + public void testGetStatement() throws Exception { + System.out.println("@Test - getStatement"); + + Statements newStatements = new Statements(); + Statements response = bankfeedsApi.createStatements(accessToken,xeroTenantId,newStatements); + assertThat(response.getItems().get(0).getId().toString(), (equalTo("d69b02b7-a30c-464a-99cf-ba9770373c61"))); + assertThat(response.getItems().get(0).getFeedConnectionId().toString(), (equalTo("6a4b9ff5-3a5f-4321-936b-4796163550f6"))); + assertThat(response.getItems().get(0).getStatus(), is(equalTo(com.xero.models.bankfeeds.Statement.StatusEnum.PENDING))); + } + + @Test + public void testGetStatements() throws Exception { + System.out.println("@Test - getStatements"); + Statements response = bankfeedsApi.getStatements(accessToken,xeroTenantId,1, 3, null, null); + assertThat(response.getItems().get(0).getId().toString(), (equalTo("9817e4b8-82b3-4526-91f7-040bd278053f"))); + assertThat(response.getItems().get(0).getFeedConnectionId().toString(), (equalTo("6a4b9ff5-3a5f-4321-936b-4796163550f6"))); + assertThat(response.getItems().get(0).getStatus(), is(equalTo(com.xero.models.bankfeeds.Statement.StatusEnum.REJECTED))); + assertThat(response.getItems().get(0).getStartDate(), is(equalTo(LocalDate.of(2019, 8, 01)))); + assertThat(response.getItems().get(0).getEndDate(), is(equalTo(LocalDate.of(2019, 8, 15)))); + assertThat(response.getItems().get(0).getStartBalance().getAmount().toString(), is(equalTo("100.0"))); + assertThat(response.getItems().get(0).getStartBalance().getCreditDebitIndicator(), is(equalTo(com.xero.models.bankfeeds.CreditDebitIndicator.CREDIT))); + assertThat(response.getItems().get(0).getEndBalance().getAmount().toString(), is(equalTo("150.0"))); + assertThat(response.getItems().get(0).getEndBalance().getCreditDebitIndicator(), is(equalTo(com.xero.models.bankfeeds.CreditDebitIndicator.CREDIT))); + assertThat(response.getItems().get(0).getErrors().get(0).getTitle(), is(equalTo("Duplicate Statement Received"))); + assertThat(response.getItems().get(0).getErrors().get(0).getStatus().toString(), is(equalTo("409"))); + assertThat(response.getItems().get(0).getErrors().get(0).getDetail(), is(equalTo("The received statement was marked as a duplicate."))); + assertThat(response.getItems().get(0).getErrors().get(0).getType(), is(equalTo(com.xero.models.bankfeeds.Error.TypeEnum.DUPLICATE_STATEMENT))); + } +} From 0bfd001ad0e5f1cf8f3b84722371ed20332092db Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Mon, 21 Oct 2019 13:14:46 -0700 Subject: [PATCH 71/76] Add missing ENUMS from Expense Claims and TaxRate model --- .../com/xero/api/client/AccountingApi.java | 1 - .../xero/models/accounting/ExpenseClaim.java | 4 +- .../com/xero/models/accounting/Invoice.java | 8 ++- .../com/xero/models/accounting/TaxRate.java | 56 ++++++++++++++----- 4 files changed, 51 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index b184eb04..cdc9b163 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -105,7 +105,6 @@ public AccountingApi() { this(new ApiClient()); } - /* Static 'instance' method */ public static AccountingApi getInstance(ApiClient apiClient) { if (instance == null) { instance = new AccountingApi(apiClient); diff --git a/src/main/java/com/xero/models/accounting/ExpenseClaim.java b/src/main/java/com/xero/models/accounting/ExpenseClaim.java index 5daec35c..9446aacf 100644 --- a/src/main/java/com/xero/models/accounting/ExpenseClaim.java +++ b/src/main/java/com/xero/models/accounting/ExpenseClaim.java @@ -50,7 +50,9 @@ public enum StatusEnum { PAID("PAID"), - VOIDED("VOIDED"); + VOIDED("VOIDED"), + + DELETED("DELETED"); private String value; diff --git a/src/main/java/com/xero/models/accounting/Invoice.java b/src/main/java/com/xero/models/accounting/Invoice.java index 72daad04..035798a2 100644 --- a/src/main/java/com/xero/models/accounting/Invoice.java +++ b/src/main/java/com/xero/models/accounting/Invoice.java @@ -47,13 +47,15 @@ public class Invoice { * See Invoice Types */ public enum TypeEnum { - ACCREC("ACCREC"), - ACCPAY("ACCPAY"), ACCPAYCREDIT("ACCPAYCREDIT"), - AROVERPAYMENT("AROVERPAYMENT"); + AROVERPAYMENT("AROVERPAYMENT"), + + ACCREC("ACCREC"), + + ACCRECCREDIT("ACCRECCREDIT"); private String value; diff --git a/src/main/java/com/xero/models/accounting/TaxRate.java b/src/main/java/com/xero/models/accounting/TaxRate.java index 75968feb..49472b6b 100644 --- a/src/main/java/com/xero/models/accounting/TaxRate.java +++ b/src/main/java/com/xero/models/accounting/TaxRate.java @@ -88,19 +88,13 @@ public static StatusEnum fromValue(String value) { * See ReportTaxTypes */ public enum ReportTaxTypeEnum { - OUTPUT("OUTPUT"), - - INPUT("INPUT"), - - EXEMPTOUTPUT("EXEMPTOUTPUT"), - - INPUTTAXED("INPUTTAXED"), + AVALARA("AVALARA"), BASEXCLUDED("BASEXCLUDED"), - EXEMPTEXPENSES("EXEMPTEXPENSES"), + CAPITALSALESOUTPUT("CAPITALSALESOUTPUT"), - EXEMPTINPUT("EXEMPTINPUT"), + CAPITALEXPENSESINPUT("CAPITALEXPENSESINPUT"), ECOUTPUT("ECOUTPUT"), @@ -110,17 +104,53 @@ public enum ReportTaxTypeEnum { ECACQUISITIONS("ECACQUISITIONS"), - CAPITALSALESOUTPUT("CAPITALSALESOUTPUT"), + EXEMPTEXPENSES("EXEMPTEXPENSES"), - CAPITALEXPENSESINPUT("CAPITALEXPENSESINPUT"), + EXEMPTINPUT("EXEMPTINPUT"), + + EXEMPTOUTPUT("EXEMPTOUTPUT"), + + GSTONIMPORTS("GSTONIMPORTS"), + + INPUT("INPUT"), + + INPUTTAXED("INPUTTAXED"), MOSSSALES("MOSSSALES"), NONE("NONE"), - GSTONIMPORTS("GSTONIMPORTS"), + NONEOUTPUT("NONEOUTPUT"), + + OUTPUT("OUTPUT"), + + PURCHASESINPUT("PURCHASESINPUT"), + + SALESOUTPUT("SALESOUTPUT"), + + EXEMPTCAPITAL("EXEMPTCAPITAL"), + + EXEMPTEXPORT("EXEMPTEXPORT"), + + CAPITALEXINPUT("CAPITALEXINPUT"), + + GSTONCAPIMPORTS("GSTONCAPIMPORTS"), + + REVERSECHARGES("REVERSECHARGES"), + + PAYMENTS("PAYMENTS"), + + INVOICE("INVOICE"), + + CASH("CASH"), + + ACCRUAL("ACCRUAL"), + + FLATRATECASH("FLATRATECASH"), + + FLATRATEACCRUAL("FLATRATEACCRUAL"), - AVALARA("AVALARA"); + ACCRUALS("ACCRUALS"); private String value; From cac8eaddd9d6515dd4910d7d849d64e058eb1190 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Tue, 22 Oct 2019 15:52:32 -0700 Subject: [PATCH 72/76] add CurrencyCode and CountryCode to bankfeeds --- pom.xml | 49 +- .../com/xero/api/client/AccountingApi.java | 2 +- .../com/xero/api/client/BankFeedsApi.java | 5 +- .../xero/models/bankfeeds/CountryCode.java | 534 ++++++++++++++++++ .../xero/models/bankfeeds/CurrencyCode.java | 378 +++++++++++++ .../xero/models/bankfeeds/FeedConnection.java | 26 +- .../client/BankfeedApiFeedConnectionTest.java | 54 +- .../api/client/BankfeedApiStatementTest.java | 4 +- 8 files changed, 968 insertions(+), 84 deletions(-) create mode 100644 src/main/java/com/xero/models/bankfeeds/CountryCode.java create mode 100644 src/main/java/com/xero/models/bankfeeds/CurrencyCode.java diff --git a/pom.xml b/pom.xml index 8eb6fccc..c1648c50 100644 --- a/pom.xml +++ b/pom.xml @@ -1,14 +1,14 @@ - 4.0.0 - com.github.xeroapi - xero-java - jar - 3.0.5 - Xero-Java SDK - This is the official Java SDK for Xero API - https://github.com/XeroAPI/Xero-Java - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + com.github.xeroapi + xero-java + jar + xero-java + 3.1.0 + https://github.com/XeroAPI/Xero-Java + This is the official Java SDK for Xero API + MIT License http://www.opensource.org/licenses/mit-license.php @@ -24,20 +24,20 @@ https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - Sidney Maestre - api@xero.com - Xero - https://developer.xero.com - - - - scm:git:git://github.com/XeroAPI/Xero-Java.git - scm:git:ssh://github.com:XeroAPI/Xero-Java.git - http://github.com/XeroAPI/Xero-Java/tree/master - - + + + Xero API Team + api@xero.com + Xero + https://developer.xero.com + + + + scm:git:git://github.com/XeroAPI/Xero-Java.git + scm:git:ssh://github.com:XeroAPI/Xero-Java.git + http://github.com/XeroAPI/Xero-Java/tree/master + + com.auth0 java-jwt @@ -263,7 +263,6 @@ - org.apache.maven.plugins maven-pmd-plugin diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index cdc9b163..ba952ff3 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -99,7 +99,7 @@ public class AccountingApi { private ApiClient apiClient; private static AccountingApi instance = null; private String userAgent = "Default"; - private String version = "3.0.5"; + private String version = "3.1.0"; public AccountingApi() { this(new ApiClient()); diff --git a/src/main/java/com/xero/api/client/BankFeedsApi.java b/src/main/java/com/xero/api/client/BankFeedsApi.java index b2e685e1..810b3da3 100644 --- a/src/main/java/com/xero/api/client/BankFeedsApi.java +++ b/src/main/java/com/xero/api/client/BankFeedsApi.java @@ -1,5 +1,4 @@ package com.xero.api.client; - import com.xero.api.ApiClient; import com.xero.models.bankfeeds.Error; @@ -46,7 +45,7 @@ public class BankFeedsApi { private ApiClient apiClient; private static BankFeedsApi instance = null; private String userAgent = "Default"; - private String version = "3.0.5"; + private String version = "3.1.0"; public BankFeedsApi() { this(new ApiClient()); @@ -297,7 +296,7 @@ public HttpResponse getFeedConnectionForHttpResponse(String accessToken, String /** * searches feed connections - * By passing in the appropriate options, you can search for available feed connections in the system + * By passing in the appropriate options, you can search for available feed connections in the system. *

201 - search results matching criteria returned with pagination and items array *

400 - validation error response * @param xeroTenantId Xero identifier for Tenant diff --git a/src/main/java/com/xero/models/bankfeeds/CountryCode.java b/src/main/java/com/xero/models/bankfeeds/CountryCode.java new file mode 100644 index 00000000..c47640b3 --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/CountryCode.java @@ -0,0 +1,534 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * ISO-3166 alpha-2 country code, e.g. US, AU This element is required only when the Application supports multi-region. Talk to your Partner Manager to confirm if this is the case. + */ +public enum CountryCode { + + AD("AD"), + + AE("AE"), + + AF("AF"), + + AG("AG"), + + AI("AI"), + + AL("AL"), + + AM("AM"), + + AN("AN"), + + AO("AO"), + + AQ("AQ"), + + AR("AR"), + + AS("AS"), + + AT("AT"), + + AU("AU"), + + AW("AW"), + + AZ("AZ"), + + BA("BA"), + + BB("BB"), + + BD("BD"), + + BE("BE"), + + BF("BF"), + + BG("BG"), + + BH("BH"), + + BI("BI"), + + BJ("BJ"), + + BL("BL"), + + BM("BM"), + + BN("BN"), + + BO("BO"), + + BR("BR"), + + BS("BS"), + + BT("BT"), + + BW("BW"), + + BY("BY"), + + BZ("BZ"), + + CA("CA"), + + CC("CC"), + + CD("CD"), + + CF("CF"), + + CG("CG"), + + CH("CH"), + + CI("CI"), + + CK("CK"), + + CL("CL"), + + CM("CM"), + + CN("CN"), + + CO("CO"), + + CR("CR"), + + CU("CU"), + + CV("CV"), + + CW("CW"), + + CX("CX"), + + CY("CY"), + + CZ("CZ"), + + DE("DE"), + + DJ("DJ"), + + DK("DK"), + + DM("DM"), + + DO("DO"), + + DZ("DZ"), + + EC("EC"), + + EE("EE"), + + EG("EG"), + + EH("EH"), + + ER("ER"), + + ES("ES"), + + ET("ET"), + + FI("FI"), + + FJ("FJ"), + + FK("FK"), + + FM("FM"), + + FO("FO"), + + FR("FR"), + + GA("GA"), + + GB("GB"), + + GD("GD"), + + GE("GE"), + + GG("GG"), + + GH("GH"), + + GI("GI"), + + GL("GL"), + + GM("GM"), + + GN("GN"), + + GQ("GQ"), + + GR("GR"), + + GT("GT"), + + GU("GU"), + + GW("GW"), + + GY("GY"), + + HK("HK"), + + HN("HN"), + + HR("HR"), + + HT("HT"), + + HU("HU"), + + ID("ID"), + + IE("IE"), + + IL("IL"), + + IM("IM"), + + IN("IN"), + + IO("IO"), + + IQ("IQ"), + + IR("IR"), + + IS("IS"), + + IT("IT"), + + JE("JE"), + + JM("JM"), + + JO("JO"), + + JP("JP"), + + KE("KE"), + + KG("KG"), + + KH("KH"), + + KI("KI"), + + KM("KM"), + + KN("KN"), + + KP("KP"), + + KR("KR"), + + KW("KW"), + + KY("KY"), + + KZ("KZ"), + + LA("LA"), + + LB("LB"), + + LC("LC"), + + LI("LI"), + + LK("LK"), + + LR("LR"), + + LS("LS"), + + LT("LT"), + + LU("LU"), + + LV("LV"), + + LY("LY"), + + MA("MA"), + + MC("MC"), + + MD("MD"), + + ME("ME"), + + MF("MF"), + + MG("MG"), + + MH("MH"), + + MK("MK"), + + ML("ML"), + + MM("MM"), + + MN("MN"), + + MO("MO"), + + MP("MP"), + + MR("MR"), + + MS("MS"), + + MT("MT"), + + MU("MU"), + + MV("MV"), + + MW("MW"), + + MX("MX"), + + MY("MY"), + + MZ("MZ"), + + NA("NA"), + + NC("NC"), + + NE("NE"), + + NG("NG"), + + NI("NI"), + + NL("NL"), + + FALSE("false"), + + NP("NP"), + + NR("NR"), + + NU("NU"), + + NZ("NZ"), + + OM("OM"), + + PA("PA"), + + PE("PE"), + + PF("PF"), + + PG("PG"), + + PH("PH"), + + PK("PK"), + + PL("PL"), + + PM("PM"), + + PN("PN"), + + PR("PR"), + + PS("PS"), + + PT("PT"), + + PW("PW"), + + PY("PY"), + + QA("QA"), + + RE("RE"), + + RO("RO"), + + RS("RS"), + + RU("RU"), + + RW("RW"), + + SA("SA"), + + SB("SB"), + + SC("SC"), + + SD("SD"), + + SE("SE"), + + SG("SG"), + + SH("SH"), + + SI("SI"), + + SJ("SJ"), + + SK("SK"), + + SL("SL"), + + SM("SM"), + + SN("SN"), + + SO("SO"), + + SR("SR"), + + SS("SS"), + + ST("ST"), + + SV("SV"), + + SX("SX"), + + SY("SY"), + + SZ("SZ"), + + TC("TC"), + + TD("TD"), + + TG("TG"), + + TH("TH"), + + TJ("TJ"), + + TK("TK"), + + TL("TL"), + + TM("TM"), + + TN("TN"), + + TO("TO"), + + TR("TR"), + + TT("TT"), + + TV("TV"), + + TW("TW"), + + TZ("TZ"), + + UA("UA"), + + UG("UG"), + + US("US"), + + UY("UY"), + + UZ("UZ"), + + VA("VA"), + + VC("VC"), + + VE("VE"), + + VG("VG"), + + VI("VI"), + + VN("VN"), + + VU("VU"), + + WF("WF"), + + WS("WS"), + + XK("XK"), + + YE("YE"), + + YT("YT"), + + ZA("ZA"), + + ZM("ZM"), + + ZW("ZW"); + + private String value; + + CountryCode(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static CountryCode fromValue(String value) { + for (CountryCode b : CountryCode.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/bankfeeds/CurrencyCode.java b/src/main/java/com/xero/models/bankfeeds/CurrencyCode.java new file mode 100644 index 00000000..dbcbc42b --- /dev/null +++ b/src/main/java/com/xero/models/bankfeeds/CurrencyCode.java @@ -0,0 +1,378 @@ +/* + * Bank Feeds API + * The Xero Bank Feeds API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.bankfeeds; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * 3 letter alpha code for the ISO-4217 currency code, e.g. USD, AUD. + */ +public enum CurrencyCode { + + AED("AED"), + + AFN("AFN"), + + ALL("ALL"), + + AMD("AMD"), + + ANG("ANG"), + + AOA("AOA"), + + ARS("ARS"), + + AUD("AUD"), + + AWG("AWG"), + + AZN("AZN"), + + BAM("BAM"), + + BBD("BBD"), + + BDT("BDT"), + + BGN("BGN"), + + BHD("BHD"), + + BIF("BIF"), + + BMD("BMD"), + + BND("BND"), + + BOB("BOB"), + + BRL("BRL"), + + BSD("BSD"), + + BTN("BTN"), + + BWP("BWP"), + + BYN("BYN"), + + BZD("BZD"), + + CAD("CAD"), + + CDF("CDF"), + + CHF("CHF"), + + CLP("CLP"), + + CNY("CNY"), + + COP("COP"), + + CRC("CRC"), + + CUC("CUC"), + + CUP("CUP"), + + CVE("CVE"), + + CZK("CZK"), + + DJF("DJF"), + + DKK("DKK"), + + DOP("DOP"), + + DZD("DZD"), + + EGP("EGP"), + + ERN("ERN"), + + ETB("ETB"), + + EUR("EUR"), + + FJD("FJD"), + + FKP("FKP"), + + GBP("GBP"), + + GEL("GEL"), + + GGP("GGP"), + + GHS("GHS"), + + GIP("GIP"), + + GMD("GMD"), + + GNF("GNF"), + + GTQ("GTQ"), + + GYD("GYD"), + + HKD("HKD"), + + HNL("HNL"), + + HRK("HRK"), + + HTG("HTG"), + + HUF("HUF"), + + IDR("IDR"), + + ILS("ILS"), + + IMP("IMP"), + + INR("INR"), + + IQD("IQD"), + + IRR("IRR"), + + ISK("ISK"), + + JEP("JEP"), + + JMD("JMD"), + + JOD("JOD"), + + JPY("JPY"), + + KES("KES"), + + KGS("KGS"), + + KHR("KHR"), + + KMF("KMF"), + + KPW("KPW"), + + KRW("KRW"), + + KWD("KWD"), + + KYD("KYD"), + + KZT("KZT"), + + LAK("LAK"), + + LBP("LBP"), + + LKR("LKR"), + + LRD("LRD"), + + LSL("LSL"), + + LYD("LYD"), + + MAD("MAD"), + + MDL("MDL"), + + MGA("MGA"), + + MKD("MKD"), + + MMK("MMK"), + + MNT("MNT"), + + MOP("MOP"), + + MRU("MRU"), + + MUR("MUR"), + + MVR("MVR"), + + MWK("MWK"), + + MXN("MXN"), + + MYR("MYR"), + + MZN("MZN"), + + NAD("NAD"), + + NGN("NGN"), + + NIO("NIO"), + + NOK("NOK"), + + NPR("NPR"), + + NZD("NZD"), + + OMR("OMR"), + + PAB("PAB"), + + PEN("PEN"), + + PGK("PGK"), + + PHP("PHP"), + + PKR("PKR"), + + PLN("PLN"), + + PYG("PYG"), + + QAR("QAR"), + + RON("RON"), + + RSD("RSD"), + + RUB("RUB"), + + RWF("RWF"), + + SAR("SAR"), + + SBD("SBD"), + + SCR("SCR"), + + SDG("SDG"), + + SEK("SEK"), + + SGD("SGD"), + + SHP("SHP"), + + SLL("SLL"), + + SOS("SOS"), + + SPL("SPL"), + + SRD("SRD"), + + STN("STN"), + + SVC("SVC"), + + SYP("SYP"), + + SZL("SZL"), + + THB("THB"), + + TJS("TJS"), + + TMT("TMT"), + + TND("TND"), + + TOP("TOP"), + + TRY("TRY"), + + TTD("TTD"), + + TVD("TVD"), + + TWD("TWD"), + + TZS("TZS"), + + UAH("UAH"), + + UGX("UGX"), + + USD("USD"), + + UYU("UYU"), + + UZS("UZS"), + + VEF("VEF"), + + VND("VND"), + + VUV("VUV"), + + WST("WST"), + + XAF("XAF"), + + XCD("XCD"), + + XDR("XDR"), + + XOF("XOF"), + + XPF("XPF"), + + YER("YER"), + + ZAR("ZAR"), + + ZMW("ZMW"), + + ZWD("ZWD"); + + private String value; + + CurrencyCode(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static CurrencyCode fromValue(String value) { + for (CurrencyCode b : CurrencyCode.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/bankfeeds/FeedConnection.java b/src/main/java/com/xero/models/bankfeeds/FeedConnection.java index 9ddd3a7f..4e1cb101 100644 --- a/src/main/java/com/xero/models/bankfeeds/FeedConnection.java +++ b/src/main/java/com/xero/models/bankfeeds/FeedConnection.java @@ -18,6 +18,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.bankfeeds.CountryCode; +import com.xero.models.bankfeeds.CurrencyCode; import com.xero.models.bankfeeds.Error; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -84,10 +86,10 @@ public static AccountTypeEnum fromValue(String value) { private AccountTypeEnum accountType; @JsonProperty("currency") - private String currency; + private CurrencyCode currency; @JsonProperty("country") - private String country; + private CountryCode country; /** * the current status of the feed connection @@ -238,39 +240,39 @@ public void setAccountType(AccountTypeEnum accountType) { this.accountType = accountType; } - public FeedConnection currency(String currency) { + public FeedConnection currency(CurrencyCode currency) { this.currency = currency; return this; } /** - * ISO-4217 currency code, e.g. USD, AUD. + * Get currency * @return currency **/ - @ApiModelProperty(example = "AUD", value = "ISO-4217 currency code, e.g. USD, AUD.") - public String getCurrency() { + @ApiModelProperty(value = "") + public CurrencyCode getCurrency() { return currency; } - public void setCurrency(String currency) { + public void setCurrency(CurrencyCode currency) { this.currency = currency; } - public FeedConnection country(String country) { + public FeedConnection country(CountryCode country) { this.country = country; return this; } /** - * ISO-3166 alpha-2 country code, e.g. US, AU This element is required only when the Application supports multi-region. Talk to your Partner Manager to confirm if this is the case. + * Get country * @return country **/ - @ApiModelProperty(example = "GB", value = "ISO-3166 alpha-2 country code, e.g. US, AU This element is required only when the Application supports multi-region. Talk to your Partner Manager to confirm if this is the case.") - public String getCountry() { + @ApiModelProperty(value = "") + public CountryCode getCountry() { return country; } - public void setCountry(String country) { + public void setCountry(CountryCode country) { this.country = country; } diff --git a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java index fe6247c1..72d8725e 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java @@ -1,44 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.*; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - -import com.xero.api.ApiClient; -import com.xero.api.client.*; -import com.xero.models.bankfeeds.*; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.io.File; -import java.io.IOException; +import com.xero.api.ApiClient; +import com.xero.models.bankfeeds.FeedConnection; +import com.xero.models.bankfeeds.FeedConnections; -import org.apache.commons.io.IOUtils; +import org.junit.Before; +import org.junit.Test; public class BankfeedApiFeedConnectionTest { @@ -64,14 +37,13 @@ public void setUp() { if (setUpIsDone) { return; } -/* + try { System.out.println("Sleep for 60 seconds"); Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } -*/ // do the setup setUpIsDone = true; } @@ -107,8 +79,8 @@ public void testGetFeedConnections() throws Exception { assertThat(response.getItems().get(0).getAccountName(), (equalTo("SDK Bank 95921"))); assertThat(response.getItems().get(0).getAccountId().toString(), (equalTo("aefbf6be-4285-4ca5-bf39-0f486c8515c7"))); assertThat(response.getItems().get(0).getAccountType(), is(equalTo(com.xero.models.bankfeeds.FeedConnection.AccountTypeEnum.BANK))); - assertThat(response.getItems().get(0).getCurrency(), (equalTo("GBP"))); - assertThat(response.getItems().get(0).getCountry(), (equalTo("GB"))); + assertThat(response.getItems().get(0).getCurrency(), is(equalTo(com.xero.models.bankfeeds.CurrencyCode.GBP))); + assertThat(response.getItems().get(0).getCountry(), is(equalTo(com.xero.models.bankfeeds.CountryCode.GB))); } @Test @@ -123,8 +95,8 @@ public void testGetFeedConnection() throws Exception { assertThat(response.getAccountName(), (equalTo("SDK Bank 5517"))); assertThat(response.getAccountId().toString(), (equalTo("f4c4d595-da94-493b-999a-19d1ae1f508a"))); assertThat(response.getAccountType(), is(equalTo(com.xero.models.bankfeeds.FeedConnection.AccountTypeEnum.BANK))); - assertThat(response.getCurrency(), (equalTo("GBP"))); - assertThat(response.getCountry(), (equalTo("GB"))); + assertThat(response.getCurrency(), is(equalTo(com.xero.models.bankfeeds.CurrencyCode.GBP))); + assertThat(response.getCountry(), is(equalTo(com.xero.models.bankfeeds.CountryCode.GB))); } @Test diff --git a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java index e01d25f9..44f1effa 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java @@ -64,14 +64,14 @@ public void setUp() { if (setUpIsDone) { return; } -/* + try { System.out.println("Sleep for 60 seconds"); Thread.sleep(60000); } catch(InterruptedException e) { System.out.println(e); } -*/ + // do the setup setUpIsDone = true; } From 0af52cc163c549384b3a878c229454b42f3bb43a Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Thu, 31 Oct 2019 06:51:03 -0700 Subject: [PATCH 73/76] Add "alpha" payroall AU api client and model Not production ready still in development. --- .../com/xero/api/client/BankFeedsApi.java | 1 + .../com/xero/api/client/PayrollAuApi.java | 2139 +++++++++++++++++ .../java/com/xero/models/bankfeeds/Error.java | 4 +- .../com/xero/models/payrollau/Account.java | 167 ++ .../xero/models/payrollau/AccountType.java | 98 + .../xero/models/payrollau/BankAccount.java | 213 ++ .../xero/models/payrollau/CalendarType.java | 65 + .../xero/models/payrollau/DeductionLine.java | 143 ++ .../xero/models/payrollau/DeductionType.java | 239 ++ .../DeductionTypeCalculationType.java | 59 + .../xero/models/payrollau/EarningsLine.java | 239 ++ .../xero/models/payrollau/EarningsRate.java | 434 ++++ .../EarningsRateCalculationType.java | 59 + .../xero/models/payrollau/EarningsType.java | 65 + .../com/xero/models/payrollau/Employee.java | 816 +++++++ .../xero/models/payrollau/EmployeeStatus.java | 58 + .../com/xero/models/payrollau/Employees.java | 104 + .../models/payrollau/EmploymentBasis.java | 63 + .../EmploymentTerminationPaymentType.java | 57 + .../EntitlementFinalPayPayoutType.java | 57 + .../xero/models/payrollau/HomeAddress.java | 214 ++ .../models/payrollau/LeaveApplication.java | 273 +++ .../models/payrollau/LeaveApplications.java | 104 + .../xero/models/payrollau/LeaveBalance.java | 165 ++ .../com/xero/models/payrollau/LeaveLine.java | 216 ++ .../com/xero/models/payrollau/LeaveLines.java | 105 + .../xero/models/payrollau/LeavePeriod.java | 167 ++ .../models/payrollau/LeavePeriodStatus.java | 57 + .../com/xero/models/payrollau/LeaveType.java | 263 ++ .../payrollau/LeaveTypeContributionType.java | 61 + .../xero/models/payrollau/ManualTaxType.java | 59 + .../models/payrollau/ModelAPIException.java | 143 ++ .../models/payrollau/OpeningBalances.java | 285 +++ .../com/xero/models/payrollau/PayItem.java | 203 ++ .../com/xero/models/payrollau/PayItems.java | 94 + .../xero/models/payrollau/PayRunStatus.java | 57 + .../xero/models/payrollau/PayTemplate.java | 236 ++ .../payrollau/PaymentFrequencyType.java | 67 + .../models/payrollau/PayrollCalendar.java | 192 ++ .../models/payrollau/PayrollCalendars.java | 104 + .../com/xero/models/payrollau/Payrun.java | 443 ++++ .../com/xero/models/payrollau/Payruns.java | 104 + .../com/xero/models/payrollau/Payslip.java | 599 +++++ .../payrollau/PayslipDeductionLine.java | 167 ++ .../payrollau/PayslipEarningsLines.java | 166 ++ .../payrollau/PayslipLeaveAccrualLine.java | 142 ++ .../payrollau/PayslipLeaveEarningsLines.java | 142 ++ .../payrollau/PayslipReimbursementLine.java | 166 ++ .../xero/models/payrollau/PayslipSummary.java | 334 +++ .../payrollau/PayslipSuperannuationLine.java | 289 +++ .../xero/models/payrollau/PayslipTaxLine.java | 190 ++ .../com/xero/models/payrollau/RateType.java | 59 + .../models/payrollau/ReimbursementLine.java | 118 + .../models/payrollau/ReimbursementLines.java | 105 + .../models/payrollau/ReimbursementType.java | 167 ++ .../models/payrollau/ResidencyStatus.java | 59 + .../com/xero/models/payrollau/Settings.java | 154 ++ .../payrollau/SettingsTrackingCategories.java | 120 + ...tingsTrackingCategoriesEmployeeGroups.java | 119 + ...TrackingCategoriesTimesheetCategories.java | 119 + .../java/com/xero/models/payrollau/State.java | 70 + .../xero/models/payrollau/SuperFundType.java | 57 + .../com/xero/models/payrollau/SuperLine.java | 264 ++ .../models/payrollau/SuperMembership.java | 143 ++ .../SuperannuationCalculationType.java | 59 + .../SuperannuationContributionType.java | 61 + .../com/xero/models/payrollau/Superfund.java | 334 +++ .../models/payrollau/SuperfundProduct.java | 165 ++ .../models/payrollau/SuperfundProducts.java | 104 + .../com/xero/models/payrollau/Superfunds.java | 104 + .../models/payrollau/TFNExemptionType.java | 61 + .../xero/models/payrollau/TaxDeclaration.java | 410 ++++ .../com/xero/models/payrollau/Timesheet.java | 250 ++ .../xero/models/payrollau/TimesheetLine.java | 177 ++ .../models/payrollau/TimesheetStatus.java | 59 + .../com/xero/models/payrollau/Timesheets.java | 104 + 76 files changed, 14328 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/xero/api/client/PayrollAuApi.java create mode 100644 src/main/java/com/xero/models/payrollau/Account.java create mode 100644 src/main/java/com/xero/models/payrollau/AccountType.java create mode 100644 src/main/java/com/xero/models/payrollau/BankAccount.java create mode 100644 src/main/java/com/xero/models/payrollau/CalendarType.java create mode 100644 src/main/java/com/xero/models/payrollau/DeductionLine.java create mode 100644 src/main/java/com/xero/models/payrollau/DeductionType.java create mode 100644 src/main/java/com/xero/models/payrollau/DeductionTypeCalculationType.java create mode 100644 src/main/java/com/xero/models/payrollau/EarningsLine.java create mode 100644 src/main/java/com/xero/models/payrollau/EarningsRate.java create mode 100644 src/main/java/com/xero/models/payrollau/EarningsRateCalculationType.java create mode 100644 src/main/java/com/xero/models/payrollau/EarningsType.java create mode 100644 src/main/java/com/xero/models/payrollau/Employee.java create mode 100644 src/main/java/com/xero/models/payrollau/EmployeeStatus.java create mode 100644 src/main/java/com/xero/models/payrollau/Employees.java create mode 100644 src/main/java/com/xero/models/payrollau/EmploymentBasis.java create mode 100644 src/main/java/com/xero/models/payrollau/EmploymentTerminationPaymentType.java create mode 100644 src/main/java/com/xero/models/payrollau/EntitlementFinalPayPayoutType.java create mode 100644 src/main/java/com/xero/models/payrollau/HomeAddress.java create mode 100644 src/main/java/com/xero/models/payrollau/LeaveApplication.java create mode 100644 src/main/java/com/xero/models/payrollau/LeaveApplications.java create mode 100644 src/main/java/com/xero/models/payrollau/LeaveBalance.java create mode 100644 src/main/java/com/xero/models/payrollau/LeaveLine.java create mode 100644 src/main/java/com/xero/models/payrollau/LeaveLines.java create mode 100644 src/main/java/com/xero/models/payrollau/LeavePeriod.java create mode 100644 src/main/java/com/xero/models/payrollau/LeavePeriodStatus.java create mode 100644 src/main/java/com/xero/models/payrollau/LeaveType.java create mode 100644 src/main/java/com/xero/models/payrollau/LeaveTypeContributionType.java create mode 100644 src/main/java/com/xero/models/payrollau/ManualTaxType.java create mode 100644 src/main/java/com/xero/models/payrollau/ModelAPIException.java create mode 100644 src/main/java/com/xero/models/payrollau/OpeningBalances.java create mode 100644 src/main/java/com/xero/models/payrollau/PayItem.java create mode 100644 src/main/java/com/xero/models/payrollau/PayItems.java create mode 100644 src/main/java/com/xero/models/payrollau/PayRunStatus.java create mode 100644 src/main/java/com/xero/models/payrollau/PayTemplate.java create mode 100644 src/main/java/com/xero/models/payrollau/PaymentFrequencyType.java create mode 100644 src/main/java/com/xero/models/payrollau/PayrollCalendar.java create mode 100644 src/main/java/com/xero/models/payrollau/PayrollCalendars.java create mode 100644 src/main/java/com/xero/models/payrollau/Payrun.java create mode 100644 src/main/java/com/xero/models/payrollau/Payruns.java create mode 100644 src/main/java/com/xero/models/payrollau/Payslip.java create mode 100644 src/main/java/com/xero/models/payrollau/PayslipDeductionLine.java create mode 100644 src/main/java/com/xero/models/payrollau/PayslipEarningsLines.java create mode 100644 src/main/java/com/xero/models/payrollau/PayslipLeaveAccrualLine.java create mode 100644 src/main/java/com/xero/models/payrollau/PayslipLeaveEarningsLines.java create mode 100644 src/main/java/com/xero/models/payrollau/PayslipReimbursementLine.java create mode 100644 src/main/java/com/xero/models/payrollau/PayslipSummary.java create mode 100644 src/main/java/com/xero/models/payrollau/PayslipSuperannuationLine.java create mode 100644 src/main/java/com/xero/models/payrollau/PayslipTaxLine.java create mode 100644 src/main/java/com/xero/models/payrollau/RateType.java create mode 100644 src/main/java/com/xero/models/payrollau/ReimbursementLine.java create mode 100644 src/main/java/com/xero/models/payrollau/ReimbursementLines.java create mode 100644 src/main/java/com/xero/models/payrollau/ReimbursementType.java create mode 100644 src/main/java/com/xero/models/payrollau/ResidencyStatus.java create mode 100644 src/main/java/com/xero/models/payrollau/Settings.java create mode 100644 src/main/java/com/xero/models/payrollau/SettingsTrackingCategories.java create mode 100644 src/main/java/com/xero/models/payrollau/SettingsTrackingCategoriesEmployeeGroups.java create mode 100644 src/main/java/com/xero/models/payrollau/SettingsTrackingCategoriesTimesheetCategories.java create mode 100644 src/main/java/com/xero/models/payrollau/State.java create mode 100644 src/main/java/com/xero/models/payrollau/SuperFundType.java create mode 100644 src/main/java/com/xero/models/payrollau/SuperLine.java create mode 100644 src/main/java/com/xero/models/payrollau/SuperMembership.java create mode 100644 src/main/java/com/xero/models/payrollau/SuperannuationCalculationType.java create mode 100644 src/main/java/com/xero/models/payrollau/SuperannuationContributionType.java create mode 100644 src/main/java/com/xero/models/payrollau/Superfund.java create mode 100644 src/main/java/com/xero/models/payrollau/SuperfundProduct.java create mode 100644 src/main/java/com/xero/models/payrollau/SuperfundProducts.java create mode 100644 src/main/java/com/xero/models/payrollau/Superfunds.java create mode 100644 src/main/java/com/xero/models/payrollau/TFNExemptionType.java create mode 100644 src/main/java/com/xero/models/payrollau/TaxDeclaration.java create mode 100644 src/main/java/com/xero/models/payrollau/Timesheet.java create mode 100644 src/main/java/com/xero/models/payrollau/TimesheetLine.java create mode 100644 src/main/java/com/xero/models/payrollau/TimesheetStatus.java create mode 100644 src/main/java/com/xero/models/payrollau/Timesheets.java diff --git a/src/main/java/com/xero/api/client/BankFeedsApi.java b/src/main/java/com/xero/api/client/BankFeedsApi.java index 810b3da3..b9f9e6c3 100644 --- a/src/main/java/com/xero/api/client/BankFeedsApi.java +++ b/src/main/java/com/xero/api/client/BankFeedsApi.java @@ -83,6 +83,7 @@ public String getUserAgent() { * By passing in the FeedConnections array object in the body, you can create one or more new feed connections *

201 - success new feed connection(s)response *

400 - invalid input, object invalid + *

409 - failed to create new feed connection(s)response * @param xeroTenantId Xero identifier for Tenant * @param feedConnections Feed Connection(s) array object in the body * @return FeedConnections diff --git a/src/main/java/com/xero/api/client/PayrollAuApi.java b/src/main/java/com/xero/api/client/PayrollAuApi.java new file mode 100644 index 00000000..26ab3f25 --- /dev/null +++ b/src/main/java/com/xero/api/client/PayrollAuApi.java @@ -0,0 +1,2139 @@ +package com.xero.api.client; + +import com.xero.api.ApiClient; + +import com.xero.models.payrollau.Employee; +import com.xero.models.payrollau.Employees; +import com.xero.models.payrollau.LeaveApplication; +import com.xero.models.payrollau.LeaveApplications; +import com.xero.models.payrollau.ModelAPIException; +import org.threeten.bp.OffsetDateTime; +import com.xero.models.payrollau.PayItems; +import com.xero.models.payrollau.PayrollCalendars; +import com.xero.models.payrollau.Payruns; +import com.xero.models.payrollau.Payslip; +import com.xero.models.payrollau.Settings; +import com.xero.models.payrollau.SuperfundProducts; +import com.xero.models.payrollau.Superfunds; +import com.xero.models.payrollau.Timesheets; +import java.util.UUID; +import com.xero.api.XeroApiException; +import com.xero.api.XeroApiExceptionHandler; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.GenericUrl; +import com.google.api.client.http.HttpContent; +import com.google.api.client.http.HttpMethods; +import com.google.api.client.http.HttpRequestFactory; +import com.google.api.client.http.HttpHeaders; +import com.google.api.client.http.HttpResponse; +import com.google.api.client.http.HttpResponseException; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.FileContent; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.io.ByteArrayInputStream; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; + +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + + +public class PayrollAuApi { + private ApiClient apiClient; + private static PayrollAuApi instance = null; + private String userAgent = "Default"; + private String version = "3.1.0"; + + public PayrollAuApi() { + this(new ApiClient()); + } + + public static PayrollAuApi getInstance(ApiClient apiClient) { + if (instance == null) { + instance = new PayrollAuApi(apiClient); + } + return instance; + } + + public PayrollAuApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public String getUserAgent() { + return this.userAgent + "[Xero-Java-" + this.version + "]"; + } + + /** + * Use this method to create a payroll employee + *

200 - A successful request + *

400 - invalid input, object invalid - TODO + * @param xeroTenantId Xero identifier for Tenant + * @param employee The employee parameter + * @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 createEmployee(String accessToken, String xeroTenantId, List employee) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createEmployeeForHttpResponse(accessToken, xeroTenantId, employee); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createEmployeeForHttpResponse(String accessToken, String xeroTenantId, List employee) 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.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Employees"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(employee); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Use this method to create a Leave Application + *

200 - A successful request + *

400 - invalid input, object invalid - TODO + * @param xeroTenantId Xero identifier for Tenant + * @param leaveApplication The leaveApplication parameter + * @param accessToken Authorization token for user set in header of each request + * @return LeaveApplications + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LeaveApplications createLeaveApplication(String accessToken, String xeroTenantId, List leaveApplication) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createLeaveApplicationForHttpResponse(accessToken, xeroTenantId, leaveApplication); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createLeaveApplicationForHttpResponse(String accessToken, String xeroTenantId, List leaveApplication) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createLeaveApplication"); + }// verify the required parameter 'leaveApplication' is set + if (leaveApplication == null) { + throw new IllegalArgumentException("Missing the required parameter 'leaveApplication' when calling createLeaveApplication"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createLeaveApplication"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/LeaveApplications"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(leaveApplication); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Use this method to create a Pay Item + *

200 - A successful request + *

400 - invalid input, object invalid - TODO + * @param xeroTenantId Xero identifier for Tenant + * @param payItems The payItems parameter + * @param accessToken Authorization token for user set in header of each request + * @return PayItems + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PayItems createPayItem(String accessToken, String xeroTenantId, List payItems) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createPayItemForHttpResponse(accessToken, xeroTenantId, payItems); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createPayItemForHttpResponse(String accessToken, String xeroTenantId, List payItems) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayItem"); + }// verify the required parameter 'payItems' is set + if (payItems == null) { + throw new IllegalArgumentException("Missing the required parameter 'payItems' when calling createPayItem"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPayItem"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/PayItems"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(payItems); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Use this method to create a Payroll Calendars + *

200 - A successful request + *

400 - invalid input, object invalid - TODO + * @param xeroTenantId Xero identifier for Tenant + * @param payrollCalendars The payrollCalendars parameter + * @param accessToken Authorization token for user set in header of each request + * @return PayrollCalendars + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PayrollCalendars createPayrollCalendar(String accessToken, String xeroTenantId, List payrollCalendars) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createPayrollCalendarForHttpResponse(accessToken, xeroTenantId, payrollCalendars); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createPayrollCalendarForHttpResponse(String accessToken, String xeroTenantId, List payrollCalendars) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayrollCalendar"); + }// verify the required parameter 'payrollCalendars' is set + if (payrollCalendars == null) { + throw new IllegalArgumentException("Missing the required parameter 'payrollCalendars' when calling createPayrollCalendar"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPayrollCalendar"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/PayrollCalendars"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(payrollCalendars); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Use this method to create a payrun + *

200 - A successful request + *

400 - invalid input, object invalid - TODO + * @param xeroTenantId Xero identifier for Tenant + * @param payruns The payruns parameter + * @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 createPayrun(String accessToken, String xeroTenantId, List payruns) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createPayrunForHttpResponse(accessToken, xeroTenantId, payruns); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createPayrunForHttpResponse(String accessToken, String xeroTenantId, List payruns) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayrun"); + }// verify the required parameter 'payruns' is set + if (payruns == null) { + throw new IllegalArgumentException("Missing the required parameter 'payruns' when calling createPayrun"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPayrun"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Payruns"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(payruns); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Use this method to create a super fund + *

200 - A successful request + *

400 - invalid input, object invalid - TODO + * @param xeroTenantId Xero identifier for Tenant + * @param superfunds The superfunds parameter + * @param accessToken Authorization token for user set in header of each request + * @return Superfunds + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Superfunds createSuperfund(String accessToken, String xeroTenantId, List superfunds) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createSuperfundForHttpResponse(accessToken, xeroTenantId, superfunds); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createSuperfundForHttpResponse(String accessToken, String xeroTenantId, List superfunds) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createSuperfund"); + }// verify the required parameter 'superfunds' is set + if (superfunds == null) { + throw new IllegalArgumentException("Missing the required parameter 'superfunds' when calling createSuperfund"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createSuperfund"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Superfunds"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(superfunds); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Use this method to create a timesheet + *

200 - A successful request + *

400 - invalid input, object invalid - TODO + * @param xeroTenantId Xero identifier for Tenant + * @param timesheets The timesheets parameter + * @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 createTimesheet(String accessToken, String xeroTenantId, Timesheets timesheets) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createTimesheetForHttpResponse(accessToken, xeroTenantId, timesheets); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse createTimesheetForHttpResponse(String accessToken, String xeroTenantId, Timesheets timesheets) 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 'timesheets' is set + if (timesheets == null) { + throw new IllegalArgumentException("Missing the required parameter 'timesheets' 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.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Timesheets"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(timesheets); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches for an employee by unique 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 Employees + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Employees 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) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + 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()); + + String correctPath = "/Employees/{EmployeeId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("EmployeeId", employeeId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches employees + *

200 - search results matching criteria + *

400 - validation error for a bad request + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 employees will be returned in a single API call + * @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, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getEmployeesForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getEmployeesForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, 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()); + + String correctPath = "/Employees"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches for an Leave Application by unique id + *

200 - search results matching criteria + * @param xeroTenantId Xero identifier for Tenant + * @param leaveApplicationId Leave Application id for single object + * @param accessToken Authorization token for user set in header of each request + * @return LeaveApplications + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LeaveApplications getLeaveApplication(String accessToken, String xeroTenantId, UUID leaveApplicationId) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getLeaveApplicationForHttpResponse(accessToken, xeroTenantId, leaveApplicationId); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getLeaveApplicationForHttpResponse(String accessToken, String xeroTenantId, UUID leaveApplicationId) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLeaveApplication"); + }// verify the required parameter 'leaveApplicationId' is set + if (leaveApplicationId == null) { + throw new IllegalArgumentException("Missing the required parameter 'leaveApplicationId' when calling getLeaveApplication"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getLeaveApplication"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/LeaveApplications/{LeaveApplicationId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LeaveApplicationId", leaveApplicationId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches Leave Applications + *

200 - search results matching criteria + *

400 - validation error for a bad request + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 objects will be returned in a single API call + * @param accessToken Authorization token for user set in header of each request + * @return LeaveApplications + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LeaveApplications getLeaveApplications(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getLeaveApplicationsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getLeaveApplicationsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLeaveApplications"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getLeaveApplications"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/LeaveApplications"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches Pay Items + *

200 - search results matching criteria + *

400 - validation error for a bad request + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 objects will be returned in a single API call + * @param accessToken Authorization token for user set in header of each request + * @return PayItems + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PayItems getPayItems(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getPayItemsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getPayItemsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayItems"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getPayItems"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/PayItems"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches Payroll Calendars + *

200 - search results matching criteria + *

400 - validation error for a bad request + * @param xeroTenantId Xero identifier for Tenant + * @param payrollCalendarID Payroll Calendar id for single object + * @param accessToken Authorization token for user set in header of each request + * @return PayrollCalendars + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PayrollCalendars getPayrollCalendar(String accessToken, String xeroTenantId, UUID payrollCalendarID) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getPayrollCalendarForHttpResponse(accessToken, xeroTenantId, payrollCalendarID); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getPayrollCalendarForHttpResponse(String accessToken, String xeroTenantId, UUID payrollCalendarID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayrollCalendar"); + }// verify the required parameter 'payrollCalendarID' is set + if (payrollCalendarID == null) { + throw new IllegalArgumentException("Missing the required parameter 'payrollCalendarID' when calling getPayrollCalendar"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getPayrollCalendar"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/PayrollCalendars/{PayrollCalendarID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PayrollCalendarID", payrollCalendarID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches Payroll Calendars + *

200 - search results matching criteria + *

400 - validation error for a bad request + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 objects will be returned in a single API call + * @param accessToken Authorization token for user set in header of each request + * @return PayrollCalendars + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public PayrollCalendars getPayrollCalendars(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getPayrollCalendarsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getPayrollCalendarsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayrollCalendars"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getPayrollCalendars"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/PayrollCalendars"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches for an payrun by unique id + *

200 - search results matching criteria + * @param xeroTenantId Xero identifier for Tenant + * @param payrunID Payrun id for single object + * @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 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) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + 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()); + + String correctPath = "/Payruns/{PayrunID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PayrunID", payrunID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches payruns + *

200 - search results matching criteria + *

400 - validation error for a bad request + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 payruns will be returned in a single API call + * @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, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getPayrunsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getPayrunsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) 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()); + + String correctPath = "/Payruns"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches for an payslip by unique id + *

200 - search results matching criteria + * @param xeroTenantId Xero identifier for Tenant + * @param payslipID Payslip id for single object + * @param accessToken Authorization token for user set in header of each request + * @return Payslip + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payslip 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) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + 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()); + + String correctPath = "/Payslip/{PayslipID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PayslipID", payslipID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * retrieve settings + *

200 - payroll settings + * @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) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + 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()); + + String correctPath = "/Settings"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches for an Superfund by unique id + *

200 - search results matching criteria + * @param xeroTenantId Xero identifier for Tenant + * @param superfundID Superfund id for single object + * @param accessToken Authorization token for user set in header of each request + * @return Superfunds + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Superfunds getSuperfund(String accessToken, String xeroTenantId, UUID superfundID) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getSuperfundForHttpResponse(accessToken, xeroTenantId, superfundID); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getSuperfundForHttpResponse(String accessToken, String xeroTenantId, UUID superfundID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getSuperfund"); + }// verify the required parameter 'superfundID' is set + if (superfundID == null) { + throw new IllegalArgumentException("Missing the required parameter 'superfundID' when calling getSuperfund"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getSuperfund"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Superfunds/{SuperfundID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("SuperfundID", superfundID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches SuperfundProducts + *

200 - search results matching criteria + *

400 - validation error for a bad request + * @param xeroTenantId Xero identifier for Tenant + * @param ABN The ABN of the Regulated SuperFund + * @param USI The USI of the Regulated SuperFund + * @param accessToken Authorization token for user set in header of each request + * @return SuperfundProducts + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public SuperfundProducts getSuperfundProducts(String accessToken, String xeroTenantId, String ABN, String USI) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getSuperfundProductsForHttpResponse(accessToken, xeroTenantId, ABN, USI); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getSuperfundProductsForHttpResponse(String accessToken, String xeroTenantId, String ABN, String USI) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getSuperfundProducts"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getSuperfundProducts"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/SuperfundProducts"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (ABN != null) { + String key = "ABN"; + Object value = ABN; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (USI != null) { + String key = "USI"; + Object value = USI; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches Superfunds + *

200 - search results matching criteria + *

400 - validation error for a bad request + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 Superfunds will be returned in a single API call + * @param accessToken Authorization token for user set in header of each request + * @return Superfunds + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Superfunds getSuperfunds(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getSuperfundsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getSuperfundsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getSuperfunds"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getSuperfunds"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Superfunds"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches for an timesheet by unique id + *

200 - search results matching criteria + * @param xeroTenantId Xero identifier for Tenant + * @param timesheetID Timesheet id for single object + * @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 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) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + 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()); + + String correctPath = "/Timesheets/{TimesheetID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TimesheetID", timesheetID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches timesheets + *

200 - search results matching criteria + *

400 - validation error for a bad request + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param where Filter by an any element + * @param order Order by an any element + * @param page e.g. page=1 – Up to 100 timesheets will be returned in a single API call + * @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, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getTimesheetsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getTimesheetsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) 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()); + + String correctPath = "/Timesheets"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (where != null) { + String key = "where"; + Object value = where; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + + HttpContent content = null; + + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Update an Employee + * Update properties on a single employee + *

200 - A successful request + * @param xeroTenantId Xero identifier for Tenant + * @param employeeId Employee id for single object + * @param employee The employee parameter + * @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 updateEmployee(String accessToken, String xeroTenantId, UUID employeeId, List employee) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = updateEmployeeForHttpResponse(accessToken, xeroTenantId, employeeId, employee); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse updateEmployeeForHttpResponse(String accessToken, String xeroTenantId, UUID employeeId, List employee) 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"); + } + 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.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Employees/{EmployeeId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("EmployeeId", employeeId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(employee); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Use this method to create a Leave Application + *

200 - A successful request + *

400 - invalid input, object invalid - TODO + * @param xeroTenantId Xero identifier for Tenant + * @param leaveApplicationId Leave Application id for single object + * @param leaveApplication The leaveApplication parameter + * @param accessToken Authorization token for user set in header of each request + * @return LeaveApplications + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public LeaveApplications updateLeaveApplication(String accessToken, String xeroTenantId, UUID leaveApplicationId, List leaveApplication) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = updateLeaveApplicationForHttpResponse(accessToken, xeroTenantId, leaveApplicationId, leaveApplication); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse updateLeaveApplicationForHttpResponse(String accessToken, String xeroTenantId, UUID leaveApplicationId, List leaveApplication) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateLeaveApplication"); + }// verify the required parameter 'leaveApplicationId' is set + if (leaveApplicationId == null) { + throw new IllegalArgumentException("Missing the required parameter 'leaveApplicationId' when calling updateLeaveApplication"); + }// verify the required parameter 'leaveApplication' is set + if (leaveApplication == null) { + throw new IllegalArgumentException("Missing the required parameter 'leaveApplication' when calling updateLeaveApplication"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updateLeaveApplication"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/LeaveApplications/{LeaveApplicationId}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("LeaveApplicationId", leaveApplicationId); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(leaveApplication); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Update a Payrun + * Update properties on a single payrun + *

200 - A successful request + * @param xeroTenantId Xero identifier for Tenant + * @param payrunID Payrun id for single object + * @param payruns The payruns parameter + * @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 updatePayrun(String accessToken, String xeroTenantId, UUID payrunID, List payruns) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = updatePayrunForHttpResponse(accessToken, xeroTenantId, payrunID, payruns); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse updatePayrunForHttpResponse(String accessToken, String xeroTenantId, UUID payrunID, List payruns) 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"); + } + 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.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Payruns/{PayrunID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PayrunID", payrunID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(payruns); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Use this add, update or delete one or more payslip line items + *

200 - A successful request + *

400 - invalid input, object invalid - TODO + * @param xeroTenantId Xero identifier for Tenant + * @param payslip The payslip parameter + * @param accessToken Authorization token for user set in header of each request + * @return Payslip + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payslip updatePayslip(String accessToken, String xeroTenantId, List payslip) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = updatePayslipForHttpResponse(accessToken, xeroTenantId, payslip); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse updatePayslipForHttpResponse(String accessToken, String xeroTenantId, List payslip) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePayslip"); + }// verify the required parameter 'payslip' is set + if (payslip == null) { + throw new IllegalArgumentException("Missing the required parameter 'payslip' when calling updatePayslip"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updatePayslip"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Payslip"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(payslip); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Update a Payslip + * Update lines on a single payslip + *

200 - A successful request + * @param xeroTenantId Xero identifier for Tenant + * @param payslipID Payslip id for single object + * @param payslip The payslip parameter + * @param accessToken Authorization token for user set in header of each request + * @return Payslip + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Payslip updatePayslipByID(String accessToken, String xeroTenantId, UUID payslipID, List payslip) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = updatePayslipByIDForHttpResponse(accessToken, xeroTenantId, payslipID, payslip); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse updatePayslipByIDForHttpResponse(String accessToken, String xeroTenantId, UUID payslipID, List payslip) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePayslipByID"); + }// verify the required parameter 'payslipID' is set + if (payslipID == null) { + throw new IllegalArgumentException("Missing the required parameter 'payslipID' when calling updatePayslipByID"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updatePayslipByID"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Payslip/{PayslipID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("PayslipID", payslipID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(payslip); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Update a Superfund + * Update properties on a single Superfund + *

200 - A successful request + * @param xeroTenantId Xero identifier for Tenant + * @param superfundID Superfund id for single object + * @param superfunds The superfunds parameter + * @param accessToken Authorization token for user set in header of each request + * @return Superfunds + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Superfunds updateSuperfund(String accessToken, String xeroTenantId, UUID superfundID, Superfunds superfunds) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = updateSuperfundForHttpResponse(accessToken, xeroTenantId, superfundID, superfunds); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse updateSuperfundForHttpResponse(String accessToken, String xeroTenantId, UUID superfundID, Superfunds superfunds) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateSuperfund"); + }// verify the required parameter 'superfundID' is set + if (superfundID == null) { + throw new IllegalArgumentException("Missing the required parameter 'superfundID' when calling updateSuperfund"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updateSuperfund"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Superfunds/{SuperfundID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("SuperfundID", superfundID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(superfunds); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Update a Timesheet + * Update properties on a single timesheet + *

200 - A successful request + * @param xeroTenantId Xero identifier for Tenant + * @param timesheetID Timesheet id for single object + * @param timesheets The timesheets parameter + * @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 updateTimesheet(String accessToken, String xeroTenantId, UUID timesheetID, Timesheets timesheets) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = updateTimesheetForHttpResponse(accessToken, xeroTenantId, timesheetID, timesheets); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse updateTimesheetForHttpResponse(String accessToken, String xeroTenantId, UUID timesheetID, Timesheets timesheets) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTimesheet"); + }// verify the required parameter 'timesheetID' is set + if (timesheetID == null) { + throw new IllegalArgumentException("Missing the required parameter 'timesheetID' when calling updateTimesheet"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updateTimesheet"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Timesheets/{TimesheetID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("TimesheetID", timesheetID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + content = apiClient.new JacksonJsonHttpContent(timesheets); + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); + } + + + 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(); + } + + } +} diff --git a/src/main/java/com/xero/models/bankfeeds/Error.java b/src/main/java/com/xero/models/bankfeeds/Error.java index 7e805552..fbe2fff0 100644 --- a/src/main/java/com/xero/models/bankfeeds/Error.java +++ b/src/main/java/com/xero/models/bankfeeds/Error.java @@ -56,7 +56,9 @@ public enum TypeEnum { INVALID_START_DATE("invalid-start-date"), - INTERNAL_ERROR("internal-error"); + INTERNAL_ERROR("internal-error"), + + FEED_ALREADY_CONNECTED_IN_CURRENT_ORGANISATION("feed-already-connected-in-current-organisation"); private String value; diff --git a/src/main/java/com/xero/models/payrollau/Account.java b/src/main/java/com/xero/models/payrollau/Account.java new file mode 100644 index 00000000..36c880ef --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/Account.java @@ -0,0 +1,167 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.AccountType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Account + */ + +public class Account { + + @JsonProperty("AccountID") + private UUID accountID; + + + @JsonProperty("Type") + private AccountType type; + + + @JsonProperty("Code") + private String code; + + + @JsonProperty("Name") + private String name; + + public Account accountID(UUID accountID) { + this.accountID = accountID; + return this; + } + + /** + * Xero identifier for accounts + * @return accountID + **/ + @ApiModelProperty(example = "c56b19ef-75bf-45e8-98a4-e699a96609f7", value = "Xero identifier for accounts") + public UUID getAccountID() { + return accountID; + } + + public void setAccountID(UUID accountID) { + this.accountID = accountID; + } + + public Account type(AccountType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(value = "") + public AccountType getType() { + return type; + } + + public void setType(AccountType type) { + this.type = type; + } + + public Account code(String code) { + this.code = code; + return this; + } + + /** + * Customer defined account code + * @return code + **/ + @ApiModelProperty(example = "420", value = "Customer defined account code") + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public Account name(String name) { + this.name = name; + return this; + } + + /** + * Name of account + * @return name + **/ + @ApiModelProperty(example = "General expenses", value = "Name of account") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Account account = (Account) o; + return Objects.equals(this.accountID, account.accountID) && + Objects.equals(this.type, account.type) && + Objects.equals(this.code, account.code) && + Objects.equals(this.name, account.name); + } + + @Override + public int hashCode() { + return Objects.hash(accountID, type, code, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Account {\n"); + sb.append(" accountID: ").append(toIndentedString(accountID)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/AccountType.java b/src/main/java/com/xero/models/payrollau/AccountType.java new file mode 100644 index 00000000..53678631 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/AccountType.java @@ -0,0 +1,98 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * See Account Types + */ +public enum AccountType { + + BANK("BANK"), + + CURRENT("CURRENT"), + + CURRLIAB("CURRLIAB"), + + DEPRECIATN("DEPRECIATN"), + + DIRECTCOSTS("DIRECTCOSTS"), + + EQUITY("EQUITY"), + + EXPENSE("EXPENSE"), + + FIXED("FIXED"), + + INVENTORY("INVENTORY"), + + LIABILITY("LIABILITY"), + + NONCURRENT("NONCURRENT"), + + OTHERINCOME("OTHERINCOME"), + + OVERHEADS("OVERHEADS"), + + PREPAYMENT("PREPAYMENT"), + + REVENUE("REVENUE"), + + SALES("SALES"), + + TERMLIAB("TERMLIAB"), + + PAYGLIABILITY("PAYGLIABILITY"), + + PAYG("PAYG"), + + SUPERANNUATIONEXPENSE("SUPERANNUATIONEXPENSE"), + + SUPERANNUATIONLIABILITY("SUPERANNUATIONLIABILITY"), + + WAGESEXPENSE("WAGESEXPENSE"); + + private String value; + + AccountType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static AccountType fromValue(String value) { + for (AccountType b : AccountType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/BankAccount.java b/src/main/java/com/xero/models/payrollau/BankAccount.java new file mode 100644 index 00000000..038293ad --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/BankAccount.java @@ -0,0 +1,213 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * BankAccount + */ + +public class BankAccount { + + @JsonProperty("StatementText") + private String statementText; + + + @JsonProperty("AccountName") + private String accountName; + + + @JsonProperty("BSB") + private String BSB; + + + @JsonProperty("AccountNumber") + private String accountNumber; + + + @JsonProperty("Remainder") + private Boolean remainder; + + + @JsonProperty("Amount") + private Float amount; + + public BankAccount statementText(String statementText) { + this.statementText = statementText; + return this; + } + + /** + * The text that will appear on your employee's bank statement when they receive payment + * @return statementText + **/ + @ApiModelProperty(example = "Salary", value = "The text that will appear on your employee's bank statement when they receive payment") + public String getStatementText() { + return statementText; + } + + public void setStatementText(String statementText) { + this.statementText = statementText; + } + + public BankAccount accountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * The name of the account + * @return accountName + **/ + @ApiModelProperty(example = "James Lebron Savings", value = "The name of the account") + public String getAccountName() { + return accountName; + } + + public void setAccountName(String accountName) { + this.accountName = accountName; + } + + public BankAccount BSB(String BSB) { + this.BSB = BSB; + return this; + } + + /** + * The BSB number of the account + * @return BSB + **/ + @ApiModelProperty(example = "122344", value = "The BSB number of the account") + public String getBSB() { + return BSB; + } + + public void setBSB(String BSB) { + this.BSB = BSB; + } + + public BankAccount accountNumber(String accountNumber) { + this.accountNumber = accountNumber; + return this; + } + + /** + * The account number + * @return accountNumber + **/ + @ApiModelProperty(example = "345678", value = "The account number") + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public BankAccount remainder(Boolean remainder) { + this.remainder = remainder; + return this; + } + + /** + * If this account is the Remaining bank account + * @return remainder + **/ + @ApiModelProperty(example = "false", value = "If this account is the Remaining bank account") + public Boolean getRemainder() { + return remainder; + } + + public void setRemainder(Boolean remainder) { + this.remainder = remainder; + } + + public BankAccount amount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Fixed amounts (for example, if an employee wants to have $100 of their salary transferred to one account, and the remaining amount to another) + * @return amount + **/ + @ApiModelProperty(example = "200.0", value = "Fixed amounts (for example, if an employee wants to have $100 of their salary transferred to one account, and the remaining amount to another)") + public Float getAmount() { + return amount; + } + + public void setAmount(Float amount) { + this.amount = amount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BankAccount bankAccount = (BankAccount) o; + return Objects.equals(this.statementText, bankAccount.statementText) && + Objects.equals(this.accountName, bankAccount.accountName) && + Objects.equals(this.BSB, bankAccount.BSB) && + Objects.equals(this.accountNumber, bankAccount.accountNumber) && + Objects.equals(this.remainder, bankAccount.remainder) && + Objects.equals(this.amount, bankAccount.amount); + } + + @Override + public int hashCode() { + return Objects.hash(statementText, accountName, BSB, accountNumber, remainder, amount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BankAccount {\n"); + sb.append(" statementText: ").append(toIndentedString(statementText)).append("\n"); + sb.append(" accountName: ").append(toIndentedString(accountName)).append("\n"); + sb.append(" BSB: ").append(toIndentedString(BSB)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" remainder: ").append(toIndentedString(remainder)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/CalendarType.java b/src/main/java/com/xero/models/payrollau/CalendarType.java new file mode 100644 index 00000000..03bc65ea --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/CalendarType.java @@ -0,0 +1,65 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets CalendarType + */ +public enum CalendarType { + + WEEKLY("WEEKLY"), + + FORTNIGHTLY("FORTNIGHTLY"), + + FOURWEEKLY("FOURWEEKLY"), + + MONTHLY("MONTHLY"), + + TWICEMONTHLY("TWICEMONTHLY"), + + QUARTERLY("QUARTERLY"); + + private String value; + + CalendarType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static CalendarType fromValue(String value) { + for (CalendarType b : CalendarType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/DeductionLine.java b/src/main/java/com/xero/models/payrollau/DeductionLine.java new file mode 100644 index 00000000..cf22d5d8 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/DeductionLine.java @@ -0,0 +1,143 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.DeductionTypeCalculationType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * DeductionLine + */ + +public class DeductionLine { + + @JsonProperty("DeductionTypeID") + private UUID deductionTypeID; + + + @JsonProperty("CalculationType") + private DeductionTypeCalculationType calculationType; + + + @JsonProperty("Amount") + private Float amount; + + public DeductionLine deductionTypeID(UUID deductionTypeID) { + this.deductionTypeID = deductionTypeID; + return this; + } + + /** + * Xero deduction type identifier + * @return deductionTypeID + **/ + @ApiModelProperty(example = "59cd9d04-4521-4cc3-93ac-7841651ff407", required = true, value = "Xero deduction type identifier") + public UUID getDeductionTypeID() { + return deductionTypeID; + } + + public void setDeductionTypeID(UUID deductionTypeID) { + this.deductionTypeID = deductionTypeID; + } + + public DeductionLine calculationType(DeductionTypeCalculationType calculationType) { + this.calculationType = calculationType; + return this; + } + + /** + * Get calculationType + * @return calculationType + **/ + @ApiModelProperty(required = true, value = "") + public DeductionTypeCalculationType getCalculationType() { + return calculationType; + } + + public void setCalculationType(DeductionTypeCalculationType calculationType) { + this.calculationType = calculationType; + } + + public DeductionLine amount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Deduction type amount + * @return amount + **/ + @ApiModelProperty(example = "10.0", value = "Deduction type amount") + public Float getAmount() { + return amount; + } + + public void setAmount(Float amount) { + this.amount = amount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeductionLine deductionLine = (DeductionLine) o; + return Objects.equals(this.deductionTypeID, deductionLine.deductionTypeID) && + Objects.equals(this.calculationType, deductionLine.calculationType) && + Objects.equals(this.amount, deductionLine.amount); + } + + @Override + public int hashCode() { + return Objects.hash(deductionTypeID, calculationType, amount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeductionLine {\n"); + sb.append(" deductionTypeID: ").append(toIndentedString(deductionTypeID)).append("\n"); + sb.append(" calculationType: ").append(toIndentedString(calculationType)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/DeductionType.java b/src/main/java/com/xero/models/payrollau/DeductionType.java new file mode 100644 index 00000000..5ed68c70 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/DeductionType.java @@ -0,0 +1,239 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * DeductionType + */ + +public class DeductionType { + + @JsonProperty("Name") + private String name; + + + @JsonProperty("AccountCode") + private String accountCode; + + + @JsonProperty("ReducesTax") + private Boolean reducesTax; + + + @JsonProperty("ReducesSuper") + private Boolean reducesSuper; + + + @JsonProperty("IsExemptFromW1") + private Boolean isExemptFromW1; + + + @JsonProperty("DeductionTypeID") + private UUID deductionTypeID; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + public DeductionType name(String name) { + this.name = name; + return this; + } + + /** + * Name of the earnings rate (max length = 100) + * @return name + **/ + @ApiModelProperty(example = "PTO", value = "Name of the earnings rate (max length = 100)") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public DeductionType accountCode(String accountCode) { + this.accountCode = accountCode; + return this; + } + + /** + * See Accounts + * @return accountCode + **/ + @ApiModelProperty(example = "720", value = "See Accounts") + public String getAccountCode() { + return accountCode; + } + + public void setAccountCode(String accountCode) { + this.accountCode = accountCode; + } + + public DeductionType reducesTax(Boolean reducesTax) { + this.reducesTax = reducesTax; + return this; + } + + /** + * Indicates that this is a pre-tax deduction that will reduce the amount of tax you withhold from an employee. + * @return reducesTax + **/ + @ApiModelProperty(example = "false", value = "Indicates that this is a pre-tax deduction that will reduce the amount of tax you withhold from an employee.") + public Boolean getReducesTax() { + return reducesTax; + } + + public void setReducesTax(Boolean reducesTax) { + this.reducesTax = reducesTax; + } + + public DeductionType reducesSuper(Boolean reducesSuper) { + this.reducesSuper = reducesSuper; + return this; + } + + /** + * Most deductions don’t reduce your superannuation guarantee contribution liability, so typically you will not set any value for this. + * @return reducesSuper + **/ + @ApiModelProperty(example = "false", value = "Most deductions don’t reduce your superannuation guarantee contribution liability, so typically you will not set any value for this.") + public Boolean getReducesSuper() { + return reducesSuper; + } + + public void setReducesSuper(Boolean reducesSuper) { + this.reducesSuper = reducesSuper; + } + + public DeductionType isExemptFromW1(Boolean isExemptFromW1) { + this.isExemptFromW1 = isExemptFromW1; + return this; + } + + /** + * Boolean to determine if the deduction type is reportable or exempt from W1 + * @return isExemptFromW1 + **/ + @ApiModelProperty(example = "false", value = "Boolean to determine if the deduction type is reportable or exempt from W1") + public Boolean getIsExemptFromW1() { + return isExemptFromW1; + } + + public void setIsExemptFromW1(Boolean isExemptFromW1) { + this.isExemptFromW1 = isExemptFromW1; + } + + public DeductionType deductionTypeID(UUID deductionTypeID) { + this.deductionTypeID = deductionTypeID; + return this; + } + + /** + * Xero identifier + * @return deductionTypeID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier") + public UUID getDeductionTypeID() { + return deductionTypeID; + } + + public void setDeductionTypeID(UUID deductionTypeID) { + this.deductionTypeID = deductionTypeID; + } + + public DeductionType updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * Last modified timestamp + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Last modified timestamp") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeductionType deductionType = (DeductionType) o; + return Objects.equals(this.name, deductionType.name) && + Objects.equals(this.accountCode, deductionType.accountCode) && + Objects.equals(this.reducesTax, deductionType.reducesTax) && + Objects.equals(this.reducesSuper, deductionType.reducesSuper) && + Objects.equals(this.isExemptFromW1, deductionType.isExemptFromW1) && + Objects.equals(this.deductionTypeID, deductionType.deductionTypeID) && + Objects.equals(this.updatedDateUTC, deductionType.updatedDateUTC); + } + + @Override + public int hashCode() { + return Objects.hash(name, accountCode, reducesTax, reducesSuper, isExemptFromW1, deductionTypeID, updatedDateUTC); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeductionType {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" accountCode: ").append(toIndentedString(accountCode)).append("\n"); + sb.append(" reducesTax: ").append(toIndentedString(reducesTax)).append("\n"); + sb.append(" reducesSuper: ").append(toIndentedString(reducesSuper)).append("\n"); + sb.append(" isExemptFromW1: ").append(toIndentedString(isExemptFromW1)).append("\n"); + sb.append(" deductionTypeID: ").append(toIndentedString(deductionTypeID)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/DeductionTypeCalculationType.java b/src/main/java/com/xero/models/payrollau/DeductionTypeCalculationType.java new file mode 100644 index 00000000..78394295 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/DeductionTypeCalculationType.java @@ -0,0 +1,59 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets DeductionTypeCalculationType + */ +public enum DeductionTypeCalculationType { + + FIXEDAMOUNT("FIXEDAMOUNT"), + + PRETAX("PRETAX"), + + POSTTAX("POSTTAX"); + + private String value; + + DeductionTypeCalculationType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static DeductionTypeCalculationType fromValue(String value) { + for (DeductionTypeCalculationType b : DeductionTypeCalculationType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/EarningsLine.java b/src/main/java/com/xero/models/payrollau/EarningsLine.java new file mode 100644 index 00000000..404cd2c4 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/EarningsLine.java @@ -0,0 +1,239 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.EarningsRateCalculationType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * EarningsLine + */ + +public class EarningsLine { + + @JsonProperty("EarningsRateID") + private UUID earningsRateID; + + + @JsonProperty("CalculationType") + private EarningsRateCalculationType calculationType; + + + @JsonProperty("AnnualSalary") + private Float annualSalary; + + + @JsonProperty("NumberOfUnitsPerWeek") + private Float numberOfUnitsPerWeek; + + + @JsonProperty("RatePerUnit") + private Float ratePerUnit; + + + @JsonProperty("NormalNumberOfUnits") + private Float normalNumberOfUnits; + + + @JsonProperty("Amount") + private Float amount; + + public EarningsLine earningsRateID(UUID earningsRateID) { + this.earningsRateID = earningsRateID; + return this; + } + + /** + * Xero unique id for earnings rate + * @return earningsRateID + **/ + @ApiModelProperty(example = "72e962d1-fcac-4083-8a71-742bb3e7ae14", required = true, value = "Xero unique id for earnings rate") + public UUID getEarningsRateID() { + return earningsRateID; + } + + public void setEarningsRateID(UUID earningsRateID) { + this.earningsRateID = earningsRateID; + } + + public EarningsLine calculationType(EarningsRateCalculationType calculationType) { + this.calculationType = calculationType; + return this; + } + + /** + * Get calculationType + * @return calculationType + **/ + @ApiModelProperty(required = true, value = "") + public EarningsRateCalculationType getCalculationType() { + return calculationType; + } + + public void setCalculationType(EarningsRateCalculationType calculationType) { + this.calculationType = calculationType; + } + + public EarningsLine annualSalary(Float annualSalary) { + this.annualSalary = annualSalary; + return this; + } + + /** + * Annual salary for earnings line + * @return annualSalary + **/ + @ApiModelProperty(example = "40000.0", value = "Annual salary for earnings line") + public Float getAnnualSalary() { + return annualSalary; + } + + public void setAnnualSalary(Float annualSalary) { + this.annualSalary = annualSalary; + } + + public EarningsLine numberOfUnitsPerWeek(Float numberOfUnitsPerWeek) { + this.numberOfUnitsPerWeek = numberOfUnitsPerWeek; + return this; + } + + /** + * number of units for earning line + * @return numberOfUnitsPerWeek + **/ + @ApiModelProperty(example = "38.0", value = "number of units for earning line") + public Float getNumberOfUnitsPerWeek() { + return numberOfUnitsPerWeek; + } + + public void setNumberOfUnitsPerWeek(Float numberOfUnitsPerWeek) { + this.numberOfUnitsPerWeek = numberOfUnitsPerWeek; + } + + public EarningsLine ratePerUnit(Float ratePerUnit) { + this.ratePerUnit = ratePerUnit; + return this; + } + + /** + * Rate per unit of the EarningsLine. + * @return ratePerUnit + **/ + @ApiModelProperty(example = "38.0", value = "Rate per unit of the EarningsLine.") + public Float getRatePerUnit() { + return ratePerUnit; + } + + public void setRatePerUnit(Float ratePerUnit) { + this.ratePerUnit = ratePerUnit; + } + + public EarningsLine normalNumberOfUnits(Float normalNumberOfUnits) { + this.normalNumberOfUnits = normalNumberOfUnits; + return this; + } + + /** + * Normal number of units for EarningsLine. Applicable when RateType is \"MULTIPLE\" + * @return normalNumberOfUnits + **/ + @ApiModelProperty(example = "38.0", value = "Normal number of units for EarningsLine. Applicable when RateType is \"MULTIPLE\"") + public Float getNormalNumberOfUnits() { + return normalNumberOfUnits; + } + + public void setNormalNumberOfUnits(Float normalNumberOfUnits) { + this.normalNumberOfUnits = normalNumberOfUnits; + } + + public EarningsLine amount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Earnings rate amount + * @return amount + **/ + @ApiModelProperty(example = "38.0", value = "Earnings rate amount") + public Float getAmount() { + return amount; + } + + public void setAmount(Float amount) { + this.amount = amount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EarningsLine earningsLine = (EarningsLine) o; + return Objects.equals(this.earningsRateID, earningsLine.earningsRateID) && + Objects.equals(this.calculationType, earningsLine.calculationType) && + Objects.equals(this.annualSalary, earningsLine.annualSalary) && + Objects.equals(this.numberOfUnitsPerWeek, earningsLine.numberOfUnitsPerWeek) && + Objects.equals(this.ratePerUnit, earningsLine.ratePerUnit) && + Objects.equals(this.normalNumberOfUnits, earningsLine.normalNumberOfUnits) && + Objects.equals(this.amount, earningsLine.amount); + } + + @Override + public int hashCode() { + return Objects.hash(earningsRateID, calculationType, annualSalary, numberOfUnitsPerWeek, ratePerUnit, normalNumberOfUnits, amount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EarningsLine {\n"); + sb.append(" earningsRateID: ").append(toIndentedString(earningsRateID)).append("\n"); + sb.append(" calculationType: ").append(toIndentedString(calculationType)).append("\n"); + sb.append(" annualSalary: ").append(toIndentedString(annualSalary)).append("\n"); + sb.append(" numberOfUnitsPerWeek: ").append(toIndentedString(numberOfUnitsPerWeek)).append("\n"); + sb.append(" ratePerUnit: ").append(toIndentedString(ratePerUnit)).append("\n"); + sb.append(" normalNumberOfUnits: ").append(toIndentedString(normalNumberOfUnits)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/EarningsRate.java b/src/main/java/com/xero/models/payrollau/EarningsRate.java new file mode 100644 index 00000000..ab4f3600 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/EarningsRate.java @@ -0,0 +1,434 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.EarningsType; +import com.xero.models.payrollau.EmploymentTerminationPaymentType; +import com.xero.models.payrollau.RateType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * EarningsRate + */ + +public class EarningsRate { + + @JsonProperty("Name") + private String name; + + + @JsonProperty("AccountCode") + private String accountCode; + + + @JsonProperty("TypeOfUnits") + private String typeOfUnits; + + + @JsonProperty("IsExemptFromTax") + private Boolean isExemptFromTax; + + + @JsonProperty("IsExemptFromSuper") + private Boolean isExemptFromSuper; + + + @JsonProperty("IsReportableAsW1") + private Boolean isReportableAsW1; + + + @JsonProperty("EarningsType") + private EarningsType earningsType; + + + @JsonProperty("EarningsRateID") + private UUID earningsRateID; + + + @JsonProperty("RateType") + private RateType rateType; + + + @JsonProperty("RatePerUnit") + private String ratePerUnit; + + + @JsonProperty("Multiplier") + private Float multiplier; + + + @JsonProperty("AccrueLeave") + private Float accrueLeave; + + + @JsonProperty("Amount") + private Float amount; + + + @JsonProperty("EmploymentTerminationPaymentType") + private EmploymentTerminationPaymentType employmentTerminationPaymentType; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + public EarningsRate name(String name) { + this.name = name; + return this; + } + + /** + * Name of the earnings rate (max length = 100) + * @return name + **/ + @ApiModelProperty(example = "PTO", value = "Name of the earnings rate (max length = 100)") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public EarningsRate accountCode(String accountCode) { + this.accountCode = accountCode; + return this; + } + + /** + * See Accounts + * @return accountCode + **/ + @ApiModelProperty(example = "720", value = "See Accounts") + public String getAccountCode() { + return accountCode; + } + + public void setAccountCode(String accountCode) { + this.accountCode = accountCode; + } + + public EarningsRate typeOfUnits(String typeOfUnits) { + this.typeOfUnits = typeOfUnits; + return this; + } + + /** + * Type of units used to record earnings (max length = 50). Only When RateType is RATEPERUNIT + * @return typeOfUnits + **/ + @ApiModelProperty(example = "Fixed", value = "Type of units used to record earnings (max length = 50). Only When RateType is RATEPERUNIT") + public String getTypeOfUnits() { + return typeOfUnits; + } + + public void setTypeOfUnits(String typeOfUnits) { + this.typeOfUnits = typeOfUnits; + } + + public EarningsRate isExemptFromTax(Boolean isExemptFromTax) { + this.isExemptFromTax = isExemptFromTax; + return this; + } + + /** + * Most payments are subject to tax, so you should only set this value if you are sure that a payment is exempt from PAYG withholding + * @return isExemptFromTax + **/ + @ApiModelProperty(example = "false", value = "Most payments are subject to tax, so you should only set this value if you are sure that a payment is exempt from PAYG withholding") + public Boolean getIsExemptFromTax() { + return isExemptFromTax; + } + + public void setIsExemptFromTax(Boolean isExemptFromTax) { + this.isExemptFromTax = isExemptFromTax; + } + + public EarningsRate isExemptFromSuper(Boolean isExemptFromSuper) { + this.isExemptFromSuper = isExemptFromSuper; + return this; + } + + /** + * See the ATO website for details of which payments are exempt from SGC + * @return isExemptFromSuper + **/ + @ApiModelProperty(example = "false", value = "See the ATO website for details of which payments are exempt from SGC") + public Boolean getIsExemptFromSuper() { + return isExemptFromSuper; + } + + public void setIsExemptFromSuper(Boolean isExemptFromSuper) { + this.isExemptFromSuper = isExemptFromSuper; + } + + public EarningsRate isReportableAsW1(Boolean isReportableAsW1) { + this.isReportableAsW1 = isReportableAsW1; + return this; + } + + /** + * Boolean to determine if the earnings rate is reportable or exempt from W1 + * @return isReportableAsW1 + **/ + @ApiModelProperty(example = "false", value = "Boolean to determine if the earnings rate is reportable or exempt from W1") + public Boolean getIsReportableAsW1() { + return isReportableAsW1; + } + + public void setIsReportableAsW1(Boolean isReportableAsW1) { + this.isReportableAsW1 = isReportableAsW1; + } + + public EarningsRate earningsType(EarningsType earningsType) { + this.earningsType = earningsType; + return this; + } + + /** + * Get earningsType + * @return earningsType + **/ + @ApiModelProperty(value = "") + public EarningsType getEarningsType() { + return earningsType; + } + + public void setEarningsType(EarningsType earningsType) { + this.earningsType = earningsType; + } + + public EarningsRate earningsRateID(UUID earningsRateID) { + this.earningsRateID = earningsRateID; + return this; + } + + /** + * Xero identifier + * @return earningsRateID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier") + public UUID getEarningsRateID() { + return earningsRateID; + } + + public void setEarningsRateID(UUID earningsRateID) { + this.earningsRateID = earningsRateID; + } + + public EarningsRate rateType(RateType rateType) { + this.rateType = rateType; + return this; + } + + /** + * Get rateType + * @return rateType + **/ + @ApiModelProperty(value = "") + public RateType getRateType() { + return rateType; + } + + public void setRateType(RateType rateType) { + this.rateType = rateType; + } + + public EarningsRate ratePerUnit(String ratePerUnit) { + this.ratePerUnit = ratePerUnit; + return this; + } + + /** + * Default rate per unit (optional). Only applicable if RateType is RATEPERUNIT. + * @return ratePerUnit + **/ + @ApiModelProperty(example = "10", value = "Default rate per unit (optional). Only applicable if RateType is RATEPERUNIT.") + public String getRatePerUnit() { + return ratePerUnit; + } + + public void setRatePerUnit(String ratePerUnit) { + this.ratePerUnit = ratePerUnit; + } + + public EarningsRate multiplier(Float multiplier) { + this.multiplier = multiplier; + return this; + } + + /** + * This is the multiplier used to calculate the rate per unit, based on the employee’s ordinary earnings rate. For example, for time and a half enter 1.5. Only applicable if RateType is MULTIPLE + * @return multiplier + **/ + @ApiModelProperty(example = "1.5", value = "This is the multiplier used to calculate the rate per unit, based on the employee’s ordinary earnings rate. For example, for time and a half enter 1.5. Only applicable if RateType is MULTIPLE") + public Float getMultiplier() { + return multiplier; + } + + public void setMultiplier(Float multiplier) { + this.multiplier = multiplier; + } + + public EarningsRate accrueLeave(Float accrueLeave) { + this.accrueLeave = accrueLeave; + return this; + } + + /** + * Indicates that this earnings rate should accrue leave. Only applicable if RateType is MULTIPLE + * @return accrueLeave + **/ + @ApiModelProperty(example = "1.5", value = "Indicates that this earnings rate should accrue leave. Only applicable if RateType is MULTIPLE") + public Float getAccrueLeave() { + return accrueLeave; + } + + public void setAccrueLeave(Float accrueLeave) { + this.accrueLeave = accrueLeave; + } + + public EarningsRate amount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Optional Amount for FIXEDAMOUNT RateType EarningsRate + * @return amount + **/ + @ApiModelProperty(example = "50.3", value = "Optional Amount for FIXEDAMOUNT RateType EarningsRate") + public Float getAmount() { + return amount; + } + + public void setAmount(Float amount) { + this.amount = amount; + } + + public EarningsRate employmentTerminationPaymentType(EmploymentTerminationPaymentType employmentTerminationPaymentType) { + this.employmentTerminationPaymentType = employmentTerminationPaymentType; + return this; + } + + /** + * Get employmentTerminationPaymentType + * @return employmentTerminationPaymentType + **/ + @ApiModelProperty(value = "") + public EmploymentTerminationPaymentType getEmploymentTerminationPaymentType() { + return employmentTerminationPaymentType; + } + + public void setEmploymentTerminationPaymentType(EmploymentTerminationPaymentType employmentTerminationPaymentType) { + this.employmentTerminationPaymentType = employmentTerminationPaymentType; + } + + public EarningsRate updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * Last modified timestamp + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Last modified timestamp") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EarningsRate earningsRate = (EarningsRate) o; + return Objects.equals(this.name, earningsRate.name) && + Objects.equals(this.accountCode, earningsRate.accountCode) && + Objects.equals(this.typeOfUnits, earningsRate.typeOfUnits) && + Objects.equals(this.isExemptFromTax, earningsRate.isExemptFromTax) && + Objects.equals(this.isExemptFromSuper, earningsRate.isExemptFromSuper) && + Objects.equals(this.isReportableAsW1, earningsRate.isReportableAsW1) && + Objects.equals(this.earningsType, earningsRate.earningsType) && + Objects.equals(this.earningsRateID, earningsRate.earningsRateID) && + Objects.equals(this.rateType, earningsRate.rateType) && + Objects.equals(this.ratePerUnit, earningsRate.ratePerUnit) && + Objects.equals(this.multiplier, earningsRate.multiplier) && + Objects.equals(this.accrueLeave, earningsRate.accrueLeave) && + Objects.equals(this.amount, earningsRate.amount) && + Objects.equals(this.employmentTerminationPaymentType, earningsRate.employmentTerminationPaymentType) && + Objects.equals(this.updatedDateUTC, earningsRate.updatedDateUTC); + } + + @Override + public int hashCode() { + return Objects.hash(name, accountCode, typeOfUnits, isExemptFromTax, isExemptFromSuper, isReportableAsW1, earningsType, earningsRateID, rateType, ratePerUnit, multiplier, accrueLeave, amount, employmentTerminationPaymentType, updatedDateUTC); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EarningsRate {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" accountCode: ").append(toIndentedString(accountCode)).append("\n"); + sb.append(" typeOfUnits: ").append(toIndentedString(typeOfUnits)).append("\n"); + sb.append(" isExemptFromTax: ").append(toIndentedString(isExemptFromTax)).append("\n"); + sb.append(" isExemptFromSuper: ").append(toIndentedString(isExemptFromSuper)).append("\n"); + sb.append(" isReportableAsW1: ").append(toIndentedString(isReportableAsW1)).append("\n"); + sb.append(" earningsType: ").append(toIndentedString(earningsType)).append("\n"); + sb.append(" earningsRateID: ").append(toIndentedString(earningsRateID)).append("\n"); + sb.append(" rateType: ").append(toIndentedString(rateType)).append("\n"); + sb.append(" ratePerUnit: ").append(toIndentedString(ratePerUnit)).append("\n"); + sb.append(" multiplier: ").append(toIndentedString(multiplier)).append("\n"); + sb.append(" accrueLeave: ").append(toIndentedString(accrueLeave)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" employmentTerminationPaymentType: ").append(toIndentedString(employmentTerminationPaymentType)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/EarningsRateCalculationType.java b/src/main/java/com/xero/models/payrollau/EarningsRateCalculationType.java new file mode 100644 index 00000000..cab58a95 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/EarningsRateCalculationType.java @@ -0,0 +1,59 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EarningsRateCalculationType + */ +public enum EarningsRateCalculationType { + + USEEARNINGSRATE("USEEARNINGSRATE"), + + ENTEREARNINGSRATE("ENTEREARNINGSRATE"), + + ANNUALSALARY("ANNUALSALARY"); + + private String value; + + EarningsRateCalculationType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EarningsRateCalculationType fromValue(String value) { + for (EarningsRateCalculationType b : EarningsRateCalculationType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/EarningsType.java b/src/main/java/com/xero/models/payrollau/EarningsType.java new file mode 100644 index 00000000..a133c751 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/EarningsType.java @@ -0,0 +1,65 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EarningsType + */ +public enum EarningsType { + + FIXED("FIXED"), + + ORDINARYTIMEEARNINGS("ORDINARYTIMEEARNINGS"), + + OVERTIMEEARNINGS("OVERTIMEEARNINGS"), + + ALLOWANCE("ALLOWANCE"), + + LUMPSUMD("LUMPSUMD"), + + EMPLOYMENTTERMINATIONPAYMENT("EMPLOYMENTTERMINATIONPAYMENT"); + + private String value; + + EarningsType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EarningsType fromValue(String value) { + for (EarningsType b : EarningsType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/Employee.java b/src/main/java/com/xero/models/payrollau/Employee.java new file mode 100644 index 00000000..db3937c3 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/Employee.java @@ -0,0 +1,816 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.BankAccount; +import com.xero.models.payrollau.EmployeeStatus; +import com.xero.models.payrollau.HomeAddress; +import com.xero.models.payrollau.LeaveBalance; +import com.xero.models.payrollau.OpeningBalances; +import com.xero.models.payrollau.PayTemplate; +import com.xero.models.payrollau.SuperMembership; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Employee + */ + +public class Employee { + + @JsonProperty("FirstName") + private String firstName; + + + @JsonProperty("LastName") + private String lastName; + + + @JsonProperty("DateOfBirth") + private String dateOfBirth; + + + @JsonProperty("HomeAddress") + private HomeAddress homeAddress = null; + + + @JsonProperty("StartDate") + private String startDate; + + + @JsonProperty("Title") + private String title; + + + @JsonProperty("MiddleNames") + private String middleNames; + + + @JsonProperty("Email") + private String email; + + /** + * The employee’s gender. See Employee Gender + */ + public enum GenderEnum { + N("N"), + + M("M"), + + F("F"), + + I("I"); + + private String value; + + GenderEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static GenderEnum fromValue(String value) { + for (GenderEnum b : GenderEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + + @JsonProperty("Gender") + private GenderEnum gender; + + + @JsonProperty("Phone") + private String phone; + + + @JsonProperty("Mobile") + private String mobile; + + + @JsonProperty("TwitterUserName") + private String twitterUserName; + + + @JsonProperty("IsAuthorisedToApproveLeave") + private Boolean isAuthorisedToApproveLeave; + + + @JsonProperty("IsAuthorisedToApproveTimesheets") + private Boolean isAuthorisedToApproveTimesheets; + + + @JsonProperty("JobTitle") + private String jobTitle; + + + @JsonProperty("Classification") + private String classification; + + + @JsonProperty("OrdinaryEarningsRateID") + private UUID ordinaryEarningsRateID; + + + @JsonProperty("PayrollCalendarID") + private UUID payrollCalendarID; + + + @JsonProperty("EmployeeGroupName") + private String employeeGroupName; + + + @JsonProperty("EmployeeID") + private UUID employeeID; + + @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("TerminationDate") + private LocalDate terminationDate; + + + @JsonProperty("BankAccounts") + private List bankAccounts = new ArrayList(); + + + @JsonProperty("PayTemplate") + private PayTemplate payTemplate = null; + + + @JsonProperty("OpeningBalances") + private OpeningBalances openingBalances = null; + + + @JsonProperty("LeaveBalances") + private List leaveBalances = new ArrayList(); + + + @JsonProperty("SuperMemberships") + private List superMemberships = new ArrayList(); + + + @JsonProperty("Status") + private EmployeeStatus status; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + public Employee firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * First name of employee + * @return firstName + **/ + @ApiModelProperty(example = "Karen", required = true, value = "First name of employee") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public Employee lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Last name of employee + * @return lastName + **/ + @ApiModelProperty(example = "Jones", required = true, value = "Last name of employee") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public Employee dateOfBirth(String dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Date of birth of the employee (YYYY-MM-DD) + * @return dateOfBirth + **/ + @ApiModelProperty(example = "/Date(322560000000+0000)/", required = true, value = "Date of birth of the employee (YYYY-MM-DD)") + public String getDateOfBirth() { + return dateOfBirth; + } + + public void setDateOfBirth(String dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + public Employee homeAddress(HomeAddress homeAddress) { + this.homeAddress = homeAddress; + return this; + } + + /** + * Get homeAddress + * @return homeAddress + **/ + @ApiModelProperty(required = true, value = "") + public HomeAddress getHomeAddress() { + return homeAddress; + } + + public void setHomeAddress(HomeAddress homeAddress) { + this.homeAddress = homeAddress; + } + + public Employee startDate(String startDate) { + this.startDate = startDate; + return this; + } + + /** + * Start date for an employee (YYYY-MM-DD) + * @return startDate + **/ + @ApiModelProperty(example = "/Date(320284900000+0000)/", value = "Start date for an employee (YYYY-MM-DD)") + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public Employee title(String title) { + this.title = title; + return this; + } + + /** + * Title of the employee + * @return title + **/ + @ApiModelProperty(example = "Mrs", value = "Title of the employee") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Employee middleNames(String middleNames) { + this.middleNames = middleNames; + return this; + } + + /** + * Middle name(s) of the employee + * @return middleNames + **/ + @ApiModelProperty(example = "Adena", value = "Middle name(s) of the employee") + public String getMiddleNames() { + return middleNames; + } + + public void setMiddleNames(String middleNames) { + this.middleNames = middleNames; + } + + public Employee email(String email) { + this.email = email; + return this; + } + + /** + * The email address for the employee + * @return email + **/ + @ApiModelProperty(example = "developer@me.com", value = "The email address for the employee") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Employee gender(GenderEnum gender) { + this.gender = gender; + return this; + } + + /** + * The employee’s gender. See Employee Gender + * @return gender + **/ + @ApiModelProperty(example = "F", value = "The employee’s gender. See Employee Gender") + public GenderEnum getGender() { + return gender; + } + + public void setGender(GenderEnum gender) { + this.gender = gender; + } + + public Employee phone(String phone) { + this.phone = phone; + return this; + } + + /** + * Employee phone number + * @return phone + **/ + @ApiModelProperty(example = "415-555-1212", value = "Employee phone number") + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Employee mobile(String mobile) { + this.mobile = mobile; + return this; + } + + /** + * Employee mobile number + * @return mobile + **/ + @ApiModelProperty(example = "415-234-5678", value = "Employee mobile number") + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public Employee twitterUserName(String twitterUserName) { + this.twitterUserName = twitterUserName; + return this; + } + + /** + * Employee’s twitter name + * @return twitterUserName + **/ + @ApiModelProperty(example = "xeroapi", value = "Employee’s twitter name") + public String getTwitterUserName() { + return twitterUserName; + } + + public void setTwitterUserName(String twitterUserName) { + this.twitterUserName = twitterUserName; + } + + public Employee isAuthorisedToApproveLeave(Boolean isAuthorisedToApproveLeave) { + this.isAuthorisedToApproveLeave = isAuthorisedToApproveLeave; + return this; + } + + /** + * Authorised to approve other employees' leave requests + * @return isAuthorisedToApproveLeave + **/ + @ApiModelProperty(example = "false", value = "Authorised to approve other employees' leave requests") + public Boolean getIsAuthorisedToApproveLeave() { + return isAuthorisedToApproveLeave; + } + + public void setIsAuthorisedToApproveLeave(Boolean isAuthorisedToApproveLeave) { + this.isAuthorisedToApproveLeave = isAuthorisedToApproveLeave; + } + + public Employee isAuthorisedToApproveTimesheets(Boolean isAuthorisedToApproveTimesheets) { + this.isAuthorisedToApproveTimesheets = isAuthorisedToApproveTimesheets; + return this; + } + + /** + * Authorised to approve timesheets + * @return isAuthorisedToApproveTimesheets + **/ + @ApiModelProperty(example = "true", value = "Authorised to approve timesheets") + public Boolean getIsAuthorisedToApproveTimesheets() { + return isAuthorisedToApproveTimesheets; + } + + public void setIsAuthorisedToApproveTimesheets(Boolean isAuthorisedToApproveTimesheets) { + this.isAuthorisedToApproveTimesheets = isAuthorisedToApproveTimesheets; + } + + public Employee jobTitle(String jobTitle) { + this.jobTitle = jobTitle; + return this; + } + + /** + * JobTitle of the employee + * @return jobTitle + **/ + @ApiModelProperty(example = "Manager", value = "JobTitle of the employee") + public String getJobTitle() { + return jobTitle; + } + + public void setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + } + + public Employee classification(String classification) { + this.classification = classification; + return this; + } + + /** + * Employees classification + * @return classification + **/ + @ApiModelProperty(example = "99383", value = "Employees classification") + public String getClassification() { + return classification; + } + + public void setClassification(String classification) { + this.classification = classification; + } + + public Employee ordinaryEarningsRateID(UUID ordinaryEarningsRateID) { + this.ordinaryEarningsRateID = ordinaryEarningsRateID; + return this; + } + + /** + * Xero unique identifier for earnings rate + * @return ordinaryEarningsRateID + **/ + @ApiModelProperty(value = "Xero unique identifier for earnings rate") + public UUID getOrdinaryEarningsRateID() { + return ordinaryEarningsRateID; + } + + public void setOrdinaryEarningsRateID(UUID ordinaryEarningsRateID) { + this.ordinaryEarningsRateID = ordinaryEarningsRateID; + } + + public Employee payrollCalendarID(UUID payrollCalendarID) { + this.payrollCalendarID = payrollCalendarID; + return this; + } + + /** + * Xero unique identifier for payroll calendar for the employee + * @return payrollCalendarID + **/ + @ApiModelProperty(example = "2ee8e5cc-9835-40d5-bb18-09fdb118db9c", value = "Xero unique identifier for payroll calendar for the employee") + public UUID getPayrollCalendarID() { + return payrollCalendarID; + } + + public void setPayrollCalendarID(UUID payrollCalendarID) { + this.payrollCalendarID = payrollCalendarID; + } + + public Employee employeeGroupName(String employeeGroupName) { + this.employeeGroupName = employeeGroupName; + return this; + } + + /** + * The Employee Group allows you to report on payroll expenses and liabilities for each group of employees + * @return employeeGroupName + **/ + @ApiModelProperty(example = "marketing", value = "The Employee Group allows you to report on payroll expenses and liabilities for each group of employees") + public String getEmployeeGroupName() { + return employeeGroupName; + } + + public void setEmployeeGroupName(String employeeGroupName) { + this.employeeGroupName = employeeGroupName; + } + + public Employee employeeID(UUID employeeID) { + this.employeeID = employeeID; + return this; + } + + /** + * Xero unique identifier for an Employee + * @return employeeID + **/ + @ApiModelProperty(example = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c", value = "Xero unique identifier for an Employee") + public UUID getEmployeeID() { + return employeeID; + } + + public void setEmployeeID(UUID employeeID) { + this.employeeID = employeeID; + } + + public Employee terminationDate(LocalDate terminationDate) { + this.terminationDate = terminationDate; + return this; + } + + /** + * Employee Termination Date (YYYY-MM-DD) + * @return terminationDate + **/ + @ApiModelProperty(value = "Employee Termination Date (YYYY-MM-DD)") + public LocalDate getTerminationDate() { + return terminationDate; + } + + public void setTerminationDate(LocalDate terminationDate) { + this.terminationDate = terminationDate; + } + + public Employee bankAccounts(List bankAccounts) { + this.bankAccounts = bankAccounts; + return this; + } + + public Employee addBankAccountsItem(BankAccount bankAccountsItem) { + if (this.bankAccounts == null) { + this.bankAccounts = new ArrayList(); + } + this.bankAccounts.add(bankAccountsItem); + return this; + } + + /** + * Get bankAccounts + * @return bankAccounts + **/ + @ApiModelProperty(value = "") + public List getBankAccounts() { + return bankAccounts; + } + + public void setBankAccounts(List bankAccounts) { + this.bankAccounts = bankAccounts; + } + + public Employee payTemplate(PayTemplate payTemplate) { + this.payTemplate = payTemplate; + return this; + } + + /** + * Get payTemplate + * @return payTemplate + **/ + @ApiModelProperty(value = "") + public PayTemplate getPayTemplate() { + return payTemplate; + } + + public void setPayTemplate(PayTemplate payTemplate) { + this.payTemplate = payTemplate; + } + + public Employee openingBalances(OpeningBalances openingBalances) { + this.openingBalances = openingBalances; + return this; + } + + /** + * Get openingBalances + * @return openingBalances + **/ + @ApiModelProperty(value = "") + public OpeningBalances getOpeningBalances() { + return openingBalances; + } + + public void setOpeningBalances(OpeningBalances openingBalances) { + this.openingBalances = openingBalances; + } + + public Employee leaveBalances(List leaveBalances) { + this.leaveBalances = leaveBalances; + return this; + } + + public Employee addLeaveBalancesItem(LeaveBalance leaveBalancesItem) { + if (this.leaveBalances == null) { + this.leaveBalances = new ArrayList(); + } + this.leaveBalances.add(leaveBalancesItem); + return this; + } + + /** + * Get leaveBalances + * @return leaveBalances + **/ + @ApiModelProperty(value = "") + public List getLeaveBalances() { + return leaveBalances; + } + + public void setLeaveBalances(List leaveBalances) { + this.leaveBalances = leaveBalances; + } + + public Employee superMemberships(List superMemberships) { + this.superMemberships = superMemberships; + return this; + } + + public Employee addSuperMembershipsItem(SuperMembership superMembershipsItem) { + if (this.superMemberships == null) { + this.superMemberships = new ArrayList(); + } + this.superMemberships.add(superMembershipsItem); + return this; + } + + /** + * Get superMemberships + * @return superMemberships + **/ + @ApiModelProperty(value = "") + public List getSuperMemberships() { + return superMemberships; + } + + public void setSuperMemberships(List superMemberships) { + this.superMemberships = superMemberships; + } + + public Employee status(EmployeeStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(value = "") + public EmployeeStatus getStatus() { + return status; + } + + public void setStatus(EmployeeStatus status) { + this.status = status; + } + + public Employee updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * Last modified timestamp + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Last modified timestamp") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Employee employee = (Employee) o; + return Objects.equals(this.firstName, employee.firstName) && + Objects.equals(this.lastName, employee.lastName) && + Objects.equals(this.dateOfBirth, employee.dateOfBirth) && + Objects.equals(this.homeAddress, employee.homeAddress) && + Objects.equals(this.startDate, employee.startDate) && + Objects.equals(this.title, employee.title) && + Objects.equals(this.middleNames, employee.middleNames) && + Objects.equals(this.email, employee.email) && + Objects.equals(this.gender, employee.gender) && + Objects.equals(this.phone, employee.phone) && + Objects.equals(this.mobile, employee.mobile) && + Objects.equals(this.twitterUserName, employee.twitterUserName) && + Objects.equals(this.isAuthorisedToApproveLeave, employee.isAuthorisedToApproveLeave) && + Objects.equals(this.isAuthorisedToApproveTimesheets, employee.isAuthorisedToApproveTimesheets) && + Objects.equals(this.jobTitle, employee.jobTitle) && + Objects.equals(this.classification, employee.classification) && + Objects.equals(this.ordinaryEarningsRateID, employee.ordinaryEarningsRateID) && + Objects.equals(this.payrollCalendarID, employee.payrollCalendarID) && + Objects.equals(this.employeeGroupName, employee.employeeGroupName) && + Objects.equals(this.employeeID, employee.employeeID) && + Objects.equals(this.terminationDate, employee.terminationDate) && + Objects.equals(this.bankAccounts, employee.bankAccounts) && + Objects.equals(this.payTemplate, employee.payTemplate) && + Objects.equals(this.openingBalances, employee.openingBalances) && + Objects.equals(this.leaveBalances, employee.leaveBalances) && + Objects.equals(this.superMemberships, employee.superMemberships) && + Objects.equals(this.status, employee.status) && + Objects.equals(this.updatedDateUTC, employee.updatedDateUTC); + } + + @Override + public int hashCode() { + return Objects.hash(firstName, lastName, dateOfBirth, homeAddress, startDate, title, middleNames, email, gender, phone, mobile, twitterUserName, isAuthorisedToApproveLeave, isAuthorisedToApproveTimesheets, jobTitle, classification, ordinaryEarningsRateID, payrollCalendarID, employeeGroupName, employeeID, terminationDate, bankAccounts, payTemplate, openingBalances, leaveBalances, superMemberships, status, updatedDateUTC); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Employee {\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" homeAddress: ").append(toIndentedString(homeAddress)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" middleNames: ").append(toIndentedString(middleNames)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" gender: ").append(toIndentedString(gender)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" mobile: ").append(toIndentedString(mobile)).append("\n"); + sb.append(" twitterUserName: ").append(toIndentedString(twitterUserName)).append("\n"); + sb.append(" isAuthorisedToApproveLeave: ").append(toIndentedString(isAuthorisedToApproveLeave)).append("\n"); + sb.append(" isAuthorisedToApproveTimesheets: ").append(toIndentedString(isAuthorisedToApproveTimesheets)).append("\n"); + sb.append(" jobTitle: ").append(toIndentedString(jobTitle)).append("\n"); + sb.append(" classification: ").append(toIndentedString(classification)).append("\n"); + sb.append(" ordinaryEarningsRateID: ").append(toIndentedString(ordinaryEarningsRateID)).append("\n"); + sb.append(" payrollCalendarID: ").append(toIndentedString(payrollCalendarID)).append("\n"); + sb.append(" employeeGroupName: ").append(toIndentedString(employeeGroupName)).append("\n"); + sb.append(" employeeID: ").append(toIndentedString(employeeID)).append("\n"); + sb.append(" terminationDate: ").append(toIndentedString(terminationDate)).append("\n"); + sb.append(" bankAccounts: ").append(toIndentedString(bankAccounts)).append("\n"); + sb.append(" payTemplate: ").append(toIndentedString(payTemplate)).append("\n"); + sb.append(" openingBalances: ").append(toIndentedString(openingBalances)).append("\n"); + sb.append(" leaveBalances: ").append(toIndentedString(leaveBalances)).append("\n"); + sb.append(" superMemberships: ").append(toIndentedString(superMemberships)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/EmployeeStatus.java b/src/main/java/com/xero/models/payrollau/EmployeeStatus.java new file mode 100644 index 00000000..a3d0c4a2 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/EmployeeStatus.java @@ -0,0 +1,58 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Employee Status Types + */ +public enum EmployeeStatus { + + ACTIVE("ACTIVE"), + + TERMINATED("TERMINATED"); + + private String value; + + EmployeeStatus(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EmployeeStatus fromValue(String value) { + for (EmployeeStatus b : EmployeeStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/Employees.java b/src/main/java/com/xero/models/payrollau/Employees.java new file mode 100644 index 00000000..f506b11e --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/Employees.java @@ -0,0 +1,104 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.Employee; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Employees + */ + +public class Employees { + + @JsonProperty("Employees") + private List employees = new ArrayList(); + + public Employees employees(List employees) { + this.employees = employees; + return this; + } + + public Employees addEmployeesItem(Employee employeesItem) { + if (this.employees == null) { + this.employees = new ArrayList(); + } + this.employees.add(employeesItem); + return this; + } + + /** + * Get employees + * @return employees + **/ + @ApiModelProperty(value = "") + public List getEmployees() { + return employees; + } + + public void setEmployees(List employees) { + this.employees = employees; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Employees employees = (Employees) o; + return Objects.equals(this.employees, employees.employees); + } + + @Override + public int hashCode() { + return Objects.hash(employees); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Employees {\n"); + sb.append(" employees: ").append(toIndentedString(employees)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/EmploymentBasis.java b/src/main/java/com/xero/models/payrollau/EmploymentBasis.java new file mode 100644 index 00000000..a05e87e6 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/EmploymentBasis.java @@ -0,0 +1,63 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EmploymentBasis + */ +public enum EmploymentBasis { + + FULLTIME("FULLTIME"), + + PARTTIME("PARTTIME"), + + CASUAL("CASUAL"), + + LABOURHIRE("LABOURHIRE"), + + SUPERINCOMESTREAM("SUPERINCOMESTREAM"); + + private String value; + + EmploymentBasis(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EmploymentBasis fromValue(String value) { + for (EmploymentBasis b : EmploymentBasis.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/EmploymentTerminationPaymentType.java b/src/main/java/com/xero/models/payrollau/EmploymentTerminationPaymentType.java new file mode 100644 index 00000000..6743480b --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/EmploymentTerminationPaymentType.java @@ -0,0 +1,57 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EmploymentTerminationPaymentType + */ +public enum EmploymentTerminationPaymentType { + + O("O"), + + R("R"); + + private String value; + + EmploymentTerminationPaymentType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EmploymentTerminationPaymentType fromValue(String value) { + for (EmploymentTerminationPaymentType b : EmploymentTerminationPaymentType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/EntitlementFinalPayPayoutType.java b/src/main/java/com/xero/models/payrollau/EntitlementFinalPayPayoutType.java new file mode 100644 index 00000000..7cec7430 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/EntitlementFinalPayPayoutType.java @@ -0,0 +1,57 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EntitlementFinalPayPayoutType + */ +public enum EntitlementFinalPayPayoutType { + + NOTPAIDOUT("NOTPAIDOUT"), + + PAIDOUT("PAIDOUT"); + + private String value; + + EntitlementFinalPayPayoutType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EntitlementFinalPayPayoutType fromValue(String value) { + for (EntitlementFinalPayPayoutType b : EntitlementFinalPayPayoutType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/HomeAddress.java b/src/main/java/com/xero/models/payrollau/HomeAddress.java new file mode 100644 index 00000000..0516121f --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/HomeAddress.java @@ -0,0 +1,214 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.State; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * HomeAddress + */ + +public class HomeAddress { + + @JsonProperty("AddressLine1") + private String addressLine1; + + + @JsonProperty("AddressLine2") + private String addressLine2; + + + @JsonProperty("City") + private String city; + + + @JsonProperty("Region") + private State region; + + + @JsonProperty("PostalCode") + private String postalCode; + + + @JsonProperty("Country") + private String country; + + public HomeAddress addressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + return this; + } + + /** + * Address line 1 for employee home address + * @return addressLine1 + **/ + @ApiModelProperty(example = "123 Main St", required = true, value = "Address line 1 for employee home address") + public String getAddressLine1() { + return addressLine1; + } + + public void setAddressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + } + + public HomeAddress addressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + return this; + } + + /** + * Address line 2 for employee home address + * @return addressLine2 + **/ + @ApiModelProperty(example = "Apt 4", value = "Address line 2 for employee home address") + public String getAddressLine2() { + return addressLine2; + } + + public void setAddressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + } + + public HomeAddress city(String city) { + this.city = city; + return this; + } + + /** + * Suburb for employee home address + * @return city + **/ + @ApiModelProperty(example = "St. Kilda", value = "Suburb for employee home address") + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public HomeAddress region(State region) { + this.region = region; + return this; + } + + /** + * Get region + * @return region + **/ + @ApiModelProperty(value = "") + public State getRegion() { + return region; + } + + public void setRegion(State region) { + this.region = region; + } + + public HomeAddress postalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * PostCode for employee home address + * @return postalCode + **/ + @ApiModelProperty(example = "3182", value = "PostCode for employee home address") + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + + public HomeAddress country(String country) { + this.country = country; + return this; + } + + /** + * Country of HomeAddress + * @return country + **/ + @ApiModelProperty(example = "AUSTRALIA", value = "Country of HomeAddress") + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HomeAddress homeAddress = (HomeAddress) o; + return Objects.equals(this.addressLine1, homeAddress.addressLine1) && + Objects.equals(this.addressLine2, homeAddress.addressLine2) && + Objects.equals(this.city, homeAddress.city) && + Objects.equals(this.region, homeAddress.region) && + Objects.equals(this.postalCode, homeAddress.postalCode) && + Objects.equals(this.country, homeAddress.country); + } + + @Override + public int hashCode() { + return Objects.hash(addressLine1, addressLine2, city, region, postalCode, country); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HomeAddress {\n"); + sb.append(" addressLine1: ").append(toIndentedString(addressLine1)).append("\n"); + sb.append(" addressLine2: ").append(toIndentedString(addressLine2)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" region: ").append(toIndentedString(region)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" country: ").append(toIndentedString(country)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/LeaveApplication.java b/src/main/java/com/xero/models/payrollau/LeaveApplication.java new file mode 100644 index 00000000..b85ec1c6 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/LeaveApplication.java @@ -0,0 +1,273 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.LeavePeriod; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * LeaveApplication + */ + +public class LeaveApplication { + + @JsonProperty("LeaveApplicationID") + private UUID leaveApplicationID; + + + @JsonProperty("EmployeeID") + private UUID employeeID; + + + @JsonProperty("LeaveTypeID") + private UUID leaveTypeID; + + + @JsonProperty("Title") + private String title; + + + @JsonProperty("StartDate") + private String startDate; + + + @JsonProperty("EndDate") + private String endDate; + + + @JsonProperty("Description") + private String description; + + + @JsonProperty("LeavePeriods") + private List leavePeriods = new ArrayList(); + + public LeaveApplication leaveApplicationID(UUID leaveApplicationID) { + this.leaveApplicationID = leaveApplicationID; + return this; + } + + /** + * The Xero identifier for Payroll Employee + * @return leaveApplicationID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "The Xero identifier for Payroll Employee") + public UUID getLeaveApplicationID() { + return leaveApplicationID; + } + + public void setLeaveApplicationID(UUID leaveApplicationID) { + this.leaveApplicationID = leaveApplicationID; + } + + public LeaveApplication employeeID(UUID employeeID) { + this.employeeID = employeeID; + return this; + } + + /** + * The Xero identifier for Payroll Employee + * @return employeeID + **/ + @ApiModelProperty(example = "fb4ebd68-6568-41eb-96ab-628a0f54b4b8", value = "The Xero identifier for Payroll Employee") + public UUID getEmployeeID() { + return employeeID; + } + + public void setEmployeeID(UUID employeeID) { + this.employeeID = employeeID; + } + + public LeaveApplication leaveTypeID(UUID leaveTypeID) { + this.leaveTypeID = leaveTypeID; + return this; + } + + /** + * The Xero identifier for Leave Type + * @return leaveTypeID + **/ + @ApiModelProperty(example = "742998cb-7584-4ecf-aa88-d694f59c50f9", value = "The Xero identifier for Leave Type") + public UUID getLeaveTypeID() { + return leaveTypeID; + } + + public void setLeaveTypeID(UUID leaveTypeID) { + this.leaveTypeID = leaveTypeID; + } + + public LeaveApplication title(String title) { + this.title = title; + return this; + } + + /** + * The title of the leave + * @return title + **/ + @ApiModelProperty(example = "Annual Leave", value = "The title of the leave") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public LeaveApplication startDate(String startDate) { + this.startDate = startDate; + return this; + } + + /** + * Start date of the leave (YYYY-MM-DD) + * @return startDate + **/ + @ApiModelProperty(example = "/Date(320284900000+0000)/", value = "Start date of the leave (YYYY-MM-DD)") + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public LeaveApplication endDate(String endDate) { + this.endDate = endDate; + return this; + } + + /** + * End date of the leave (YYYY-MM-DD) + * @return endDate + **/ + @ApiModelProperty(example = "/Date(320284900000+0000)/", value = "End date of the leave (YYYY-MM-DD)") + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + public LeaveApplication description(String description) { + this.description = description; + return this; + } + + /** + * The Description of the Leave + * @return description + **/ + @ApiModelProperty(example = "My leave", value = "The Description of the Leave") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public LeaveApplication leavePeriods(List leavePeriods) { + this.leavePeriods = leavePeriods; + return this; + } + + public LeaveApplication addLeavePeriodsItem(LeavePeriod leavePeriodsItem) { + if (this.leavePeriods == null) { + this.leavePeriods = new ArrayList(); + } + this.leavePeriods.add(leavePeriodsItem); + return this; + } + + /** + * Get leavePeriods + * @return leavePeriods + **/ + @ApiModelProperty(value = "") + public List getLeavePeriods() { + return leavePeriods; + } + + public void setLeavePeriods(List leavePeriods) { + this.leavePeriods = leavePeriods; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LeaveApplication leaveApplication = (LeaveApplication) o; + return Objects.equals(this.leaveApplicationID, leaveApplication.leaveApplicationID) && + Objects.equals(this.employeeID, leaveApplication.employeeID) && + Objects.equals(this.leaveTypeID, leaveApplication.leaveTypeID) && + Objects.equals(this.title, leaveApplication.title) && + Objects.equals(this.startDate, leaveApplication.startDate) && + Objects.equals(this.endDate, leaveApplication.endDate) && + Objects.equals(this.description, leaveApplication.description) && + Objects.equals(this.leavePeriods, leaveApplication.leavePeriods); + } + + @Override + public int hashCode() { + return Objects.hash(leaveApplicationID, employeeID, leaveTypeID, title, startDate, endDate, description, leavePeriods); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LeaveApplication {\n"); + sb.append(" leaveApplicationID: ").append(toIndentedString(leaveApplicationID)).append("\n"); + sb.append(" employeeID: ").append(toIndentedString(employeeID)).append("\n"); + sb.append(" leaveTypeID: ").append(toIndentedString(leaveTypeID)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" leavePeriods: ").append(toIndentedString(leavePeriods)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/LeaveApplications.java b/src/main/java/com/xero/models/payrollau/LeaveApplications.java new file mode 100644 index 00000000..0cee0d97 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/LeaveApplications.java @@ -0,0 +1,104 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.LeaveApplication; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * LeaveApplications + */ + +public class LeaveApplications { + + @JsonProperty("LeaveApplications") + private List leaveApplications = new ArrayList(); + + public LeaveApplications leaveApplications(List leaveApplications) { + this.leaveApplications = leaveApplications; + return this; + } + + public LeaveApplications addLeaveApplicationsItem(LeaveApplication leaveApplicationsItem) { + if (this.leaveApplications == null) { + this.leaveApplications = new ArrayList(); + } + this.leaveApplications.add(leaveApplicationsItem); + return this; + } + + /** + * Get leaveApplications + * @return leaveApplications + **/ + @ApiModelProperty(value = "") + public List getLeaveApplications() { + return leaveApplications; + } + + public void setLeaveApplications(List leaveApplications) { + this.leaveApplications = leaveApplications; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LeaveApplications leaveApplications = (LeaveApplications) o; + return Objects.equals(this.leaveApplications, leaveApplications.leaveApplications); + } + + @Override + public int hashCode() { + return Objects.hash(leaveApplications); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LeaveApplications {\n"); + sb.append(" leaveApplications: ").append(toIndentedString(leaveApplications)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/LeaveBalance.java b/src/main/java/com/xero/models/payrollau/LeaveBalance.java new file mode 100644 index 00000000..92559d74 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/LeaveBalance.java @@ -0,0 +1,165 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * LeaveBalance + */ + +public class LeaveBalance { + + @JsonProperty("LeaveName") + private String leaveName; + + + @JsonProperty("LeaveTypeID") + private String leaveTypeID; + + + @JsonProperty("NumberOfUnits") + private Float numberOfUnits; + + + @JsonProperty("TypeOfUnits") + private String typeOfUnits; + + public LeaveBalance leaveName(String leaveName) { + this.leaveName = leaveName; + return this; + } + + /** + * The name of the leave type + * @return leaveName + **/ + @ApiModelProperty(example = "Annual Leave", value = "The name of the leave type") + public String getLeaveName() { + return leaveName; + } + + public void setLeaveName(String leaveName) { + this.leaveName = leaveName; + } + + public LeaveBalance leaveTypeID(String leaveTypeID) { + this.leaveTypeID = leaveTypeID; + return this; + } + + /** + * Identifier of the leave type (see PayItems) + * @return leaveTypeID + **/ + @ApiModelProperty(example = "544d9292-4329-4512-bfff-a9f15236d776", value = "Identifier of the leave type (see PayItems)") + public String getLeaveTypeID() { + return leaveTypeID; + } + + public void setLeaveTypeID(String leaveTypeID) { + this.leaveTypeID = leaveTypeID; + } + + public LeaveBalance numberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + return this; + } + + /** + * The balance of the leave available + * @return numberOfUnits + **/ + @ApiModelProperty(example = "81.2602", value = "The balance of the leave available") + public Float getNumberOfUnits() { + return numberOfUnits; + } + + public void setNumberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + } + + public LeaveBalance typeOfUnits(String typeOfUnits) { + this.typeOfUnits = typeOfUnits; + return this; + } + + /** + * The type of units as specified by the LeaveType (see PayItems) + * @return typeOfUnits + **/ + @ApiModelProperty(example = "Hours", value = "The type of units as specified by the LeaveType (see PayItems)") + public String getTypeOfUnits() { + return typeOfUnits; + } + + public void setTypeOfUnits(String typeOfUnits) { + this.typeOfUnits = typeOfUnits; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LeaveBalance leaveBalance = (LeaveBalance) o; + return Objects.equals(this.leaveName, leaveBalance.leaveName) && + Objects.equals(this.leaveTypeID, leaveBalance.leaveTypeID) && + Objects.equals(this.numberOfUnits, leaveBalance.numberOfUnits) && + Objects.equals(this.typeOfUnits, leaveBalance.typeOfUnits); + } + + @Override + public int hashCode() { + return Objects.hash(leaveName, leaveTypeID, numberOfUnits, typeOfUnits); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LeaveBalance {\n"); + sb.append(" leaveName: ").append(toIndentedString(leaveName)).append("\n"); + sb.append(" leaveTypeID: ").append(toIndentedString(leaveTypeID)).append("\n"); + sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); + sb.append(" typeOfUnits: ").append(toIndentedString(typeOfUnits)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/LeaveLine.java b/src/main/java/com/xero/models/payrollau/LeaveLine.java new file mode 100644 index 00000000..5c7722a9 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/LeaveLine.java @@ -0,0 +1,216 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.EmploymentTerminationPaymentType; +import com.xero.models.payrollau.EntitlementFinalPayPayoutType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * LeaveLine + */ + +public class LeaveLine { + + @JsonProperty("LeaveTypeID") + private UUID leaveTypeID; + + + @JsonProperty("CalculationType") + private String calculationType; + + + @JsonProperty("EntitlementFinalPayPayoutType") + private EntitlementFinalPayPayoutType entitlementFinalPayPayoutType; + + + @JsonProperty("EmploymentTerminationPaymentType") + private EmploymentTerminationPaymentType employmentTerminationPaymentType; + + + @JsonProperty("IncludeSuperannuationGuaranteeContribution") + private Boolean includeSuperannuationGuaranteeContribution; + + + @JsonProperty("NumberOfUnits") + private Float numberOfUnits; + + public LeaveLine leaveTypeID(UUID leaveTypeID) { + this.leaveTypeID = leaveTypeID; + return this; + } + + /** + * Xero leave type identifier + * @return leaveTypeID + **/ + @ApiModelProperty(example = "742998cb-7584-4ecf-aa88-d694f59c50f9", value = "Xero leave type identifier") + public UUID getLeaveTypeID() { + return leaveTypeID; + } + + public void setLeaveTypeID(UUID leaveTypeID) { + this.leaveTypeID = leaveTypeID; + } + + public LeaveLine calculationType(String calculationType) { + this.calculationType = calculationType; + return this; + } + + /** + * Calculation type for leave line ??? + * @return calculationType + **/ + @ApiModelProperty(example = "FIXEDAMOUNTEACHPERIOD", value = "Calculation type for leave line ???") + public String getCalculationType() { + return calculationType; + } + + public void setCalculationType(String calculationType) { + this.calculationType = calculationType; + } + + public LeaveLine entitlementFinalPayPayoutType(EntitlementFinalPayPayoutType entitlementFinalPayPayoutType) { + this.entitlementFinalPayPayoutType = entitlementFinalPayPayoutType; + return this; + } + + /** + * Get entitlementFinalPayPayoutType + * @return entitlementFinalPayPayoutType + **/ + @ApiModelProperty(value = "") + public EntitlementFinalPayPayoutType getEntitlementFinalPayPayoutType() { + return entitlementFinalPayPayoutType; + } + + public void setEntitlementFinalPayPayoutType(EntitlementFinalPayPayoutType entitlementFinalPayPayoutType) { + this.entitlementFinalPayPayoutType = entitlementFinalPayPayoutType; + } + + public LeaveLine employmentTerminationPaymentType(EmploymentTerminationPaymentType employmentTerminationPaymentType) { + this.employmentTerminationPaymentType = employmentTerminationPaymentType; + return this; + } + + /** + * Get employmentTerminationPaymentType + * @return employmentTerminationPaymentType + **/ + @ApiModelProperty(value = "") + public EmploymentTerminationPaymentType getEmploymentTerminationPaymentType() { + return employmentTerminationPaymentType; + } + + public void setEmploymentTerminationPaymentType(EmploymentTerminationPaymentType employmentTerminationPaymentType) { + this.employmentTerminationPaymentType = employmentTerminationPaymentType; + } + + public LeaveLine includeSuperannuationGuaranteeContribution(Boolean includeSuperannuationGuaranteeContribution) { + this.includeSuperannuationGuaranteeContribution = includeSuperannuationGuaranteeContribution; + return this; + } + + /** + * amount of leave line + * @return includeSuperannuationGuaranteeContribution + **/ + @ApiModelProperty(example = "true", value = "amount of leave line") + public Boolean getIncludeSuperannuationGuaranteeContribution() { + return includeSuperannuationGuaranteeContribution; + } + + public void setIncludeSuperannuationGuaranteeContribution(Boolean includeSuperannuationGuaranteeContribution) { + this.includeSuperannuationGuaranteeContribution = includeSuperannuationGuaranteeContribution; + } + + public LeaveLine numberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + return this; + } + + /** + * Leave number of units + * @return numberOfUnits + **/ + @ApiModelProperty(example = "2.5", value = "Leave number of units") + public Float getNumberOfUnits() { + return numberOfUnits; + } + + public void setNumberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LeaveLine leaveLine = (LeaveLine) o; + return Objects.equals(this.leaveTypeID, leaveLine.leaveTypeID) && + Objects.equals(this.calculationType, leaveLine.calculationType) && + Objects.equals(this.entitlementFinalPayPayoutType, leaveLine.entitlementFinalPayPayoutType) && + Objects.equals(this.employmentTerminationPaymentType, leaveLine.employmentTerminationPaymentType) && + Objects.equals(this.includeSuperannuationGuaranteeContribution, leaveLine.includeSuperannuationGuaranteeContribution) && + Objects.equals(this.numberOfUnits, leaveLine.numberOfUnits); + } + + @Override + public int hashCode() { + return Objects.hash(leaveTypeID, calculationType, entitlementFinalPayPayoutType, employmentTerminationPaymentType, includeSuperannuationGuaranteeContribution, numberOfUnits); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LeaveLine {\n"); + sb.append(" leaveTypeID: ").append(toIndentedString(leaveTypeID)).append("\n"); + sb.append(" calculationType: ").append(toIndentedString(calculationType)).append("\n"); + sb.append(" entitlementFinalPayPayoutType: ").append(toIndentedString(entitlementFinalPayPayoutType)).append("\n"); + sb.append(" employmentTerminationPaymentType: ").append(toIndentedString(employmentTerminationPaymentType)).append("\n"); + sb.append(" includeSuperannuationGuaranteeContribution: ").append(toIndentedString(includeSuperannuationGuaranteeContribution)).append("\n"); + sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/LeaveLines.java b/src/main/java/com/xero/models/payrollau/LeaveLines.java new file mode 100644 index 00000000..08049ded --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/LeaveLines.java @@ -0,0 +1,105 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.LeaveLine; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * The leave type lines + */ +@ApiModel(description = "The leave type lines") + +public class LeaveLines { + + @JsonProperty("Employee") + private List employee = new ArrayList(); + + public LeaveLines employee(List employee) { + this.employee = employee; + return this; + } + + public LeaveLines addEmployeeItem(LeaveLine employeeItem) { + if (this.employee == null) { + this.employee = new ArrayList(); + } + this.employee.add(employeeItem); + return this; + } + + /** + * Get employee + * @return employee + **/ + @ApiModelProperty(value = "") + public List getEmployee() { + return employee; + } + + public void setEmployee(List employee) { + this.employee = employee; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LeaveLines leaveLines = (LeaveLines) o; + return Objects.equals(this.employee, leaveLines.employee); + } + + @Override + public int hashCode() { + return Objects.hash(employee); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LeaveLines {\n"); + sb.append(" employee: ").append(toIndentedString(employee)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/LeavePeriod.java b/src/main/java/com/xero/models/payrollau/LeavePeriod.java new file mode 100644 index 00000000..cedcc53b --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/LeavePeriod.java @@ -0,0 +1,167 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.LeavePeriodStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * LeavePeriod + */ + +public class LeavePeriod { + + @JsonProperty("NumberOfUnits") + private Float numberOfUnits; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("PayPeriodEndDate") + private OffsetDateTime payPeriodEndDate; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("PayPeriodStartDate") + private OffsetDateTime payPeriodStartDate; + + + @JsonProperty("LeavePeriodStatus") + private LeavePeriodStatus leavePeriodStatus; + + public LeavePeriod numberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + return this; + } + + /** + * The Number of Units for the leave + * @return numberOfUnits + **/ + @ApiModelProperty(example = "22.8", value = "The Number of Units for the leave") + public Float getNumberOfUnits() { + return numberOfUnits; + } + + public void setNumberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + } + + public LeavePeriod payPeriodEndDate(OffsetDateTime payPeriodEndDate) { + this.payPeriodEndDate = payPeriodEndDate; + return this; + } + + /** + * The Pay Period End Date (YYYY-MM-DD) + * @return payPeriodEndDate + **/ + @ApiModelProperty(value = "The Pay Period End Date (YYYY-MM-DD)") + public OffsetDateTime getPayPeriodEndDate() { + return payPeriodEndDate; + } + + public void setPayPeriodEndDate(OffsetDateTime payPeriodEndDate) { + this.payPeriodEndDate = payPeriodEndDate; + } + + public LeavePeriod payPeriodStartDate(OffsetDateTime payPeriodStartDate) { + this.payPeriodStartDate = payPeriodStartDate; + return this; + } + + /** + * The Pay Period Start Date (YYYY-MM-DD) + * @return payPeriodStartDate + **/ + @ApiModelProperty(value = "The Pay Period Start Date (YYYY-MM-DD)") + public OffsetDateTime getPayPeriodStartDate() { + return payPeriodStartDate; + } + + public void setPayPeriodStartDate(OffsetDateTime payPeriodStartDate) { + this.payPeriodStartDate = payPeriodStartDate; + } + + public LeavePeriod leavePeriodStatus(LeavePeriodStatus leavePeriodStatus) { + this.leavePeriodStatus = leavePeriodStatus; + return this; + } + + /** + * Get leavePeriodStatus + * @return leavePeriodStatus + **/ + @ApiModelProperty(value = "") + public LeavePeriodStatus getLeavePeriodStatus() { + return leavePeriodStatus; + } + + public void setLeavePeriodStatus(LeavePeriodStatus leavePeriodStatus) { + this.leavePeriodStatus = leavePeriodStatus; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LeavePeriod leavePeriod = (LeavePeriod) o; + return Objects.equals(this.numberOfUnits, leavePeriod.numberOfUnits) && + Objects.equals(this.payPeriodEndDate, leavePeriod.payPeriodEndDate) && + Objects.equals(this.payPeriodStartDate, leavePeriod.payPeriodStartDate) && + Objects.equals(this.leavePeriodStatus, leavePeriod.leavePeriodStatus); + } + + @Override + public int hashCode() { + return Objects.hash(numberOfUnits, payPeriodEndDate, payPeriodStartDate, leavePeriodStatus); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LeavePeriod {\n"); + sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); + sb.append(" payPeriodEndDate: ").append(toIndentedString(payPeriodEndDate)).append("\n"); + sb.append(" payPeriodStartDate: ").append(toIndentedString(payPeriodStartDate)).append("\n"); + sb.append(" leavePeriodStatus: ").append(toIndentedString(leavePeriodStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/LeavePeriodStatus.java b/src/main/java/com/xero/models/payrollau/LeavePeriodStatus.java new file mode 100644 index 00000000..227d7f11 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/LeavePeriodStatus.java @@ -0,0 +1,57 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets LeavePeriodStatus + */ +public enum LeavePeriodStatus { + + SCHEDULED("SCHEDULED"), + + PROCESSED("PROCESSED"); + + private String value; + + LeavePeriodStatus(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static LeavePeriodStatus fromValue(String value) { + for (LeavePeriodStatus b : LeavePeriodStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/LeaveType.java b/src/main/java/com/xero/models/payrollau/LeaveType.java new file mode 100644 index 00000000..65caf7d5 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/LeaveType.java @@ -0,0 +1,263 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * LeaveType + */ + +public class LeaveType { + + @JsonProperty("Name") + private String name; + + + @JsonProperty("TypeOfUnits") + private String typeOfUnits; + + + @JsonProperty("IsPaidLeave") + private Boolean isPaidLeave; + + + @JsonProperty("ShowOnPayslip") + private Boolean showOnPayslip; + + + @JsonProperty("LeaveTypeID") + private UUID leaveTypeID; + + + @JsonProperty("NormalEntitlement") + private Float normalEntitlement; + + + @JsonProperty("LeaveLoadingRate") + private Float leaveLoadingRate; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + public LeaveType name(String name) { + this.name = name; + return this; + } + + /** + * Name of the earnings rate (max length = 100) + * @return name + **/ + @ApiModelProperty(example = "PTO", value = "Name of the earnings rate (max length = 100)") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public LeaveType typeOfUnits(String typeOfUnits) { + this.typeOfUnits = typeOfUnits; + return this; + } + + /** + * The type of units by which leave entitlements are normally tracked. These are typically the same as the type of units used for the employee’s ordinary earnings rate + * @return typeOfUnits + **/ + @ApiModelProperty(example = "Hours", value = "The type of units by which leave entitlements are normally tracked. These are typically the same as the type of units used for the employee’s ordinary earnings rate") + public String getTypeOfUnits() { + return typeOfUnits; + } + + public void setTypeOfUnits(String typeOfUnits) { + this.typeOfUnits = typeOfUnits; + } + + public LeaveType isPaidLeave(Boolean isPaidLeave) { + this.isPaidLeave = isPaidLeave; + return this; + } + + /** + * Set this to indicate that an employee will be paid when taking this type of leave + * @return isPaidLeave + **/ + @ApiModelProperty(example = "true", value = "Set this to indicate that an employee will be paid when taking this type of leave") + public Boolean getIsPaidLeave() { + return isPaidLeave; + } + + public void setIsPaidLeave(Boolean isPaidLeave) { + this.isPaidLeave = isPaidLeave; + } + + public LeaveType showOnPayslip(Boolean showOnPayslip) { + this.showOnPayslip = showOnPayslip; + return this; + } + + /** + * Set this if you want a balance for this leave type to be shown on your employee’s payslips + * @return showOnPayslip + **/ + @ApiModelProperty(example = "true", value = "Set this if you want a balance for this leave type to be shown on your employee’s payslips") + public Boolean getShowOnPayslip() { + return showOnPayslip; + } + + public void setShowOnPayslip(Boolean showOnPayslip) { + this.showOnPayslip = showOnPayslip; + } + + public LeaveType leaveTypeID(UUID leaveTypeID) { + this.leaveTypeID = leaveTypeID; + return this; + } + + /** + * Xero identifier + * @return leaveTypeID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier") + public UUID getLeaveTypeID() { + return leaveTypeID; + } + + public void setLeaveTypeID(UUID leaveTypeID) { + this.leaveTypeID = leaveTypeID; + } + + public LeaveType normalEntitlement(Float normalEntitlement) { + this.normalEntitlement = normalEntitlement; + return this; + } + + /** + * The number of units the employee is entitled to each year + * @return normalEntitlement + **/ + @ApiModelProperty(example = "152.0", value = "The number of units the employee is entitled to each year") + public Float getNormalEntitlement() { + return normalEntitlement; + } + + public void setNormalEntitlement(Float normalEntitlement) { + this.normalEntitlement = normalEntitlement; + } + + public LeaveType leaveLoadingRate(Float leaveLoadingRate) { + this.leaveLoadingRate = leaveLoadingRate; + return this; + } + + /** + * Enter an amount here if your organisation pays an additional percentage on top of ordinary earnings when your employees take leave (typically 17.5%) + * @return leaveLoadingRate + **/ + @ApiModelProperty(example = "12.0", value = "Enter an amount here if your organisation pays an additional percentage on top of ordinary earnings when your employees take leave (typically 17.5%)") + public Float getLeaveLoadingRate() { + return leaveLoadingRate; + } + + public void setLeaveLoadingRate(Float leaveLoadingRate) { + this.leaveLoadingRate = leaveLoadingRate; + } + + public LeaveType updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * Last modified timestamp + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Last modified timestamp") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LeaveType leaveType = (LeaveType) o; + return Objects.equals(this.name, leaveType.name) && + Objects.equals(this.typeOfUnits, leaveType.typeOfUnits) && + Objects.equals(this.isPaidLeave, leaveType.isPaidLeave) && + Objects.equals(this.showOnPayslip, leaveType.showOnPayslip) && + Objects.equals(this.leaveTypeID, leaveType.leaveTypeID) && + Objects.equals(this.normalEntitlement, leaveType.normalEntitlement) && + Objects.equals(this.leaveLoadingRate, leaveType.leaveLoadingRate) && + Objects.equals(this.updatedDateUTC, leaveType.updatedDateUTC); + } + + @Override + public int hashCode() { + return Objects.hash(name, typeOfUnits, isPaidLeave, showOnPayslip, leaveTypeID, normalEntitlement, leaveLoadingRate, updatedDateUTC); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LeaveType {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" typeOfUnits: ").append(toIndentedString(typeOfUnits)).append("\n"); + sb.append(" isPaidLeave: ").append(toIndentedString(isPaidLeave)).append("\n"); + sb.append(" showOnPayslip: ").append(toIndentedString(showOnPayslip)).append("\n"); + sb.append(" leaveTypeID: ").append(toIndentedString(leaveTypeID)).append("\n"); + sb.append(" normalEntitlement: ").append(toIndentedString(normalEntitlement)).append("\n"); + sb.append(" leaveLoadingRate: ").append(toIndentedString(leaveLoadingRate)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/LeaveTypeContributionType.java b/src/main/java/com/xero/models/payrollau/LeaveTypeContributionType.java new file mode 100644 index 00000000..6cddf57c --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/LeaveTypeContributionType.java @@ -0,0 +1,61 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets LeaveTypeContributionType + */ +public enum LeaveTypeContributionType { + + SGC("SGC"), + + SALARYSACRIFICE("SALARYSACRIFICE"), + + EMPLOYERADDITIONAL("EMPLOYERADDITIONAL"), + + EMPLOYEE("EMPLOYEE"); + + private String value; + + LeaveTypeContributionType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static LeaveTypeContributionType fromValue(String value) { + for (LeaveTypeContributionType b : LeaveTypeContributionType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/ManualTaxType.java b/src/main/java/com/xero/models/payrollau/ManualTaxType.java new file mode 100644 index 00000000..ceea1a23 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/ManualTaxType.java @@ -0,0 +1,59 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets ManualTaxType + */ +public enum ManualTaxType { + + PAYGMANUAL("PAYGMANUAL"), + + ETPOMANUAL("ETPOMANUAL"), + + ETPRMANUAL("ETPRMANUAL"); + + private String value; + + ManualTaxType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ManualTaxType fromValue(String value) { + for (ManualTaxType b : ManualTaxType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/ModelAPIException.java b/src/main/java/com/xero/models/payrollau/ModelAPIException.java new file mode 100644 index 00000000..e8642313 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/ModelAPIException.java @@ -0,0 +1,143 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * The object returned for a bad request + */ +@ApiModel(description = "The object returned for a bad request") + +public class ModelAPIException { + + @JsonProperty("ErrorNumber") + private BigDecimal errorNumber; + + + @JsonProperty("Type") + private String type; + + + @JsonProperty("Message") + private String message; + + public ModelAPIException errorNumber(BigDecimal errorNumber) { + this.errorNumber = errorNumber; + return this; + } + + /** + * The error number + * @return errorNumber + **/ + @ApiModelProperty(example = "16", value = "The error number") + public BigDecimal getErrorNumber() { + return errorNumber; + } + + public void setErrorNumber(BigDecimal errorNumber) { + this.errorNumber = errorNumber; + } + + public ModelAPIException type(String type) { + this.type = type; + return this; + } + + /** + * The type of error + * @return type + **/ + @ApiModelProperty(example = "QueryParseException", value = "The type of error") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public ModelAPIException message(String message) { + this.message = message; + return this; + } + + /** + * The message describing the error + * @return message + **/ + @ApiModelProperty(example = "No property or field 'hi' exists in type 'Employee' (at index 0)", value = "The message describing the error") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelAPIException _apIException = (ModelAPIException) o; + return Objects.equals(this.errorNumber, _apIException.errorNumber) && + Objects.equals(this.type, _apIException.type) && + Objects.equals(this.message, _apIException.message); + } + + @Override + public int hashCode() { + return Objects.hash(errorNumber, type, message); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelAPIException {\n"); + sb.append(" errorNumber: ").append(toIndentedString(errorNumber)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/OpeningBalances.java b/src/main/java/com/xero/models/payrollau/OpeningBalances.java new file mode 100644 index 00000000..16e94cbf --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/OpeningBalances.java @@ -0,0 +1,285 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.DeductionLine; +import com.xero.models.payrollau.EarningsLine; +import com.xero.models.payrollau.LeaveLine; +import com.xero.models.payrollau.ReimbursementLine; +import com.xero.models.payrollau.SuperLine; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.threeten.bp.LocalDate; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * OpeningBalances + */ + +public class OpeningBalances { + @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("OpeningBalanceDate") + private LocalDate openingBalanceDate; + + + @JsonProperty("Tax") + private String tax; + + + @JsonProperty("EarningsLines") + private List earningsLines = new ArrayList(); + + + @JsonProperty("DeductionLines") + private List deductionLines = new ArrayList(); + + + @JsonProperty("SuperLines") + private List superLines = new ArrayList(); + + + @JsonProperty("ReimbursementLines") + private List reimbursementLines = new ArrayList(); + + + @JsonProperty("LeaveLines") + private List leaveLines = new ArrayList(); + + public OpeningBalances openingBalanceDate(LocalDate openingBalanceDate) { + this.openingBalanceDate = openingBalanceDate; + return this; + } + + /** + * Opening Balance Date. (YYYY-MM-DD) + * @return openingBalanceDate + **/ + @ApiModelProperty(value = "Opening Balance Date. (YYYY-MM-DD)") + public LocalDate getOpeningBalanceDate() { + return openingBalanceDate; + } + + public void setOpeningBalanceDate(LocalDate openingBalanceDate) { + this.openingBalanceDate = openingBalanceDate; + } + + public OpeningBalances tax(String tax) { + this.tax = tax; + return this; + } + + /** + * Opening Balance tax + * @return tax + **/ + @ApiModelProperty(example = "4333d5cd-53a5-4c31-98e5-a8b4e5676b0b", value = "Opening Balance tax") + public String getTax() { + return tax; + } + + public void setTax(String tax) { + this.tax = tax; + } + + public OpeningBalances earningsLines(List earningsLines) { + this.earningsLines = earningsLines; + return this; + } + + public OpeningBalances addEarningsLinesItem(EarningsLine earningsLinesItem) { + if (this.earningsLines == null) { + this.earningsLines = new ArrayList(); + } + this.earningsLines.add(earningsLinesItem); + return this; + } + + /** + * Get earningsLines + * @return earningsLines + **/ + @ApiModelProperty(value = "") + public List getEarningsLines() { + return earningsLines; + } + + public void setEarningsLines(List earningsLines) { + this.earningsLines = earningsLines; + } + + public OpeningBalances deductionLines(List deductionLines) { + this.deductionLines = deductionLines; + return this; + } + + public OpeningBalances addDeductionLinesItem(DeductionLine deductionLinesItem) { + if (this.deductionLines == null) { + this.deductionLines = new ArrayList(); + } + this.deductionLines.add(deductionLinesItem); + return this; + } + + /** + * Get deductionLines + * @return deductionLines + **/ + @ApiModelProperty(value = "") + public List getDeductionLines() { + return deductionLines; + } + + public void setDeductionLines(List deductionLines) { + this.deductionLines = deductionLines; + } + + public OpeningBalances superLines(List superLines) { + this.superLines = superLines; + return this; + } + + public OpeningBalances addSuperLinesItem(SuperLine superLinesItem) { + if (this.superLines == null) { + this.superLines = new ArrayList(); + } + this.superLines.add(superLinesItem); + return this; + } + + /** + * Get superLines + * @return superLines + **/ + @ApiModelProperty(value = "") + public List getSuperLines() { + return superLines; + } + + public void setSuperLines(List superLines) { + this.superLines = superLines; + } + + public OpeningBalances reimbursementLines(List reimbursementLines) { + this.reimbursementLines = reimbursementLines; + return this; + } + + public OpeningBalances addReimbursementLinesItem(ReimbursementLine reimbursementLinesItem) { + if (this.reimbursementLines == null) { + this.reimbursementLines = new ArrayList(); + } + this.reimbursementLines.add(reimbursementLinesItem); + return this; + } + + /** + * Get reimbursementLines + * @return reimbursementLines + **/ + @ApiModelProperty(value = "") + public List getReimbursementLines() { + return reimbursementLines; + } + + public void setReimbursementLines(List reimbursementLines) { + this.reimbursementLines = reimbursementLines; + } + + public OpeningBalances leaveLines(List leaveLines) { + this.leaveLines = leaveLines; + return this; + } + + public OpeningBalances addLeaveLinesItem(LeaveLine leaveLinesItem) { + if (this.leaveLines == null) { + this.leaveLines = new ArrayList(); + } + this.leaveLines.add(leaveLinesItem); + return this; + } + + /** + * Get leaveLines + * @return leaveLines + **/ + @ApiModelProperty(value = "") + public List getLeaveLines() { + return leaveLines; + } + + public void setLeaveLines(List leaveLines) { + this.leaveLines = leaveLines; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpeningBalances openingBalances = (OpeningBalances) o; + return Objects.equals(this.openingBalanceDate, openingBalances.openingBalanceDate) && + Objects.equals(this.tax, openingBalances.tax) && + Objects.equals(this.earningsLines, openingBalances.earningsLines) && + Objects.equals(this.deductionLines, openingBalances.deductionLines) && + Objects.equals(this.superLines, openingBalances.superLines) && + Objects.equals(this.reimbursementLines, openingBalances.reimbursementLines) && + Objects.equals(this.leaveLines, openingBalances.leaveLines); + } + + @Override + public int hashCode() { + return Objects.hash(openingBalanceDate, tax, earningsLines, deductionLines, superLines, reimbursementLines, leaveLines); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpeningBalances {\n"); + sb.append(" openingBalanceDate: ").append(toIndentedString(openingBalanceDate)).append("\n"); + sb.append(" tax: ").append(toIndentedString(tax)).append("\n"); + sb.append(" earningsLines: ").append(toIndentedString(earningsLines)).append("\n"); + sb.append(" deductionLines: ").append(toIndentedString(deductionLines)).append("\n"); + sb.append(" superLines: ").append(toIndentedString(superLines)).append("\n"); + sb.append(" reimbursementLines: ").append(toIndentedString(reimbursementLines)).append("\n"); + sb.append(" leaveLines: ").append(toIndentedString(leaveLines)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayItem.java b/src/main/java/com/xero/models/payrollau/PayItem.java new file mode 100644 index 00000000..b7fa63a7 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayItem.java @@ -0,0 +1,203 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.DeductionType; +import com.xero.models.payrollau.EarningsRate; +import com.xero.models.payrollau.LeaveType; +import com.xero.models.payrollau.ReimbursementType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayItem + */ + +public class PayItem { + + @JsonProperty("EarningsRates") + private List earningsRates = new ArrayList(); + + + @JsonProperty("DeductionTypes") + private List deductionTypes = new ArrayList(); + + + @JsonProperty("LeaveTypes") + private List leaveTypes = new ArrayList(); + + + @JsonProperty("ReimbursementTypes") + private List reimbursementTypes = new ArrayList(); + + public PayItem earningsRates(List earningsRates) { + this.earningsRates = earningsRates; + return this; + } + + public PayItem addEarningsRatesItem(EarningsRate earningsRatesItem) { + if (this.earningsRates == null) { + this.earningsRates = new ArrayList(); + } + this.earningsRates.add(earningsRatesItem); + return this; + } + + /** + * Get earningsRates + * @return earningsRates + **/ + @ApiModelProperty(value = "") + public List getEarningsRates() { + return earningsRates; + } + + public void setEarningsRates(List earningsRates) { + this.earningsRates = earningsRates; + } + + public PayItem deductionTypes(List deductionTypes) { + this.deductionTypes = deductionTypes; + return this; + } + + public PayItem addDeductionTypesItem(DeductionType deductionTypesItem) { + if (this.deductionTypes == null) { + this.deductionTypes = new ArrayList(); + } + this.deductionTypes.add(deductionTypesItem); + return this; + } + + /** + * Get deductionTypes + * @return deductionTypes + **/ + @ApiModelProperty(value = "") + public List getDeductionTypes() { + return deductionTypes; + } + + public void setDeductionTypes(List deductionTypes) { + this.deductionTypes = deductionTypes; + } + + public PayItem leaveTypes(List leaveTypes) { + this.leaveTypes = leaveTypes; + return this; + } + + public PayItem addLeaveTypesItem(LeaveType leaveTypesItem) { + if (this.leaveTypes == null) { + this.leaveTypes = new ArrayList(); + } + this.leaveTypes.add(leaveTypesItem); + return this; + } + + /** + * Get leaveTypes + * @return leaveTypes + **/ + @ApiModelProperty(value = "") + public List getLeaveTypes() { + return leaveTypes; + } + + public void setLeaveTypes(List leaveTypes) { + this.leaveTypes = leaveTypes; + } + + public PayItem reimbursementTypes(List reimbursementTypes) { + this.reimbursementTypes = reimbursementTypes; + return this; + } + + public PayItem addReimbursementTypesItem(ReimbursementType reimbursementTypesItem) { + if (this.reimbursementTypes == null) { + this.reimbursementTypes = new ArrayList(); + } + this.reimbursementTypes.add(reimbursementTypesItem); + return this; + } + + /** + * Get reimbursementTypes + * @return reimbursementTypes + **/ + @ApiModelProperty(value = "") + public List getReimbursementTypes() { + return reimbursementTypes; + } + + public void setReimbursementTypes(List reimbursementTypes) { + this.reimbursementTypes = reimbursementTypes; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayItem payItem = (PayItem) o; + return Objects.equals(this.earningsRates, payItem.earningsRates) && + Objects.equals(this.deductionTypes, payItem.deductionTypes) && + Objects.equals(this.leaveTypes, payItem.leaveTypes) && + Objects.equals(this.reimbursementTypes, payItem.reimbursementTypes); + } + + @Override + public int hashCode() { + return Objects.hash(earningsRates, deductionTypes, leaveTypes, reimbursementTypes); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayItem {\n"); + sb.append(" earningsRates: ").append(toIndentedString(earningsRates)).append("\n"); + sb.append(" deductionTypes: ").append(toIndentedString(deductionTypes)).append("\n"); + sb.append(" leaveTypes: ").append(toIndentedString(leaveTypes)).append("\n"); + sb.append(" reimbursementTypes: ").append(toIndentedString(reimbursementTypes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayItems.java b/src/main/java/com/xero/models/payrollau/PayItems.java new file mode 100644 index 00000000..dc3f5850 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayItems.java @@ -0,0 +1,94 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.PayItem; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayItems + */ + +public class PayItems { + + @JsonProperty("PayItems") + private PayItem payItems = null; + + public PayItems payItems(PayItem payItems) { + this.payItems = payItems; + return this; + } + + /** + * Get payItems + * @return payItems + **/ + @ApiModelProperty(value = "") + public PayItem getPayItems() { + return payItems; + } + + public void setPayItems(PayItem payItems) { + this.payItems = payItems; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayItems payItems = (PayItems) o; + return Objects.equals(this.payItems, payItems.payItems); + } + + @Override + public int hashCode() { + return Objects.hash(payItems); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayItems {\n"); + sb.append(" payItems: ").append(toIndentedString(payItems)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayRunStatus.java b/src/main/java/com/xero/models/payrollau/PayRunStatus.java new file mode 100644 index 00000000..34412ee2 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayRunStatus.java @@ -0,0 +1,57 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets PayRunStatus + */ +public enum PayRunStatus { + + DRAFT("DRAFT"), + + POSTED("POSTED"); + + private String value; + + PayRunStatus(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static PayRunStatus fromValue(String value) { + for (PayRunStatus b : PayRunStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/PayTemplate.java b/src/main/java/com/xero/models/payrollau/PayTemplate.java new file mode 100644 index 00000000..8abf9752 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayTemplate.java @@ -0,0 +1,236 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.DeductionLine; +import com.xero.models.payrollau.EarningsLine; +import com.xero.models.payrollau.LeaveLine; +import com.xero.models.payrollau.ReimbursementLine; +import com.xero.models.payrollau.SuperLine; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayTemplate + */ + +public class PayTemplate { + + @JsonProperty("EarningsLines") + private List earningsLines = new ArrayList(); + + + @JsonProperty("DeductionLines") + private List deductionLines = new ArrayList(); + + + @JsonProperty("SuperLines") + private List superLines = new ArrayList(); + + + @JsonProperty("ReimbursementLines") + private List reimbursementLines = new ArrayList(); + + + @JsonProperty("LeaveLines") + private List leaveLines = new ArrayList(); + + public PayTemplate earningsLines(List earningsLines) { + this.earningsLines = earningsLines; + return this; + } + + public PayTemplate addEarningsLinesItem(EarningsLine earningsLinesItem) { + if (this.earningsLines == null) { + this.earningsLines = new ArrayList(); + } + this.earningsLines.add(earningsLinesItem); + return this; + } + + /** + * Get earningsLines + * @return earningsLines + **/ + @ApiModelProperty(value = "") + public List getEarningsLines() { + return earningsLines; + } + + public void setEarningsLines(List earningsLines) { + this.earningsLines = earningsLines; + } + + public PayTemplate deductionLines(List deductionLines) { + this.deductionLines = deductionLines; + return this; + } + + public PayTemplate addDeductionLinesItem(DeductionLine deductionLinesItem) { + if (this.deductionLines == null) { + this.deductionLines = new ArrayList(); + } + this.deductionLines.add(deductionLinesItem); + return this; + } + + /** + * Get deductionLines + * @return deductionLines + **/ + @ApiModelProperty(value = "") + public List getDeductionLines() { + return deductionLines; + } + + public void setDeductionLines(List deductionLines) { + this.deductionLines = deductionLines; + } + + public PayTemplate superLines(List superLines) { + this.superLines = superLines; + return this; + } + + public PayTemplate addSuperLinesItem(SuperLine superLinesItem) { + if (this.superLines == null) { + this.superLines = new ArrayList(); + } + this.superLines.add(superLinesItem); + return this; + } + + /** + * Get superLines + * @return superLines + **/ + @ApiModelProperty(value = "") + public List getSuperLines() { + return superLines; + } + + public void setSuperLines(List superLines) { + this.superLines = superLines; + } + + public PayTemplate reimbursementLines(List reimbursementLines) { + this.reimbursementLines = reimbursementLines; + return this; + } + + public PayTemplate addReimbursementLinesItem(ReimbursementLine reimbursementLinesItem) { + if (this.reimbursementLines == null) { + this.reimbursementLines = new ArrayList(); + } + this.reimbursementLines.add(reimbursementLinesItem); + return this; + } + + /** + * Get reimbursementLines + * @return reimbursementLines + **/ + @ApiModelProperty(value = "") + public List getReimbursementLines() { + return reimbursementLines; + } + + public void setReimbursementLines(List reimbursementLines) { + this.reimbursementLines = reimbursementLines; + } + + public PayTemplate leaveLines(List leaveLines) { + this.leaveLines = leaveLines; + return this; + } + + public PayTemplate addLeaveLinesItem(LeaveLine leaveLinesItem) { + if (this.leaveLines == null) { + this.leaveLines = new ArrayList(); + } + this.leaveLines.add(leaveLinesItem); + return this; + } + + /** + * Get leaveLines + * @return leaveLines + **/ + @ApiModelProperty(value = "") + public List getLeaveLines() { + return leaveLines; + } + + public void setLeaveLines(List leaveLines) { + this.leaveLines = leaveLines; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayTemplate payTemplate = (PayTemplate) o; + return Objects.equals(this.earningsLines, payTemplate.earningsLines) && + Objects.equals(this.deductionLines, payTemplate.deductionLines) && + Objects.equals(this.superLines, payTemplate.superLines) && + Objects.equals(this.reimbursementLines, payTemplate.reimbursementLines) && + Objects.equals(this.leaveLines, payTemplate.leaveLines); + } + + @Override + public int hashCode() { + return Objects.hash(earningsLines, deductionLines, superLines, reimbursementLines, leaveLines); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayTemplate {\n"); + sb.append(" earningsLines: ").append(toIndentedString(earningsLines)).append("\n"); + sb.append(" deductionLines: ").append(toIndentedString(deductionLines)).append("\n"); + sb.append(" superLines: ").append(toIndentedString(superLines)).append("\n"); + sb.append(" reimbursementLines: ").append(toIndentedString(reimbursementLines)).append("\n"); + sb.append(" leaveLines: ").append(toIndentedString(leaveLines)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PaymentFrequencyType.java b/src/main/java/com/xero/models/payrollau/PaymentFrequencyType.java new file mode 100644 index 00000000..e932e978 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PaymentFrequencyType.java @@ -0,0 +1,67 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets PaymentFrequencyType + */ +public enum PaymentFrequencyType { + + WEEKLY("WEEKLY"), + + MONTHLY("MONTHLY"), + + FORTNIGHTLY("FORTNIGHTLY"), + + QUARTERLY("QUARTERLY"), + + TWICEMONTHLY("TWICEMONTHLY"), + + FOURWEEKLY("FOURWEEKLY"), + + YEARLY("YEARLY"); + + private String value; + + PaymentFrequencyType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static PaymentFrequencyType fromValue(String value) { + for (PaymentFrequencyType b : PaymentFrequencyType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/PayrollCalendar.java b/src/main/java/com/xero/models/payrollau/PayrollCalendar.java new file mode 100644 index 00000000..188184d9 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayrollCalendar.java @@ -0,0 +1,192 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.CalendarType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayrollCalendar + */ + +public class PayrollCalendar { + + @JsonProperty("Name") + private String name; + + + @JsonProperty("CalendarType") + private CalendarType calendarType; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("StartDate") + private OffsetDateTime startDate; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("PaymentDate") + private OffsetDateTime paymentDate; + + + @JsonProperty("PayrollCalendarID") + private UUID payrollCalendarID; + + public PayrollCalendar name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Payroll Calendar + * @return name + **/ + @ApiModelProperty(example = "Fortnightly Calendar", value = "Name of the Payroll Calendar") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public PayrollCalendar calendarType(CalendarType calendarType) { + this.calendarType = calendarType; + return this; + } + + /** + * Get calendarType + * @return calendarType + **/ + @ApiModelProperty(value = "") + public CalendarType getCalendarType() { + return calendarType; + } + + public void setCalendarType(CalendarType calendarType) { + this.calendarType = calendarType; + } + + public PayrollCalendar startDate(OffsetDateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * The start date of the upcoming pay period. The end date will be calculated based upon this date, and the calendar type selected (YYYY-MM-DD) + * @return startDate + **/ + @ApiModelProperty(value = "The start date of the upcoming pay period. The end date will be calculated based upon this date, and the calendar type selected (YYYY-MM-DD)") + public OffsetDateTime getStartDate() { + return startDate; + } + + public void setStartDate(OffsetDateTime startDate) { + this.startDate = startDate; + } + + public PayrollCalendar paymentDate(OffsetDateTime paymentDate) { + this.paymentDate = paymentDate; + return this; + } + + /** + * The date on which employees will be paid for the upcoming pay period (YYYY-MM-DD) + * @return paymentDate + **/ + @ApiModelProperty(value = "The date on which employees will be paid for the upcoming pay period (YYYY-MM-DD)") + public OffsetDateTime getPaymentDate() { + return paymentDate; + } + + public void setPaymentDate(OffsetDateTime paymentDate) { + this.paymentDate = paymentDate; + } + + public PayrollCalendar payrollCalendarID(UUID payrollCalendarID) { + this.payrollCalendarID = payrollCalendarID; + return this; + } + + /** + * Xero identifier + * @return payrollCalendarID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier") + public UUID getPayrollCalendarID() { + return payrollCalendarID; + } + + public void setPayrollCalendarID(UUID payrollCalendarID) { + this.payrollCalendarID = payrollCalendarID; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayrollCalendar payrollCalendar = (PayrollCalendar) o; + return Objects.equals(this.name, payrollCalendar.name) && + Objects.equals(this.calendarType, payrollCalendar.calendarType) && + Objects.equals(this.startDate, payrollCalendar.startDate) && + Objects.equals(this.paymentDate, payrollCalendar.paymentDate) && + Objects.equals(this.payrollCalendarID, payrollCalendar.payrollCalendarID); + } + + @Override + public int hashCode() { + return Objects.hash(name, calendarType, startDate, paymentDate, payrollCalendarID); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayrollCalendar {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" calendarType: ").append(toIndentedString(calendarType)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" paymentDate: ").append(toIndentedString(paymentDate)).append("\n"); + sb.append(" payrollCalendarID: ").append(toIndentedString(payrollCalendarID)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayrollCalendars.java b/src/main/java/com/xero/models/payrollau/PayrollCalendars.java new file mode 100644 index 00000000..3ae979a2 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayrollCalendars.java @@ -0,0 +1,104 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.PayrollCalendar; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayrollCalendars + */ + +public class PayrollCalendars { + + @JsonProperty("PayrollCalendars") + private List payrollCalendars = new ArrayList(); + + public PayrollCalendars payrollCalendars(List payrollCalendars) { + this.payrollCalendars = payrollCalendars; + return this; + } + + public PayrollCalendars addPayrollCalendarsItem(PayrollCalendar payrollCalendarsItem) { + if (this.payrollCalendars == null) { + this.payrollCalendars = new ArrayList(); + } + this.payrollCalendars.add(payrollCalendarsItem); + return this; + } + + /** + * Get payrollCalendars + * @return payrollCalendars + **/ + @ApiModelProperty(value = "") + public List getPayrollCalendars() { + return payrollCalendars; + } + + public void setPayrollCalendars(List payrollCalendars) { + this.payrollCalendars = payrollCalendars; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayrollCalendars payrollCalendars = (PayrollCalendars) o; + return Objects.equals(this.payrollCalendars, payrollCalendars.payrollCalendars); + } + + @Override + public int hashCode() { + return Objects.hash(payrollCalendars); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayrollCalendars {\n"); + sb.append(" payrollCalendars: ").append(toIndentedString(payrollCalendars)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/Payrun.java b/src/main/java/com/xero/models/payrollau/Payrun.java new file mode 100644 index 00000000..4f4242db --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/Payrun.java @@ -0,0 +1,443 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.PayRunStatus; +import com.xero.models.payrollau.PayslipSummary; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Payrun + */ + +public class Payrun { + + @JsonProperty("PayrollCalendarID") + private Object payrollCalendarID = null; + + + @JsonProperty("PayRunID") + private Object payRunID = null; + + @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("PayRunPeriodStartDate") + private LocalDate payRunPeriodStartDate; + + @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("PayRunPeriodEndDate") + private LocalDate payRunPeriodEndDate; + + + @JsonProperty("PayRunStatus") + private PayRunStatus payRunStatus; + + @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("PaymentDate") + private LocalDate paymentDate; + + + @JsonProperty("PayslipMessage") + private String payslipMessage; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + + @JsonProperty("Payslips") + private List payslips = new ArrayList(); + + + @JsonProperty("Wages") + private Float wages; + + + @JsonProperty("Deductions") + private Float deductions; + + + @JsonProperty("Tax") + private Float tax; + + + @JsonProperty("Super") + private Float _super; + + + @JsonProperty("Reimbursements") + private Float reimbursements; + + + @JsonProperty("NetPay") + private Float netPay; + + public Payrun payrollCalendarID(Object payrollCalendarID) { + this.payrollCalendarID = payrollCalendarID; + return this; + } + + /** + * Xero identifier for pay run + * @return payrollCalendarID + **/ + @ApiModelProperty(example = "bfac31bd-ea62-4fc8-a5e7-7965d9504b15", required = true, value = "Xero identifier for pay run") + public Object getPayrollCalendarID() { + return payrollCalendarID; + } + + public void setPayrollCalendarID(Object payrollCalendarID) { + this.payrollCalendarID = payrollCalendarID; + } + + public Payrun payRunID(Object payRunID) { + this.payRunID = payRunID; + return this; + } + + /** + * Xero identifier for pay run + * @return payRunID + **/ + @ApiModelProperty(example = "bba1d10f-63b1-4692-b5c5-a99f869523a4", value = "Xero identifier for pay run") + public Object getPayRunID() { + return payRunID; + } + + public void setPayRunID(Object payRunID) { + this.payRunID = payRunID; + } + + public Payrun payRunPeriodStartDate(LocalDate payRunPeriodStartDate) { + this.payRunPeriodStartDate = payRunPeriodStartDate; + return this; + } + + /** + * Period Start Date for the PayRun (YYYY-MM-DD) + * @return payRunPeriodStartDate + **/ + @ApiModelProperty(value = "Period Start Date for the PayRun (YYYY-MM-DD)") + public LocalDate getPayRunPeriodStartDate() { + return payRunPeriodStartDate; + } + + public void setPayRunPeriodStartDate(LocalDate payRunPeriodStartDate) { + this.payRunPeriodStartDate = payRunPeriodStartDate; + } + + public Payrun payRunPeriodEndDate(LocalDate payRunPeriodEndDate) { + this.payRunPeriodEndDate = payRunPeriodEndDate; + return this; + } + + /** + * Period End Date for the PayRun (YYYY-MM-DD) + * @return payRunPeriodEndDate + **/ + @ApiModelProperty(value = "Period End Date for the PayRun (YYYY-MM-DD)") + public LocalDate getPayRunPeriodEndDate() { + return payRunPeriodEndDate; + } + + public void setPayRunPeriodEndDate(LocalDate payRunPeriodEndDate) { + this.payRunPeriodEndDate = payRunPeriodEndDate; + } + + public Payrun payRunStatus(PayRunStatus payRunStatus) { + this.payRunStatus = payRunStatus; + return this; + } + + /** + * Get payRunStatus + * @return payRunStatus + **/ + @ApiModelProperty(value = "") + public PayRunStatus getPayRunStatus() { + return payRunStatus; + } + + public void setPayRunStatus(PayRunStatus payRunStatus) { + this.payRunStatus = payRunStatus; + } + + public Payrun paymentDate(LocalDate paymentDate) { + this.paymentDate = paymentDate; + return this; + } + + /** + * Payment Date for the PayRun (YYYY-MM-DD) + * @return paymentDate + **/ + @ApiModelProperty(value = "Payment Date for the PayRun (YYYY-MM-DD)") + public LocalDate getPaymentDate() { + return paymentDate; + } + + public void setPaymentDate(LocalDate paymentDate) { + this.paymentDate = paymentDate; + } + + public Payrun payslipMessage(String payslipMessage) { + this.payslipMessage = payslipMessage; + return this; + } + + /** + * Payslip message for the PayRun + * @return payslipMessage + **/ + @ApiModelProperty(example = "Thanks for being awesome", value = "Payslip message for the PayRun") + public String getPayslipMessage() { + return payslipMessage; + } + + public void setPayslipMessage(String payslipMessage) { + this.payslipMessage = payslipMessage; + } + + public Payrun updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * Last modified timestamp + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Last modified timestamp") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + + public Payrun payslips(List payslips) { + this.payslips = payslips; + return this; + } + + public Payrun addPayslipsItem(PayslipSummary payslipsItem) { + if (this.payslips == null) { + this.payslips = new ArrayList(); + } + this.payslips.add(payslipsItem); + return this; + } + + /** + * The payslips in the payrun + * @return payslips + **/ + @ApiModelProperty(value = "The payslips in the payrun") + public List getPayslips() { + return payslips; + } + + public void setPayslips(List payslips) { + this.payslips = payslips; + } + + public Payrun wages(Float wages) { + this.wages = wages; + return this; + } + + /** + * The total Wages for the Payrun + * @return wages + **/ + @ApiModelProperty(example = "1060.5", value = "The total Wages for the Payrun") + public Float getWages() { + return wages; + } + + public void setWages(Float wages) { + this.wages = wages; + } + + public Payrun deductions(Float deductions) { + this.deductions = deductions; + return this; + } + + /** + * The total Deductions for the Payrun + * @return deductions + **/ + @ApiModelProperty(example = "0.0", value = "The total Deductions for the Payrun") + public Float getDeductions() { + return deductions; + } + + public void setDeductions(Float deductions) { + this.deductions = deductions; + } + + public Payrun tax(Float tax) { + this.tax = tax; + return this; + } + + /** + * The total Tax for the Payrun + * @return tax + **/ + @ApiModelProperty(example = "198.0", value = "The total Tax for the Payrun") + public Float getTax() { + return tax; + } + + public void setTax(Float tax) { + this.tax = tax; + } + + public Payrun _super(Float _super) { + this._super = _super; + return this; + } + + /** + * The total Super for the Payrun + * @return _super + **/ + @ApiModelProperty(example = "75.6", value = "The total Super for the Payrun") + public Float getSuper() { + return _super; + } + + public void setSuper(Float _super) { + this._super = _super; + } + + public Payrun reimbursements(Float reimbursements) { + this.reimbursements = reimbursements; + return this; + } + + /** + * The total Reimbursements for the Payrun + * @return reimbursements + **/ + @ApiModelProperty(example = "0.0", value = "The total Reimbursements for the Payrun") + public Float getReimbursements() { + return reimbursements; + } + + public void setReimbursements(Float reimbursements) { + this.reimbursements = reimbursements; + } + + public Payrun netPay(Float netPay) { + this.netPay = netPay; + return this; + } + + /** + * The total NetPay for the Payrun + * @return netPay + **/ + @ApiModelProperty(example = "862.5", value = "The total NetPay for the Payrun") + public Float getNetPay() { + return netPay; + } + + public void setNetPay(Float netPay) { + this.netPay = netPay; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Payrun payrun = (Payrun) o; + return Objects.equals(this.payrollCalendarID, payrun.payrollCalendarID) && + Objects.equals(this.payRunID, payrun.payRunID) && + Objects.equals(this.payRunPeriodStartDate, payrun.payRunPeriodStartDate) && + Objects.equals(this.payRunPeriodEndDate, payrun.payRunPeriodEndDate) && + Objects.equals(this.payRunStatus, payrun.payRunStatus) && + Objects.equals(this.paymentDate, payrun.paymentDate) && + Objects.equals(this.payslipMessage, payrun.payslipMessage) && + Objects.equals(this.updatedDateUTC, payrun.updatedDateUTC) && + Objects.equals(this.payslips, payrun.payslips) && + Objects.equals(this.wages, payrun.wages) && + Objects.equals(this.deductions, payrun.deductions) && + Objects.equals(this.tax, payrun.tax) && + Objects.equals(this._super, payrun._super) && + Objects.equals(this.reimbursements, payrun.reimbursements) && + Objects.equals(this.netPay, payrun.netPay); + } + + @Override + public int hashCode() { + return Objects.hash(payrollCalendarID, payRunID, payRunPeriodStartDate, payRunPeriodEndDate, payRunStatus, paymentDate, payslipMessage, updatedDateUTC, payslips, wages, deductions, tax, _super, reimbursements, netPay); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Payrun {\n"); + sb.append(" payrollCalendarID: ").append(toIndentedString(payrollCalendarID)).append("\n"); + sb.append(" payRunID: ").append(toIndentedString(payRunID)).append("\n"); + sb.append(" payRunPeriodStartDate: ").append(toIndentedString(payRunPeriodStartDate)).append("\n"); + sb.append(" payRunPeriodEndDate: ").append(toIndentedString(payRunPeriodEndDate)).append("\n"); + sb.append(" payRunStatus: ").append(toIndentedString(payRunStatus)).append("\n"); + sb.append(" paymentDate: ").append(toIndentedString(paymentDate)).append("\n"); + sb.append(" payslipMessage: ").append(toIndentedString(payslipMessage)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append(" payslips: ").append(toIndentedString(payslips)).append("\n"); + sb.append(" wages: ").append(toIndentedString(wages)).append("\n"); + sb.append(" deductions: ").append(toIndentedString(deductions)).append("\n"); + sb.append(" tax: ").append(toIndentedString(tax)).append("\n"); + sb.append(" _super: ").append(toIndentedString(_super)).append("\n"); + sb.append(" reimbursements: ").append(toIndentedString(reimbursements)).append("\n"); + sb.append(" netPay: ").append(toIndentedString(netPay)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/Payruns.java b/src/main/java/com/xero/models/payrollau/Payruns.java new file mode 100644 index 00000000..bb3e1d59 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/Payruns.java @@ -0,0 +1,104 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.Payrun; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Payruns + */ + +public class Payruns { + + @JsonProperty("Payruns") + private List payruns = new ArrayList(); + + public Payruns payruns(List payruns) { + this.payruns = payruns; + return this; + } + + public Payruns addPayrunsItem(Payrun payrunsItem) { + if (this.payruns == null) { + this.payruns = new ArrayList(); + } + this.payruns.add(payrunsItem); + return this; + } + + /** + * Get payruns + * @return payruns + **/ + @ApiModelProperty(value = "") + public List getPayruns() { + return payruns; + } + + public void setPayruns(List payruns) { + this.payruns = payruns; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Payruns payruns = (Payruns) o; + return Objects.equals(this.payruns, payruns.payruns); + } + + @Override + public int hashCode() { + return Objects.hash(payruns); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Payruns {\n"); + sb.append(" payruns: ").append(toIndentedString(payruns)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/Payslip.java b/src/main/java/com/xero/models/payrollau/Payslip.java new file mode 100644 index 00000000..f4c77633 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/Payslip.java @@ -0,0 +1,599 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.PayslipDeductionLine; +import com.xero.models.payrollau.PayslipEarningsLines; +import com.xero.models.payrollau.PayslipLeaveAccrualLine; +import com.xero.models.payrollau.PayslipLeaveEarningsLines; +import com.xero.models.payrollau.PayslipReimbursementLine; +import com.xero.models.payrollau.PayslipSuperannuationLine; +import com.xero.models.payrollau.PayslipTaxLine; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Payslip + */ + +public class Payslip { + + @JsonProperty("EmployeeID") + private Object employeeID = null; + + + @JsonProperty("PayslipID") + private Object payslipID = null; + + + @JsonProperty("FirstName") + private String firstName; + + + @JsonProperty("LastName") + private String lastName; + + + @JsonProperty("Wages") + private Float wages; + + + @JsonProperty("Deductions") + private Float deductions; + + + @JsonProperty("Tax") + private Float tax; + + + @JsonProperty("Super") + private Float _super; + + + @JsonProperty("Reimbursements") + private Float reimbursements; + + + @JsonProperty("NetPay") + private Float netPay; + + + @JsonProperty("EarningsLines") + private List earningsLines = new ArrayList(); + + + @JsonProperty("LeaveEarningsLines") + private List leaveEarningsLines = new ArrayList(); + + + @JsonProperty("TimesheetEarningsLines") + private List timesheetEarningsLines = new ArrayList(); + + + @JsonProperty("DeductionLine") + private List deductionLine = new ArrayList(); + + + @JsonProperty("LeaveAccrualLine") + private List leaveAccrualLine = new ArrayList(); + + + @JsonProperty("ReimbursementLine") + private List reimbursementLine = new ArrayList(); + + + @JsonProperty("SuperannuationLine") + private List superannuationLine = new ArrayList(); + + + @JsonProperty("TaxLine") + private List taxLine = new ArrayList(); + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + public Payslip employeeID(Object employeeID) { + this.employeeID = employeeID; + return this; + } + + /** + * The Xero identifier for an employee + * @return employeeID + **/ + @ApiModelProperty(example = "4729f087-8eec-49c1-8294-4d11a5a0a37c", value = "The Xero identifier for an employee") + public Object getEmployeeID() { + return employeeID; + } + + public void setEmployeeID(Object employeeID) { + this.employeeID = employeeID; + } + + public Payslip payslipID(Object payslipID) { + this.payslipID = payslipID; + return this; + } + + /** + * Xero identifier for the payslip + * @return payslipID + **/ + @ApiModelProperty(example = "f3c0874d-7cdd-459a-a95c-d90d51decc42", value = "Xero identifier for the payslip") + public Object getPayslipID() { + return payslipID; + } + + public void setPayslipID(Object payslipID) { + this.payslipID = payslipID; + } + + public Payslip firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * First name of employee + * @return firstName + **/ + @ApiModelProperty(example = "Karen", value = "First name of employee") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public Payslip lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Last name of employee + * @return lastName + **/ + @ApiModelProperty(example = "Jones", value = "Last name of employee") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public Payslip wages(Float wages) { + this.wages = wages; + return this; + } + + /** + * The Wages for the Payslip + * @return wages + **/ + @ApiModelProperty(example = "1060.5", value = "The Wages for the Payslip") + public Float getWages() { + return wages; + } + + public void setWages(Float wages) { + this.wages = wages; + } + + public Payslip deductions(Float deductions) { + this.deductions = deductions; + return this; + } + + /** + * The Deductions for the Payslip + * @return deductions + **/ + @ApiModelProperty(example = "0.0", value = "The Deductions for the Payslip") + public Float getDeductions() { + return deductions; + } + + public void setDeductions(Float deductions) { + this.deductions = deductions; + } + + public Payslip tax(Float tax) { + this.tax = tax; + return this; + } + + /** + * The Tax for the Payslip + * @return tax + **/ + @ApiModelProperty(example = "198.0", value = "The Tax for the Payslip") + public Float getTax() { + return tax; + } + + public void setTax(Float tax) { + this.tax = tax; + } + + public Payslip _super(Float _super) { + this._super = _super; + return this; + } + + /** + * The Super for the Payslip + * @return _super + **/ + @ApiModelProperty(example = "75.6", value = "The Super for the Payslip") + public Float getSuper() { + return _super; + } + + public void setSuper(Float _super) { + this._super = _super; + } + + public Payslip reimbursements(Float reimbursements) { + this.reimbursements = reimbursements; + return this; + } + + /** + * The Reimbursements for the Payslip + * @return reimbursements + **/ + @ApiModelProperty(example = "0.0", value = "The Reimbursements for the Payslip") + public Float getReimbursements() { + return reimbursements; + } + + public void setReimbursements(Float reimbursements) { + this.reimbursements = reimbursements; + } + + public Payslip netPay(Float netPay) { + this.netPay = netPay; + return this; + } + + /** + * The NetPay for the Payslip + * @return netPay + **/ + @ApiModelProperty(example = "862.5", value = "The NetPay for the Payslip") + public Float getNetPay() { + return netPay; + } + + public void setNetPay(Float netPay) { + this.netPay = netPay; + } + + public Payslip earningsLines(List earningsLines) { + this.earningsLines = earningsLines; + return this; + } + + public Payslip addEarningsLinesItem(PayslipEarningsLines earningsLinesItem) { + if (this.earningsLines == null) { + this.earningsLines = new ArrayList(); + } + this.earningsLines.add(earningsLinesItem); + return this; + } + + /** + * Get earningsLines + * @return earningsLines + **/ + @ApiModelProperty(value = "") + public List getEarningsLines() { + return earningsLines; + } + + public void setEarningsLines(List earningsLines) { + this.earningsLines = earningsLines; + } + + public Payslip leaveEarningsLines(List leaveEarningsLines) { + this.leaveEarningsLines = leaveEarningsLines; + return this; + } + + public Payslip addLeaveEarningsLinesItem(PayslipLeaveEarningsLines leaveEarningsLinesItem) { + if (this.leaveEarningsLines == null) { + this.leaveEarningsLines = new ArrayList(); + } + this.leaveEarningsLines.add(leaveEarningsLinesItem); + return this; + } + + /** + * Get leaveEarningsLines + * @return leaveEarningsLines + **/ + @ApiModelProperty(value = "") + public List getLeaveEarningsLines() { + return leaveEarningsLines; + } + + public void setLeaveEarningsLines(List leaveEarningsLines) { + this.leaveEarningsLines = leaveEarningsLines; + } + + public Payslip timesheetEarningsLines(List timesheetEarningsLines) { + this.timesheetEarningsLines = timesheetEarningsLines; + return this; + } + + public Payslip addTimesheetEarningsLinesItem(PayslipLeaveEarningsLines timesheetEarningsLinesItem) { + if (this.timesheetEarningsLines == null) { + this.timesheetEarningsLines = new ArrayList(); + } + this.timesheetEarningsLines.add(timesheetEarningsLinesItem); + return this; + } + + /** + * Get timesheetEarningsLines + * @return timesheetEarningsLines + **/ + @ApiModelProperty(value = "") + public List getTimesheetEarningsLines() { + return timesheetEarningsLines; + } + + public void setTimesheetEarningsLines(List timesheetEarningsLines) { + this.timesheetEarningsLines = timesheetEarningsLines; + } + + public Payslip deductionLine(List deductionLine) { + this.deductionLine = deductionLine; + return this; + } + + public Payslip addDeductionLineItem(PayslipDeductionLine deductionLineItem) { + if (this.deductionLine == null) { + this.deductionLine = new ArrayList(); + } + this.deductionLine.add(deductionLineItem); + return this; + } + + /** + * Get deductionLine + * @return deductionLine + **/ + @ApiModelProperty(value = "") + public List getDeductionLine() { + return deductionLine; + } + + public void setDeductionLine(List deductionLine) { + this.deductionLine = deductionLine; + } + + public Payslip leaveAccrualLine(List leaveAccrualLine) { + this.leaveAccrualLine = leaveAccrualLine; + return this; + } + + public Payslip addLeaveAccrualLineItem(PayslipLeaveAccrualLine leaveAccrualLineItem) { + if (this.leaveAccrualLine == null) { + this.leaveAccrualLine = new ArrayList(); + } + this.leaveAccrualLine.add(leaveAccrualLineItem); + return this; + } + + /** + * Get leaveAccrualLine + * @return leaveAccrualLine + **/ + @ApiModelProperty(value = "") + public List getLeaveAccrualLine() { + return leaveAccrualLine; + } + + public void setLeaveAccrualLine(List leaveAccrualLine) { + this.leaveAccrualLine = leaveAccrualLine; + } + + public Payslip reimbursementLine(List reimbursementLine) { + this.reimbursementLine = reimbursementLine; + return this; + } + + public Payslip addReimbursementLineItem(PayslipReimbursementLine reimbursementLineItem) { + if (this.reimbursementLine == null) { + this.reimbursementLine = new ArrayList(); + } + this.reimbursementLine.add(reimbursementLineItem); + return this; + } + + /** + * Get reimbursementLine + * @return reimbursementLine + **/ + @ApiModelProperty(value = "") + public List getReimbursementLine() { + return reimbursementLine; + } + + public void setReimbursementLine(List reimbursementLine) { + this.reimbursementLine = reimbursementLine; + } + + public Payslip superannuationLine(List superannuationLine) { + this.superannuationLine = superannuationLine; + return this; + } + + public Payslip addSuperannuationLineItem(PayslipSuperannuationLine superannuationLineItem) { + if (this.superannuationLine == null) { + this.superannuationLine = new ArrayList(); + } + this.superannuationLine.add(superannuationLineItem); + return this; + } + + /** + * Get superannuationLine + * @return superannuationLine + **/ + @ApiModelProperty(value = "") + public List getSuperannuationLine() { + return superannuationLine; + } + + public void setSuperannuationLine(List superannuationLine) { + this.superannuationLine = superannuationLine; + } + + public Payslip taxLine(List taxLine) { + this.taxLine = taxLine; + return this; + } + + public Payslip addTaxLineItem(PayslipTaxLine taxLineItem) { + if (this.taxLine == null) { + this.taxLine = new ArrayList(); + } + this.taxLine.add(taxLineItem); + return this; + } + + /** + * Get taxLine + * @return taxLine + **/ + @ApiModelProperty(value = "") + public List getTaxLine() { + return taxLine; + } + + public void setTaxLine(List taxLine) { + this.taxLine = taxLine; + } + + public Payslip updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * Last modified timestamp + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Last modified timestamp") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Payslip payslip = (Payslip) o; + return Objects.equals(this.employeeID, payslip.employeeID) && + Objects.equals(this.payslipID, payslip.payslipID) && + Objects.equals(this.firstName, payslip.firstName) && + Objects.equals(this.lastName, payslip.lastName) && + Objects.equals(this.wages, payslip.wages) && + Objects.equals(this.deductions, payslip.deductions) && + Objects.equals(this.tax, payslip.tax) && + Objects.equals(this._super, payslip._super) && + Objects.equals(this.reimbursements, payslip.reimbursements) && + Objects.equals(this.netPay, payslip.netPay) && + Objects.equals(this.earningsLines, payslip.earningsLines) && + Objects.equals(this.leaveEarningsLines, payslip.leaveEarningsLines) && + Objects.equals(this.timesheetEarningsLines, payslip.timesheetEarningsLines) && + Objects.equals(this.deductionLine, payslip.deductionLine) && + Objects.equals(this.leaveAccrualLine, payslip.leaveAccrualLine) && + Objects.equals(this.reimbursementLine, payslip.reimbursementLine) && + Objects.equals(this.superannuationLine, payslip.superannuationLine) && + Objects.equals(this.taxLine, payslip.taxLine) && + Objects.equals(this.updatedDateUTC, payslip.updatedDateUTC); + } + + @Override + public int hashCode() { + return Objects.hash(employeeID, payslipID, firstName, lastName, wages, deductions, tax, _super, reimbursements, netPay, earningsLines, leaveEarningsLines, timesheetEarningsLines, deductionLine, leaveAccrualLine, reimbursementLine, superannuationLine, taxLine, updatedDateUTC); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Payslip {\n"); + sb.append(" employeeID: ").append(toIndentedString(employeeID)).append("\n"); + sb.append(" payslipID: ").append(toIndentedString(payslipID)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" wages: ").append(toIndentedString(wages)).append("\n"); + sb.append(" deductions: ").append(toIndentedString(deductions)).append("\n"); + sb.append(" tax: ").append(toIndentedString(tax)).append("\n"); + sb.append(" _super: ").append(toIndentedString(_super)).append("\n"); + sb.append(" reimbursements: ").append(toIndentedString(reimbursements)).append("\n"); + sb.append(" netPay: ").append(toIndentedString(netPay)).append("\n"); + sb.append(" earningsLines: ").append(toIndentedString(earningsLines)).append("\n"); + sb.append(" leaveEarningsLines: ").append(toIndentedString(leaveEarningsLines)).append("\n"); + sb.append(" timesheetEarningsLines: ").append(toIndentedString(timesheetEarningsLines)).append("\n"); + sb.append(" deductionLine: ").append(toIndentedString(deductionLine)).append("\n"); + sb.append(" leaveAccrualLine: ").append(toIndentedString(leaveAccrualLine)).append("\n"); + sb.append(" reimbursementLine: ").append(toIndentedString(reimbursementLine)).append("\n"); + sb.append(" superannuationLine: ").append(toIndentedString(superannuationLine)).append("\n"); + sb.append(" taxLine: ").append(toIndentedString(taxLine)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayslipDeductionLine.java b/src/main/java/com/xero/models/payrollau/PayslipDeductionLine.java new file mode 100644 index 00000000..3b8f18c6 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayslipDeductionLine.java @@ -0,0 +1,167 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.DeductionTypeCalculationType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayslipDeductionLine + */ + +public class PayslipDeductionLine { + + @JsonProperty("DeductionTypeID") + private UUID deductionTypeID; + + + @JsonProperty("CalculationType") + private DeductionTypeCalculationType calculationType; + + + @JsonProperty("Percentage") + private Float percentage; + + + @JsonProperty("NumberOfUnits") + private Float numberOfUnits; + + public PayslipDeductionLine deductionTypeID(UUID deductionTypeID) { + this.deductionTypeID = deductionTypeID; + return this; + } + + /** + * Xero identifier for the deduction type + * @return deductionTypeID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier for the deduction type") + public UUID getDeductionTypeID() { + return deductionTypeID; + } + + public void setDeductionTypeID(UUID deductionTypeID) { + this.deductionTypeID = deductionTypeID; + } + + public PayslipDeductionLine calculationType(DeductionTypeCalculationType calculationType) { + this.calculationType = calculationType; + return this; + } + + /** + * Get calculationType + * @return calculationType + **/ + @ApiModelProperty(value = "") + public DeductionTypeCalculationType getCalculationType() { + return calculationType; + } + + public void setCalculationType(DeductionTypeCalculationType calculationType) { + this.calculationType = calculationType; + } + + public PayslipDeductionLine percentage(Float percentage) { + this.percentage = percentage; + return this; + } + + /** + * The Percentage of the Deduction. + * @return percentage + **/ + @ApiModelProperty(example = "2.5", value = "The Percentage of the Deduction.") + public Float getPercentage() { + return percentage; + } + + public void setPercentage(Float percentage) { + this.percentage = percentage; + } + + public PayslipDeductionLine numberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + return this; + } + + /** + * Deduction number of units + * @return numberOfUnits + **/ + @ApiModelProperty(example = "105.5", value = "Deduction number of units") + public Float getNumberOfUnits() { + return numberOfUnits; + } + + public void setNumberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayslipDeductionLine payslipDeductionLine = (PayslipDeductionLine) o; + return Objects.equals(this.deductionTypeID, payslipDeductionLine.deductionTypeID) && + Objects.equals(this.calculationType, payslipDeductionLine.calculationType) && + Objects.equals(this.percentage, payslipDeductionLine.percentage) && + Objects.equals(this.numberOfUnits, payslipDeductionLine.numberOfUnits); + } + + @Override + public int hashCode() { + return Objects.hash(deductionTypeID, calculationType, percentage, numberOfUnits); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayslipDeductionLine {\n"); + sb.append(" deductionTypeID: ").append(toIndentedString(deductionTypeID)).append("\n"); + sb.append(" calculationType: ").append(toIndentedString(calculationType)).append("\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayslipEarningsLines.java b/src/main/java/com/xero/models/payrollau/PayslipEarningsLines.java new file mode 100644 index 00000000..79b06f50 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayslipEarningsLines.java @@ -0,0 +1,166 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayslipEarningsLines + */ + +public class PayslipEarningsLines { + + @JsonProperty("EarningsRateID") + private UUID earningsRateID; + + + @JsonProperty("RatePerUnit") + private Float ratePerUnit; + + + @JsonProperty("NumberOfUnits") + private Float numberOfUnits; + + + @JsonProperty("FixedAmount") + private Float fixedAmount; + + public PayslipEarningsLines earningsRateID(UUID earningsRateID) { + this.earningsRateID = earningsRateID; + return this; + } + + /** + * Xero identifier + * @return earningsRateID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier") + public UUID getEarningsRateID() { + return earningsRateID; + } + + public void setEarningsRateID(UUID earningsRateID) { + this.earningsRateID = earningsRateID; + } + + public PayslipEarningsLines ratePerUnit(Float ratePerUnit) { + this.ratePerUnit = ratePerUnit; + return this; + } + + /** + * Rate per unit of the EarningsLine. + * @return ratePerUnit + **/ + @ApiModelProperty(example = "38.0", value = "Rate per unit of the EarningsLine.") + public Float getRatePerUnit() { + return ratePerUnit; + } + + public void setRatePerUnit(Float ratePerUnit) { + this.ratePerUnit = ratePerUnit; + } + + public PayslipEarningsLines numberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + return this; + } + + /** + * Earnings rate number of units. + * @return numberOfUnits + **/ + @ApiModelProperty(example = "2.5", value = "Earnings rate number of units.") + public Float getNumberOfUnits() { + return numberOfUnits; + } + + public void setNumberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + } + + public PayslipEarningsLines fixedAmount(Float fixedAmount) { + this.fixedAmount = fixedAmount; + return this; + } + + /** + * Earnings rate amount. Only applicable if the EarningsRate RateType is Fixed + * @return fixedAmount + **/ + @ApiModelProperty(example = "2.5", value = "Earnings rate amount. Only applicable if the EarningsRate RateType is Fixed") + public Float getFixedAmount() { + return fixedAmount; + } + + public void setFixedAmount(Float fixedAmount) { + this.fixedAmount = fixedAmount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayslipEarningsLines payslipEarningsLines = (PayslipEarningsLines) o; + return Objects.equals(this.earningsRateID, payslipEarningsLines.earningsRateID) && + Objects.equals(this.ratePerUnit, payslipEarningsLines.ratePerUnit) && + Objects.equals(this.numberOfUnits, payslipEarningsLines.numberOfUnits) && + Objects.equals(this.fixedAmount, payslipEarningsLines.fixedAmount); + } + + @Override + public int hashCode() { + return Objects.hash(earningsRateID, ratePerUnit, numberOfUnits, fixedAmount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayslipEarningsLines {\n"); + sb.append(" earningsRateID: ").append(toIndentedString(earningsRateID)).append("\n"); + sb.append(" ratePerUnit: ").append(toIndentedString(ratePerUnit)).append("\n"); + sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); + sb.append(" fixedAmount: ").append(toIndentedString(fixedAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayslipLeaveAccrualLine.java b/src/main/java/com/xero/models/payrollau/PayslipLeaveAccrualLine.java new file mode 100644 index 00000000..57f03f95 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayslipLeaveAccrualLine.java @@ -0,0 +1,142 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayslipLeaveAccrualLine + */ + +public class PayslipLeaveAccrualLine { + + @JsonProperty("LeaveTypeID") + private UUID leaveTypeID; + + + @JsonProperty("NumberOfUnits") + private Float numberOfUnits; + + + @JsonProperty("AutoCalculate") + private Boolean autoCalculate; + + public PayslipLeaveAccrualLine leaveTypeID(UUID leaveTypeID) { + this.leaveTypeID = leaveTypeID; + return this; + } + + /** + * Xero identifier for the Leave type. + * @return leaveTypeID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier for the Leave type.") + public UUID getLeaveTypeID() { + return leaveTypeID; + } + + public void setLeaveTypeID(UUID leaveTypeID) { + this.leaveTypeID = leaveTypeID; + } + + public PayslipLeaveAccrualLine numberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + return this; + } + + /** + * Leave Accrual number of units + * @return numberOfUnits + **/ + @ApiModelProperty(example = "105.5", value = "Leave Accrual number of units") + public Float getNumberOfUnits() { + return numberOfUnits; + } + + public void setNumberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + } + + public PayslipLeaveAccrualLine autoCalculate(Boolean autoCalculate) { + this.autoCalculate = autoCalculate; + return this; + } + + /** + * If you want to auto calculate leave. + * @return autoCalculate + **/ + @ApiModelProperty(example = "true", value = "If you want to auto calculate leave.") + public Boolean getAutoCalculate() { + return autoCalculate; + } + + public void setAutoCalculate(Boolean autoCalculate) { + this.autoCalculate = autoCalculate; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayslipLeaveAccrualLine payslipLeaveAccrualLine = (PayslipLeaveAccrualLine) o; + return Objects.equals(this.leaveTypeID, payslipLeaveAccrualLine.leaveTypeID) && + Objects.equals(this.numberOfUnits, payslipLeaveAccrualLine.numberOfUnits) && + Objects.equals(this.autoCalculate, payslipLeaveAccrualLine.autoCalculate); + } + + @Override + public int hashCode() { + return Objects.hash(leaveTypeID, numberOfUnits, autoCalculate); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayslipLeaveAccrualLine {\n"); + sb.append(" leaveTypeID: ").append(toIndentedString(leaveTypeID)).append("\n"); + sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); + sb.append(" autoCalculate: ").append(toIndentedString(autoCalculate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayslipLeaveEarningsLines.java b/src/main/java/com/xero/models/payrollau/PayslipLeaveEarningsLines.java new file mode 100644 index 00000000..fc949e42 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayslipLeaveEarningsLines.java @@ -0,0 +1,142 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayslipLeaveEarningsLines + */ + +public class PayslipLeaveEarningsLines { + + @JsonProperty("EarningsRateID") + private UUID earningsRateID; + + + @JsonProperty("RatePerUnit") + private Float ratePerUnit; + + + @JsonProperty("NumberOfUnits") + private Float numberOfUnits; + + public PayslipLeaveEarningsLines earningsRateID(UUID earningsRateID) { + this.earningsRateID = earningsRateID; + return this; + } + + /** + * Xero identifier + * @return earningsRateID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier") + public UUID getEarningsRateID() { + return earningsRateID; + } + + public void setEarningsRateID(UUID earningsRateID) { + this.earningsRateID = earningsRateID; + } + + public PayslipLeaveEarningsLines ratePerUnit(Float ratePerUnit) { + this.ratePerUnit = ratePerUnit; + return this; + } + + /** + * Rate per unit of the EarningsLine. + * @return ratePerUnit + **/ + @ApiModelProperty(example = "38.0", value = "Rate per unit of the EarningsLine.") + public Float getRatePerUnit() { + return ratePerUnit; + } + + public void setRatePerUnit(Float ratePerUnit) { + this.ratePerUnit = ratePerUnit; + } + + public PayslipLeaveEarningsLines numberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + return this; + } + + /** + * Earnings rate number of units. + * @return numberOfUnits + **/ + @ApiModelProperty(example = "2.5", value = "Earnings rate number of units.") + public Float getNumberOfUnits() { + return numberOfUnits; + } + + public void setNumberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayslipLeaveEarningsLines payslipLeaveEarningsLines = (PayslipLeaveEarningsLines) o; + return Objects.equals(this.earningsRateID, payslipLeaveEarningsLines.earningsRateID) && + Objects.equals(this.ratePerUnit, payslipLeaveEarningsLines.ratePerUnit) && + Objects.equals(this.numberOfUnits, payslipLeaveEarningsLines.numberOfUnits); + } + + @Override + public int hashCode() { + return Objects.hash(earningsRateID, ratePerUnit, numberOfUnits); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayslipLeaveEarningsLines {\n"); + sb.append(" earningsRateID: ").append(toIndentedString(earningsRateID)).append("\n"); + sb.append(" ratePerUnit: ").append(toIndentedString(ratePerUnit)).append("\n"); + sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayslipReimbursementLine.java b/src/main/java/com/xero/models/payrollau/PayslipReimbursementLine.java new file mode 100644 index 00000000..574ac6e8 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayslipReimbursementLine.java @@ -0,0 +1,166 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayslipReimbursementLine + */ + +public class PayslipReimbursementLine { + + @JsonProperty("ReimbursementTypeID") + private UUID reimbursementTypeID; + + + @JsonProperty("Description") + private String description; + + + @JsonProperty("ExpenseAccount") + private String expenseAccount; + + + @JsonProperty("Amount") + private Float amount; + + public PayslipReimbursementLine reimbursementTypeID(UUID reimbursementTypeID) { + this.reimbursementTypeID = reimbursementTypeID; + return this; + } + + /** + * Xero identifier for payroll reimbursement type. + * @return reimbursementTypeID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier for payroll reimbursement type.") + public UUID getReimbursementTypeID() { + return reimbursementTypeID; + } + + public void setReimbursementTypeID(UUID reimbursementTypeID) { + this.reimbursementTypeID = reimbursementTypeID; + } + + public PayslipReimbursementLine description(String description) { + this.description = description; + return this; + } + + /** + * Reimbursement lines description (max length 50) + * @return description + **/ + @ApiModelProperty(example = "For the taxi", value = "Reimbursement lines description (max length 50)") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public PayslipReimbursementLine expenseAccount(String expenseAccount) { + this.expenseAccount = expenseAccount; + return this; + } + + /** + * Reimbursement expense account. For posted pay run you should be able to see expense account code. + * @return expenseAccount + **/ + @ApiModelProperty(example = "420", value = "Reimbursement expense account. For posted pay run you should be able to see expense account code.") + public String getExpenseAccount() { + return expenseAccount; + } + + public void setExpenseAccount(String expenseAccount) { + this.expenseAccount = expenseAccount; + } + + public PayslipReimbursementLine amount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Reimbursement amount + * @return amount + **/ + @ApiModelProperty(example = "10.5", value = "Reimbursement amount") + public Float getAmount() { + return amount; + } + + public void setAmount(Float amount) { + this.amount = amount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayslipReimbursementLine payslipReimbursementLine = (PayslipReimbursementLine) o; + return Objects.equals(this.reimbursementTypeID, payslipReimbursementLine.reimbursementTypeID) && + Objects.equals(this.description, payslipReimbursementLine.description) && + Objects.equals(this.expenseAccount, payslipReimbursementLine.expenseAccount) && + Objects.equals(this.amount, payslipReimbursementLine.amount); + } + + @Override + public int hashCode() { + return Objects.hash(reimbursementTypeID, description, expenseAccount, amount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayslipReimbursementLine {\n"); + sb.append(" reimbursementTypeID: ").append(toIndentedString(reimbursementTypeID)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" expenseAccount: ").append(toIndentedString(expenseAccount)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayslipSummary.java b/src/main/java/com/xero/models/payrollau/PayslipSummary.java new file mode 100644 index 00000000..d0e39ecd --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayslipSummary.java @@ -0,0 +1,334 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayslipSummary + */ + +public class PayslipSummary { + + @JsonProperty("EmployeeID") + private Object employeeID = null; + + + @JsonProperty("PayslipID") + private Object payslipID = null; + + + @JsonProperty("FirstName") + private String firstName; + + + @JsonProperty("LastName") + private String lastName; + + + @JsonProperty("Wages") + private Float wages; + + + @JsonProperty("Deductions") + private Float deductions; + + + @JsonProperty("Tax") + private Float tax; + + + @JsonProperty("Super") + private Float _super; + + + @JsonProperty("Reimbursements") + private Float reimbursements; + + + @JsonProperty("NetPay") + private Float netPay; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + public PayslipSummary employeeID(Object employeeID) { + this.employeeID = employeeID; + return this; + } + + /** + * The Xero identifier for an employee + * @return employeeID + **/ + @ApiModelProperty(example = "4729f087-8eec-49c1-8294-4d11a5a0a37c", value = "The Xero identifier for an employee") + public Object getEmployeeID() { + return employeeID; + } + + public void setEmployeeID(Object employeeID) { + this.employeeID = employeeID; + } + + public PayslipSummary payslipID(Object payslipID) { + this.payslipID = payslipID; + return this; + } + + /** + * Xero identifier for the payslip + * @return payslipID + **/ + @ApiModelProperty(example = "f3c0874d-7cdd-459a-a95c-d90d51decc42", value = "Xero identifier for the payslip") + public Object getPayslipID() { + return payslipID; + } + + public void setPayslipID(Object payslipID) { + this.payslipID = payslipID; + } + + public PayslipSummary firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * First name of employee + * @return firstName + **/ + @ApiModelProperty(example = "Karen", value = "First name of employee") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public PayslipSummary lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Last name of employee + * @return lastName + **/ + @ApiModelProperty(example = "Jones", value = "Last name of employee") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public PayslipSummary wages(Float wages) { + this.wages = wages; + return this; + } + + /** + * The Wages for the Payslip + * @return wages + **/ + @ApiModelProperty(example = "1060.5", value = "The Wages for the Payslip") + public Float getWages() { + return wages; + } + + public void setWages(Float wages) { + this.wages = wages; + } + + public PayslipSummary deductions(Float deductions) { + this.deductions = deductions; + return this; + } + + /** + * The Deductions for the Payslip + * @return deductions + **/ + @ApiModelProperty(example = "0.0", value = "The Deductions for the Payslip") + public Float getDeductions() { + return deductions; + } + + public void setDeductions(Float deductions) { + this.deductions = deductions; + } + + public PayslipSummary tax(Float tax) { + this.tax = tax; + return this; + } + + /** + * The Tax for the Payslip + * @return tax + **/ + @ApiModelProperty(example = "198.0", value = "The Tax for the Payslip") + public Float getTax() { + return tax; + } + + public void setTax(Float tax) { + this.tax = tax; + } + + public PayslipSummary _super(Float _super) { + this._super = _super; + return this; + } + + /** + * The Super for the Payslip + * @return _super + **/ + @ApiModelProperty(example = "75.6", value = "The Super for the Payslip") + public Float getSuper() { + return _super; + } + + public void setSuper(Float _super) { + this._super = _super; + } + + public PayslipSummary reimbursements(Float reimbursements) { + this.reimbursements = reimbursements; + return this; + } + + /** + * The Reimbursements for the Payslip + * @return reimbursements + **/ + @ApiModelProperty(example = "0.0", value = "The Reimbursements for the Payslip") + public Float getReimbursements() { + return reimbursements; + } + + public void setReimbursements(Float reimbursements) { + this.reimbursements = reimbursements; + } + + public PayslipSummary netPay(Float netPay) { + this.netPay = netPay; + return this; + } + + /** + * The NetPay for the Payslip + * @return netPay + **/ + @ApiModelProperty(example = "862.5", value = "The NetPay for the Payslip") + public Float getNetPay() { + return netPay; + } + + public void setNetPay(Float netPay) { + this.netPay = netPay; + } + + public PayslipSummary updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * Last modified timestamp + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Last modified timestamp") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayslipSummary payslipSummary = (PayslipSummary) o; + return Objects.equals(this.employeeID, payslipSummary.employeeID) && + Objects.equals(this.payslipID, payslipSummary.payslipID) && + Objects.equals(this.firstName, payslipSummary.firstName) && + Objects.equals(this.lastName, payslipSummary.lastName) && + Objects.equals(this.wages, payslipSummary.wages) && + Objects.equals(this.deductions, payslipSummary.deductions) && + Objects.equals(this.tax, payslipSummary.tax) && + Objects.equals(this._super, payslipSummary._super) && + Objects.equals(this.reimbursements, payslipSummary.reimbursements) && + Objects.equals(this.netPay, payslipSummary.netPay) && + Objects.equals(this.updatedDateUTC, payslipSummary.updatedDateUTC); + } + + @Override + public int hashCode() { + return Objects.hash(employeeID, payslipID, firstName, lastName, wages, deductions, tax, _super, reimbursements, netPay, updatedDateUTC); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayslipSummary {\n"); + sb.append(" employeeID: ").append(toIndentedString(employeeID)).append("\n"); + sb.append(" payslipID: ").append(toIndentedString(payslipID)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" wages: ").append(toIndentedString(wages)).append("\n"); + sb.append(" deductions: ").append(toIndentedString(deductions)).append("\n"); + sb.append(" tax: ").append(toIndentedString(tax)).append("\n"); + sb.append(" _super: ").append(toIndentedString(_super)).append("\n"); + sb.append(" reimbursements: ").append(toIndentedString(reimbursements)).append("\n"); + sb.append(" netPay: ").append(toIndentedString(netPay)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayslipSuperannuationLine.java b/src/main/java/com/xero/models/payrollau/PayslipSuperannuationLine.java new file mode 100644 index 00000000..20281787 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayslipSuperannuationLine.java @@ -0,0 +1,289 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.SuperannuationCalculationType; +import com.xero.models.payrollau.SuperannuationContributionType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; +import org.threeten.bp.LocalDate; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayslipSuperannuationLine + */ + +public class PayslipSuperannuationLine { + + @JsonProperty("SuperMembershipID") + private UUID superMembershipID; + + + @JsonProperty("ContributionType") + private SuperannuationContributionType contributionType; + + + @JsonProperty("CalculationType") + private SuperannuationCalculationType calculationType; + + + @JsonProperty("MinimumMonthlyEarnings") + private Float minimumMonthlyEarnings; + + + @JsonProperty("ExpenseAccountCode") + private String expenseAccountCode; + + + @JsonProperty("LiabilityAccountCode") + private String liabilityAccountCode; + + @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("PaymentDateForThisPeriod") + private LocalDate paymentDateForThisPeriod; + + + @JsonProperty("Percentage") + private Float percentage; + + + @JsonProperty("Amount") + private Float amount; + + public PayslipSuperannuationLine superMembershipID(UUID superMembershipID) { + this.superMembershipID = superMembershipID; + return this; + } + + /** + * Xero identifier for payroll super fund membership ID. + * @return superMembershipID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier for payroll super fund membership ID.") + public UUID getSuperMembershipID() { + return superMembershipID; + } + + public void setSuperMembershipID(UUID superMembershipID) { + this.superMembershipID = superMembershipID; + } + + public PayslipSuperannuationLine contributionType(SuperannuationContributionType contributionType) { + this.contributionType = contributionType; + return this; + } + + /** + * Get contributionType + * @return contributionType + **/ + @ApiModelProperty(value = "") + public SuperannuationContributionType getContributionType() { + return contributionType; + } + + public void setContributionType(SuperannuationContributionType contributionType) { + this.contributionType = contributionType; + } + + public PayslipSuperannuationLine calculationType(SuperannuationCalculationType calculationType) { + this.calculationType = calculationType; + return this; + } + + /** + * Get calculationType + * @return calculationType + **/ + @ApiModelProperty(value = "") + public SuperannuationCalculationType getCalculationType() { + return calculationType; + } + + public void setCalculationType(SuperannuationCalculationType calculationType) { + this.calculationType = calculationType; + } + + public PayslipSuperannuationLine minimumMonthlyEarnings(Float minimumMonthlyEarnings) { + this.minimumMonthlyEarnings = minimumMonthlyEarnings; + return this; + } + + /** + * Superannuation minimum monthly earnings. + * @return minimumMonthlyEarnings + **/ + @ApiModelProperty(example = "100.5", value = "Superannuation minimum monthly earnings.") + public Float getMinimumMonthlyEarnings() { + return minimumMonthlyEarnings; + } + + public void setMinimumMonthlyEarnings(Float minimumMonthlyEarnings) { + this.minimumMonthlyEarnings = minimumMonthlyEarnings; + } + + public PayslipSuperannuationLine expenseAccountCode(String expenseAccountCode) { + this.expenseAccountCode = expenseAccountCode; + return this; + } + + /** + * Superannuation expense account code. + * @return expenseAccountCode + **/ + @ApiModelProperty(example = "450", value = "Superannuation expense account code.") + public String getExpenseAccountCode() { + return expenseAccountCode; + } + + public void setExpenseAccountCode(String expenseAccountCode) { + this.expenseAccountCode = expenseAccountCode; + } + + public PayslipSuperannuationLine liabilityAccountCode(String liabilityAccountCode) { + this.liabilityAccountCode = liabilityAccountCode; + return this; + } + + /** + * Superannuation liability account code + * @return liabilityAccountCode + **/ + @ApiModelProperty(example = "650", value = "Superannuation liability account code") + public String getLiabilityAccountCode() { + return liabilityAccountCode; + } + + public void setLiabilityAccountCode(String liabilityAccountCode) { + this.liabilityAccountCode = liabilityAccountCode; + } + + public PayslipSuperannuationLine paymentDateForThisPeriod(LocalDate paymentDateForThisPeriod) { + this.paymentDateForThisPeriod = paymentDateForThisPeriod; + return this; + } + + /** + * Superannuation payment date for the current period (YYYY-MM-DD) + * @return paymentDateForThisPeriod + **/ + @ApiModelProperty(value = "Superannuation payment date for the current period (YYYY-MM-DD)") + public LocalDate getPaymentDateForThisPeriod() { + return paymentDateForThisPeriod; + } + + public void setPaymentDateForThisPeriod(LocalDate paymentDateForThisPeriod) { + this.paymentDateForThisPeriod = paymentDateForThisPeriod; + } + + public PayslipSuperannuationLine percentage(Float percentage) { + this.percentage = percentage; + return this; + } + + /** + * Superannuation percentage + * @return percentage + **/ + @ApiModelProperty(example = "4.0", value = "Superannuation percentage") + public Float getPercentage() { + return percentage; + } + + public void setPercentage(Float percentage) { + this.percentage = percentage; + } + + public PayslipSuperannuationLine amount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Superannuation amount + * @return amount + **/ + @ApiModelProperty(example = "10.5", value = "Superannuation amount") + public Float getAmount() { + return amount; + } + + public void setAmount(Float amount) { + this.amount = amount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayslipSuperannuationLine payslipSuperannuationLine = (PayslipSuperannuationLine) o; + return Objects.equals(this.superMembershipID, payslipSuperannuationLine.superMembershipID) && + Objects.equals(this.contributionType, payslipSuperannuationLine.contributionType) && + Objects.equals(this.calculationType, payslipSuperannuationLine.calculationType) && + Objects.equals(this.minimumMonthlyEarnings, payslipSuperannuationLine.minimumMonthlyEarnings) && + Objects.equals(this.expenseAccountCode, payslipSuperannuationLine.expenseAccountCode) && + Objects.equals(this.liabilityAccountCode, payslipSuperannuationLine.liabilityAccountCode) && + Objects.equals(this.paymentDateForThisPeriod, payslipSuperannuationLine.paymentDateForThisPeriod) && + Objects.equals(this.percentage, payslipSuperannuationLine.percentage) && + Objects.equals(this.amount, payslipSuperannuationLine.amount); + } + + @Override + public int hashCode() { + return Objects.hash(superMembershipID, contributionType, calculationType, minimumMonthlyEarnings, expenseAccountCode, liabilityAccountCode, paymentDateForThisPeriod, percentage, amount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayslipSuperannuationLine {\n"); + sb.append(" superMembershipID: ").append(toIndentedString(superMembershipID)).append("\n"); + sb.append(" contributionType: ").append(toIndentedString(contributionType)).append("\n"); + sb.append(" calculationType: ").append(toIndentedString(calculationType)).append("\n"); + sb.append(" minimumMonthlyEarnings: ").append(toIndentedString(minimumMonthlyEarnings)).append("\n"); + sb.append(" expenseAccountCode: ").append(toIndentedString(expenseAccountCode)).append("\n"); + sb.append(" liabilityAccountCode: ").append(toIndentedString(liabilityAccountCode)).append("\n"); + sb.append(" paymentDateForThisPeriod: ").append(toIndentedString(paymentDateForThisPeriod)).append("\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayslipTaxLine.java b/src/main/java/com/xero/models/payrollau/PayslipTaxLine.java new file mode 100644 index 00000000..5bdd3c9b --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayslipTaxLine.java @@ -0,0 +1,190 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.ManualTaxType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayslipTaxLine + */ + +public class PayslipTaxLine { + + @JsonProperty("Amount") + private Float amount; + + + @JsonProperty("TaxTypeName") + private String taxTypeName; + + + @JsonProperty("Description") + private String description; + + + @JsonProperty("ManualTaxType") + private ManualTaxType manualTaxType; + + + @JsonProperty("LiabilityAccount") + private String liabilityAccount; + + public PayslipTaxLine amount(Float amount) { + this.amount = amount; + return this; + } + + /** + * The tax line amount + * @return amount + **/ + @ApiModelProperty(example = "50.0", value = "The tax line amount") + public Float getAmount() { + return amount; + } + + public void setAmount(Float amount) { + this.amount = amount; + } + + public PayslipTaxLine taxTypeName(String taxTypeName) { + this.taxTypeName = taxTypeName; + return this; + } + + /** + * Name of the tax type. + * @return taxTypeName + **/ + @ApiModelProperty(example = "Manual Adjustment", value = "Name of the tax type.") + public String getTaxTypeName() { + return taxTypeName; + } + + public void setTaxTypeName(String taxTypeName) { + this.taxTypeName = taxTypeName; + } + + public PayslipTaxLine description(String description) { + this.description = description; + return this; + } + + /** + * Description of the tax line. + * @return description + **/ + @ApiModelProperty(value = "Description of the tax line.") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public PayslipTaxLine manualTaxType(ManualTaxType manualTaxType) { + this.manualTaxType = manualTaxType; + return this; + } + + /** + * Get manualTaxType + * @return manualTaxType + **/ + @ApiModelProperty(value = "") + public ManualTaxType getManualTaxType() { + return manualTaxType; + } + + public void setManualTaxType(ManualTaxType manualTaxType) { + this.manualTaxType = manualTaxType; + } + + public PayslipTaxLine liabilityAccount(String liabilityAccount) { + this.liabilityAccount = liabilityAccount; + return this; + } + + /** + * The tax line liability account code. For posted pay run you should be able to see liability account code + * @return liabilityAccount + **/ + @ApiModelProperty(example = "620", value = "The tax line liability account code. For posted pay run you should be able to see liability account code") + public String getLiabilityAccount() { + return liabilityAccount; + } + + public void setLiabilityAccount(String liabilityAccount) { + this.liabilityAccount = liabilityAccount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayslipTaxLine payslipTaxLine = (PayslipTaxLine) o; + return Objects.equals(this.amount, payslipTaxLine.amount) && + Objects.equals(this.taxTypeName, payslipTaxLine.taxTypeName) && + Objects.equals(this.description, payslipTaxLine.description) && + Objects.equals(this.manualTaxType, payslipTaxLine.manualTaxType) && + Objects.equals(this.liabilityAccount, payslipTaxLine.liabilityAccount); + } + + @Override + public int hashCode() { + return Objects.hash(amount, taxTypeName, description, manualTaxType, liabilityAccount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayslipTaxLine {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" taxTypeName: ").append(toIndentedString(taxTypeName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" manualTaxType: ").append(toIndentedString(manualTaxType)).append("\n"); + sb.append(" liabilityAccount: ").append(toIndentedString(liabilityAccount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/RateType.java b/src/main/java/com/xero/models/payrollau/RateType.java new file mode 100644 index 00000000..1959faa5 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/RateType.java @@ -0,0 +1,59 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets RateType + */ +public enum RateType { + + FIXEDAMOUNT("FIXEDAMOUNT"), + + MULTIPLE_MULTIPLE_OF_EMPLOYEE_S_ORDINARY_EARNINGS_RATE_AN_EARNINGS_RATE_WHICH_IS_DERIVED_FROM_AN_EMPLOYEE_S_ORDINARY_EARNINGS_RATE("MULTIPLE Multiple of Employee’s Ordinary Earnings Rate - an earnings rate which is derived from an employee’s ordinary earnings rate"), + + RATEPERUNIT_AN_EARNINGS_RATE_ALLOWING_ENTRY_OF_A_RATE_PER_UNIT("RATEPERUNIT An earnings rate allowing entry of a rate per unit"); + + private String value; + + RateType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static RateType fromValue(String value) { + for (RateType b : RateType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/ReimbursementLine.java b/src/main/java/com/xero/models/payrollau/ReimbursementLine.java new file mode 100644 index 00000000..8e1f8547 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/ReimbursementLine.java @@ -0,0 +1,118 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * ReimbursementLine + */ + +public class ReimbursementLine { + + @JsonProperty("ReimbursementTypeID") + private UUID reimbursementTypeID; + + + @JsonProperty("Amount") + private Float amount; + + public ReimbursementLine reimbursementTypeID(UUID reimbursementTypeID) { + this.reimbursementTypeID = reimbursementTypeID; + return this; + } + + /** + * Xero reimbursement type identifier + * @return reimbursementTypeID + **/ + @ApiModelProperty(example = "bd246b96-c637-4767-81cf-851ba8fa93c2", value = "Xero reimbursement type identifier") + public UUID getReimbursementTypeID() { + return reimbursementTypeID; + } + + public void setReimbursementTypeID(UUID reimbursementTypeID) { + this.reimbursementTypeID = reimbursementTypeID; + } + + public ReimbursementLine amount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Reimbursement type amount + * @return amount + **/ + @ApiModelProperty(example = "10.0", value = "Reimbursement type amount") + public Float getAmount() { + return amount; + } + + public void setAmount(Float amount) { + this.amount = amount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReimbursementLine reimbursementLine = (ReimbursementLine) o; + return Objects.equals(this.reimbursementTypeID, reimbursementLine.reimbursementTypeID) && + Objects.equals(this.amount, reimbursementLine.amount); + } + + @Override + public int hashCode() { + return Objects.hash(reimbursementTypeID, amount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReimbursementLine {\n"); + sb.append(" reimbursementTypeID: ").append(toIndentedString(reimbursementTypeID)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/ReimbursementLines.java b/src/main/java/com/xero/models/payrollau/ReimbursementLines.java new file mode 100644 index 00000000..5a535b12 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/ReimbursementLines.java @@ -0,0 +1,105 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.ReimbursementLine; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * The reimbursement type lines + */ +@ApiModel(description = "The reimbursement type lines") + +public class ReimbursementLines { + + @JsonProperty("Employee") + private List employee = new ArrayList(); + + public ReimbursementLines employee(List employee) { + this.employee = employee; + return this; + } + + public ReimbursementLines addEmployeeItem(ReimbursementLine employeeItem) { + if (this.employee == null) { + this.employee = new ArrayList(); + } + this.employee.add(employeeItem); + return this; + } + + /** + * Get employee + * @return employee + **/ + @ApiModelProperty(value = "") + public List getEmployee() { + return employee; + } + + public void setEmployee(List employee) { + this.employee = employee; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReimbursementLines reimbursementLines = (ReimbursementLines) o; + return Objects.equals(this.employee, reimbursementLines.employee); + } + + @Override + public int hashCode() { + return Objects.hash(employee); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReimbursementLines {\n"); + sb.append(" employee: ").append(toIndentedString(employee)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/ReimbursementType.java b/src/main/java/com/xero/models/payrollau/ReimbursementType.java new file mode 100644 index 00000000..0eedb84f --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/ReimbursementType.java @@ -0,0 +1,167 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * ReimbursementType + */ + +public class ReimbursementType { + + @JsonProperty("Name") + private String name; + + + @JsonProperty("AccountCode") + private String accountCode; + + + @JsonProperty("ReimbursementTypeID") + private UUID reimbursementTypeID; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + public ReimbursementType name(String name) { + this.name = name; + return this; + } + + /** + * Name of the earnings rate (max length = 100) + * @return name + **/ + @ApiModelProperty(example = "PTO", value = "Name of the earnings rate (max length = 100)") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ReimbursementType accountCode(String accountCode) { + this.accountCode = accountCode; + return this; + } + + /** + * See Accounts + * @return accountCode + **/ + @ApiModelProperty(example = "720", value = "See Accounts") + public String getAccountCode() { + return accountCode; + } + + public void setAccountCode(String accountCode) { + this.accountCode = accountCode; + } + + public ReimbursementType reimbursementTypeID(UUID reimbursementTypeID) { + this.reimbursementTypeID = reimbursementTypeID; + return this; + } + + /** + * Xero identifier + * @return reimbursementTypeID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier") + public UUID getReimbursementTypeID() { + return reimbursementTypeID; + } + + public void setReimbursementTypeID(UUID reimbursementTypeID) { + this.reimbursementTypeID = reimbursementTypeID; + } + + public ReimbursementType updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * Last modified timestamp + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Last modified timestamp") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReimbursementType reimbursementType = (ReimbursementType) o; + return Objects.equals(this.name, reimbursementType.name) && + Objects.equals(this.accountCode, reimbursementType.accountCode) && + Objects.equals(this.reimbursementTypeID, reimbursementType.reimbursementTypeID) && + Objects.equals(this.updatedDateUTC, reimbursementType.updatedDateUTC); + } + + @Override + public int hashCode() { + return Objects.hash(name, accountCode, reimbursementTypeID, updatedDateUTC); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReimbursementType {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" accountCode: ").append(toIndentedString(accountCode)).append("\n"); + sb.append(" reimbursementTypeID: ").append(toIndentedString(reimbursementTypeID)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/ResidencyStatus.java b/src/main/java/com/xero/models/payrollau/ResidencyStatus.java new file mode 100644 index 00000000..eb555468 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/ResidencyStatus.java @@ -0,0 +1,59 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets ResidencyStatus + */ +public enum ResidencyStatus { + + AUSTRALIANRESIDENT("AUSTRALIANRESIDENT"), + + FOREIGNRESIDENT("FOREIGNRESIDENT"), + + WORKINGHOLIDAYMAKER("WORKINGHOLIDAYMAKER"); + + private String value; + + ResidencyStatus(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ResidencyStatus fromValue(String value) { + for (ResidencyStatus b : ResidencyStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/Settings.java b/src/main/java/com/xero/models/payrollau/Settings.java new file mode 100644 index 00000000..70ebd01c --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/Settings.java @@ -0,0 +1,154 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.Account; +import com.xero.models.payrollau.SettingsTrackingCategories; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Settings + */ + +public class Settings { + + @JsonProperty("Accounts") + private List accounts = new ArrayList(); + + + @JsonProperty("TrackingCategories") + private SettingsTrackingCategories trackingCategories = null; + + + @JsonProperty("DaysInPayrollYear") + private BigDecimal daysInPayrollYear; + + public Settings accounts(List accounts) { + this.accounts = accounts; + return this; + } + + public Settings addAccountsItem(Account accountsItem) { + if (this.accounts == null) { + this.accounts = new ArrayList(); + } + this.accounts.add(accountsItem); + return this; + } + + /** + * Payroll Account details for SuperExpense, SuperLiabilty, WagesExpense, PAYGLiability & WagesPayable. + * @return accounts + **/ + @ApiModelProperty(value = "Payroll Account details for SuperExpense, SuperLiabilty, WagesExpense, PAYGLiability & WagesPayable.") + public List getAccounts() { + return accounts; + } + + public void setAccounts(List accounts) { + this.accounts = accounts; + } + + public Settings trackingCategories(SettingsTrackingCategories trackingCategories) { + this.trackingCategories = trackingCategories; + return this; + } + + /** + * Get trackingCategories + * @return trackingCategories + **/ + @ApiModelProperty(value = "") + public SettingsTrackingCategories getTrackingCategories() { + return trackingCategories; + } + + public void setTrackingCategories(SettingsTrackingCategories trackingCategories) { + this.trackingCategories = trackingCategories; + } + + public Settings daysInPayrollYear(BigDecimal daysInPayrollYear) { + this.daysInPayrollYear = daysInPayrollYear; + return this; + } + + /** + * Number of days in the Payroll year + * @return daysInPayrollYear + **/ + @ApiModelProperty(example = "365", value = "Number of days in the Payroll year") + public BigDecimal getDaysInPayrollYear() { + return daysInPayrollYear; + } + + public void setDaysInPayrollYear(BigDecimal daysInPayrollYear) { + this.daysInPayrollYear = daysInPayrollYear; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Settings settings = (Settings) o; + return Objects.equals(this.accounts, settings.accounts) && + Objects.equals(this.trackingCategories, settings.trackingCategories) && + Objects.equals(this.daysInPayrollYear, settings.daysInPayrollYear); + } + + @Override + public int hashCode() { + return Objects.hash(accounts, trackingCategories, daysInPayrollYear); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Settings {\n"); + sb.append(" accounts: ").append(toIndentedString(accounts)).append("\n"); + sb.append(" trackingCategories: ").append(toIndentedString(trackingCategories)).append("\n"); + sb.append(" daysInPayrollYear: ").append(toIndentedString(daysInPayrollYear)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/SettingsTrackingCategories.java b/src/main/java/com/xero/models/payrollau/SettingsTrackingCategories.java new file mode 100644 index 00000000..72b5b2c6 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/SettingsTrackingCategories.java @@ -0,0 +1,120 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.SettingsTrackingCategoriesEmployeeGroups; +import com.xero.models.payrollau.SettingsTrackingCategoriesTimesheetCategories; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Tracking categories for Employees and Timesheets + */ +@ApiModel(description = "Tracking categories for Employees and Timesheets") + +public class SettingsTrackingCategories { + + @JsonProperty("EmployeeGroups") + private SettingsTrackingCategoriesEmployeeGroups employeeGroups = null; + + + @JsonProperty("TimesheetCategories") + private SettingsTrackingCategoriesTimesheetCategories timesheetCategories = null; + + public SettingsTrackingCategories employeeGroups(SettingsTrackingCategoriesEmployeeGroups employeeGroups) { + this.employeeGroups = employeeGroups; + return this; + } + + /** + * Get employeeGroups + * @return employeeGroups + **/ + @ApiModelProperty(value = "") + public SettingsTrackingCategoriesEmployeeGroups getEmployeeGroups() { + return employeeGroups; + } + + public void setEmployeeGroups(SettingsTrackingCategoriesEmployeeGroups employeeGroups) { + this.employeeGroups = employeeGroups; + } + + public SettingsTrackingCategories timesheetCategories(SettingsTrackingCategoriesTimesheetCategories timesheetCategories) { + this.timesheetCategories = timesheetCategories; + return this; + } + + /** + * Get timesheetCategories + * @return timesheetCategories + **/ + @ApiModelProperty(value = "") + public SettingsTrackingCategoriesTimesheetCategories getTimesheetCategories() { + return timesheetCategories; + } + + public void setTimesheetCategories(SettingsTrackingCategoriesTimesheetCategories timesheetCategories) { + this.timesheetCategories = timesheetCategories; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettingsTrackingCategories settingsTrackingCategories = (SettingsTrackingCategories) o; + return Objects.equals(this.employeeGroups, settingsTrackingCategories.employeeGroups) && + Objects.equals(this.timesheetCategories, settingsTrackingCategories.timesheetCategories); + } + + @Override + public int hashCode() { + return Objects.hash(employeeGroups, timesheetCategories); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettingsTrackingCategories {\n"); + sb.append(" employeeGroups: ").append(toIndentedString(employeeGroups)).append("\n"); + sb.append(" timesheetCategories: ").append(toIndentedString(timesheetCategories)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/SettingsTrackingCategoriesEmployeeGroups.java b/src/main/java/com/xero/models/payrollau/SettingsTrackingCategoriesEmployeeGroups.java new file mode 100644 index 00000000..2922c6f8 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/SettingsTrackingCategoriesEmployeeGroups.java @@ -0,0 +1,119 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * The tracking category used for employees + */ +@ApiModel(description = "The tracking category used for employees") + +public class SettingsTrackingCategoriesEmployeeGroups { + + @JsonProperty("TrackingCategoryID") + private UUID trackingCategoryID; + + + @JsonProperty("TrackingCategoryName") + private String trackingCategoryName; + + public SettingsTrackingCategoriesEmployeeGroups trackingCategoryID(UUID trackingCategoryID) { + this.trackingCategoryID = trackingCategoryID; + return this; + } + + /** + * The identifier for the tracking category + * @return trackingCategoryID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "The identifier for the tracking category") + public UUID getTrackingCategoryID() { + return trackingCategoryID; + } + + public void setTrackingCategoryID(UUID trackingCategoryID) { + this.trackingCategoryID = trackingCategoryID; + } + + public SettingsTrackingCategoriesEmployeeGroups trackingCategoryName(String trackingCategoryName) { + this.trackingCategoryName = trackingCategoryName; + return this; + } + + /** + * Name of the tracking category + * @return trackingCategoryName + **/ + @ApiModelProperty(value = "Name of the tracking category") + public String getTrackingCategoryName() { + return trackingCategoryName; + } + + public void setTrackingCategoryName(String trackingCategoryName) { + this.trackingCategoryName = trackingCategoryName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettingsTrackingCategoriesEmployeeGroups settingsTrackingCategoriesEmployeeGroups = (SettingsTrackingCategoriesEmployeeGroups) o; + return Objects.equals(this.trackingCategoryID, settingsTrackingCategoriesEmployeeGroups.trackingCategoryID) && + Objects.equals(this.trackingCategoryName, settingsTrackingCategoriesEmployeeGroups.trackingCategoryName); + } + + @Override + public int hashCode() { + return Objects.hash(trackingCategoryID, trackingCategoryName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettingsTrackingCategoriesEmployeeGroups {\n"); + sb.append(" trackingCategoryID: ").append(toIndentedString(trackingCategoryID)).append("\n"); + sb.append(" trackingCategoryName: ").append(toIndentedString(trackingCategoryName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/SettingsTrackingCategoriesTimesheetCategories.java b/src/main/java/com/xero/models/payrollau/SettingsTrackingCategoriesTimesheetCategories.java new file mode 100644 index 00000000..b4623008 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/SettingsTrackingCategoriesTimesheetCategories.java @@ -0,0 +1,119 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * The tracking category used for timesheets + */ +@ApiModel(description = "The tracking category used for timesheets") + +public class SettingsTrackingCategoriesTimesheetCategories { + + @JsonProperty("TrackingCategoryID") + private UUID trackingCategoryID; + + + @JsonProperty("TrackingCategoryName") + private String trackingCategoryName; + + public SettingsTrackingCategoriesTimesheetCategories trackingCategoryID(UUID trackingCategoryID) { + this.trackingCategoryID = trackingCategoryID; + return this; + } + + /** + * The identifier for the tracking category + * @return trackingCategoryID + **/ + @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "The identifier for the tracking category") + public UUID getTrackingCategoryID() { + return trackingCategoryID; + } + + public void setTrackingCategoryID(UUID trackingCategoryID) { + this.trackingCategoryID = trackingCategoryID; + } + + public SettingsTrackingCategoriesTimesheetCategories trackingCategoryName(String trackingCategoryName) { + this.trackingCategoryName = trackingCategoryName; + return this; + } + + /** + * Name of the tracking category + * @return trackingCategoryName + **/ + @ApiModelProperty(value = "Name of the tracking category") + public String getTrackingCategoryName() { + return trackingCategoryName; + } + + public void setTrackingCategoryName(String trackingCategoryName) { + this.trackingCategoryName = trackingCategoryName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettingsTrackingCategoriesTimesheetCategories settingsTrackingCategoriesTimesheetCategories = (SettingsTrackingCategoriesTimesheetCategories) o; + return Objects.equals(this.trackingCategoryID, settingsTrackingCategoriesTimesheetCategories.trackingCategoryID) && + Objects.equals(this.trackingCategoryName, settingsTrackingCategoriesTimesheetCategories.trackingCategoryName); + } + + @Override + public int hashCode() { + return Objects.hash(trackingCategoryID, trackingCategoryName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettingsTrackingCategoriesTimesheetCategories {\n"); + sb.append(" trackingCategoryID: ").append(toIndentedString(trackingCategoryID)).append("\n"); + sb.append(" trackingCategoryName: ").append(toIndentedString(trackingCategoryName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/State.java b/src/main/java/com/xero/models/payrollau/State.java new file mode 100644 index 00000000..19448d0c --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/State.java @@ -0,0 +1,70 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * State abbreviation for employee home address + */ +public enum State { + + ACT("ACT"), + + NSW("NSW"), + + NT("NT"), + + QLD("QLD"), + + SA("SA"), + + TAS("TAS"), + + VIC("VIC"), + + WA("WA"); + + private String value; + + State(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static State fromValue(String value) { + for (State b : State.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/SuperFundType.java b/src/main/java/com/xero/models/payrollau/SuperFundType.java new file mode 100644 index 00000000..237ba552 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/SuperFundType.java @@ -0,0 +1,57 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets SuperFundType + */ +public enum SuperFundType { + + REGULATED("REGULATED"), + + SMSF("SMSF"); + + private String value; + + SuperFundType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SuperFundType fromValue(String value) { + for (SuperFundType b : SuperFundType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/SuperLine.java b/src/main/java/com/xero/models/payrollau/SuperLine.java new file mode 100644 index 00000000..7e80ca6d --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/SuperLine.java @@ -0,0 +1,264 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.SuperannuationCalculationType; +import com.xero.models.payrollau.SuperannuationContributionType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * SuperLine + */ + +public class SuperLine { + + @JsonProperty("SuperMembershipID") + private UUID superMembershipID; + + + @JsonProperty("ContributionType") + private SuperannuationContributionType contributionType; + + + @JsonProperty("CalculationType") + private SuperannuationCalculationType calculationType; + + + @JsonProperty("MinimumMonthlyEarnings") + private Float minimumMonthlyEarnings; + + + @JsonProperty("ExpenseAccountCode") + private String expenseAccountCode; + + + @JsonProperty("LiabilityAccountCode") + private String liabilityAccountCode; + + + @JsonProperty("Percentage") + private Float percentage; + + + @JsonProperty("Amount") + private Float amount; + + public SuperLine superMembershipID(UUID superMembershipID) { + this.superMembershipID = superMembershipID; + return this; + } + + /** + * Xero super membership ID + * @return superMembershipID + **/ + @ApiModelProperty(example = "4333d5cd-53a5-4c31-98e5-a8b4e5676b0b", value = "Xero super membership ID") + public UUID getSuperMembershipID() { + return superMembershipID; + } + + public void setSuperMembershipID(UUID superMembershipID) { + this.superMembershipID = superMembershipID; + } + + public SuperLine contributionType(SuperannuationContributionType contributionType) { + this.contributionType = contributionType; + return this; + } + + /** + * Get contributionType + * @return contributionType + **/ + @ApiModelProperty(value = "") + public SuperannuationContributionType getContributionType() { + return contributionType; + } + + public void setContributionType(SuperannuationContributionType contributionType) { + this.contributionType = contributionType; + } + + public SuperLine calculationType(SuperannuationCalculationType calculationType) { + this.calculationType = calculationType; + return this; + } + + /** + * Get calculationType + * @return calculationType + **/ + @ApiModelProperty(value = "") + public SuperannuationCalculationType getCalculationType() { + return calculationType; + } + + public void setCalculationType(SuperannuationCalculationType calculationType) { + this.calculationType = calculationType; + } + + public SuperLine minimumMonthlyEarnings(Float minimumMonthlyEarnings) { + this.minimumMonthlyEarnings = minimumMonthlyEarnings; + return this; + } + + /** + * amount of mimimum earnings + * @return minimumMonthlyEarnings + **/ + @ApiModelProperty(example = "450.0", value = "amount of mimimum earnings") + public Float getMinimumMonthlyEarnings() { + return minimumMonthlyEarnings; + } + + public void setMinimumMonthlyEarnings(Float minimumMonthlyEarnings) { + this.minimumMonthlyEarnings = minimumMonthlyEarnings; + } + + public SuperLine expenseAccountCode(String expenseAccountCode) { + this.expenseAccountCode = expenseAccountCode; + return this; + } + + /** + * expense account code + * @return expenseAccountCode + **/ + @ApiModelProperty(example = "478", value = "expense account code") + public String getExpenseAccountCode() { + return expenseAccountCode; + } + + public void setExpenseAccountCode(String expenseAccountCode) { + this.expenseAccountCode = expenseAccountCode; + } + + public SuperLine liabilityAccountCode(String liabilityAccountCode) { + this.liabilityAccountCode = liabilityAccountCode; + return this; + } + + /** + * liabilty account code + * @return liabilityAccountCode + **/ + @ApiModelProperty(example = "826", value = "liabilty account code") + public String getLiabilityAccountCode() { + return liabilityAccountCode; + } + + public void setLiabilityAccountCode(String liabilityAccountCode) { + this.liabilityAccountCode = liabilityAccountCode; + } + + public SuperLine percentage(Float percentage) { + this.percentage = percentage; + return this; + } + + /** + * percentage for super line + * @return percentage + **/ + @ApiModelProperty(example = "9.0", value = "percentage for super line") + public Float getPercentage() { + return percentage; + } + + public void setPercentage(Float percentage) { + this.percentage = percentage; + } + + public SuperLine amount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Super membership amount + * @return amount + **/ + @ApiModelProperty(example = "10.0", value = "Super membership amount") + public Float getAmount() { + return amount; + } + + public void setAmount(Float amount) { + this.amount = amount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SuperLine superLine = (SuperLine) o; + return Objects.equals(this.superMembershipID, superLine.superMembershipID) && + Objects.equals(this.contributionType, superLine.contributionType) && + Objects.equals(this.calculationType, superLine.calculationType) && + Objects.equals(this.minimumMonthlyEarnings, superLine.minimumMonthlyEarnings) && + Objects.equals(this.expenseAccountCode, superLine.expenseAccountCode) && + Objects.equals(this.liabilityAccountCode, superLine.liabilityAccountCode) && + Objects.equals(this.percentage, superLine.percentage) && + Objects.equals(this.amount, superLine.amount); + } + + @Override + public int hashCode() { + return Objects.hash(superMembershipID, contributionType, calculationType, minimumMonthlyEarnings, expenseAccountCode, liabilityAccountCode, percentage, amount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SuperLine {\n"); + sb.append(" superMembershipID: ").append(toIndentedString(superMembershipID)).append("\n"); + sb.append(" contributionType: ").append(toIndentedString(contributionType)).append("\n"); + sb.append(" calculationType: ").append(toIndentedString(calculationType)).append("\n"); + sb.append(" minimumMonthlyEarnings: ").append(toIndentedString(minimumMonthlyEarnings)).append("\n"); + sb.append(" expenseAccountCode: ").append(toIndentedString(expenseAccountCode)).append("\n"); + sb.append(" liabilityAccountCode: ").append(toIndentedString(liabilityAccountCode)).append("\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/SuperMembership.java b/src/main/java/com/xero/models/payrollau/SuperMembership.java new file mode 100644 index 00000000..8fe01bb9 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/SuperMembership.java @@ -0,0 +1,143 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * SuperMembership + */ + +public class SuperMembership { + + @JsonProperty("SuperMembershipID") + private UUID superMembershipID; + + + @JsonProperty("SuperFundID") + private UUID superFundID; + + + @JsonProperty("EmployeeNumber") + private BigDecimal employeeNumber; + + public SuperMembership superMembershipID(UUID superMembershipID) { + this.superMembershipID = superMembershipID; + return this; + } + + /** + * Xero unique identifier for Super membership + * @return superMembershipID + **/ + @ApiModelProperty(example = "4333d5cd-53a5-4c31-98e5-a8b4e5676b0b", value = "Xero unique identifier for Super membership") + public UUID getSuperMembershipID() { + return superMembershipID; + } + + public void setSuperMembershipID(UUID superMembershipID) { + this.superMembershipID = superMembershipID; + } + + public SuperMembership superFundID(UUID superFundID) { + this.superFundID = superFundID; + return this; + } + + /** + * Xero identifier for super fund + * @return superFundID + **/ + @ApiModelProperty(example = "2187a42b-639a-45cb-9eed-cd4ae488306a", required = true, value = "Xero identifier for super fund") + public UUID getSuperFundID() { + return superFundID; + } + + public void setSuperFundID(UUID superFundID) { + this.superFundID = superFundID; + } + + public SuperMembership employeeNumber(BigDecimal employeeNumber) { + this.employeeNumber = employeeNumber; + return this; + } + + /** + * The memberhsip number assigned to the employee by the super fund. + * @return employeeNumber + **/ + @ApiModelProperty(example = "1234", required = true, value = "The memberhsip number assigned to the employee by the super fund.") + public BigDecimal getEmployeeNumber() { + return employeeNumber; + } + + public void setEmployeeNumber(BigDecimal employeeNumber) { + this.employeeNumber = employeeNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SuperMembership superMembership = (SuperMembership) o; + return Objects.equals(this.superMembershipID, superMembership.superMembershipID) && + Objects.equals(this.superFundID, superMembership.superFundID) && + Objects.equals(this.employeeNumber, superMembership.employeeNumber); + } + + @Override + public int hashCode() { + return Objects.hash(superMembershipID, superFundID, employeeNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SuperMembership {\n"); + sb.append(" superMembershipID: ").append(toIndentedString(superMembershipID)).append("\n"); + sb.append(" superFundID: ").append(toIndentedString(superFundID)).append("\n"); + sb.append(" employeeNumber: ").append(toIndentedString(employeeNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/SuperannuationCalculationType.java b/src/main/java/com/xero/models/payrollau/SuperannuationCalculationType.java new file mode 100644 index 00000000..bf53bf44 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/SuperannuationCalculationType.java @@ -0,0 +1,59 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets SuperannuationCalculationType + */ +public enum SuperannuationCalculationType { + + FIXEDAMOUNT("FIXEDAMOUNT"), + + PERCENTAGEOFEARNINGS("PERCENTAGEOFEARNINGS"), + + STATUTORY("STATUTORY"); + + private String value; + + SuperannuationCalculationType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SuperannuationCalculationType fromValue(String value) { + for (SuperannuationCalculationType b : SuperannuationCalculationType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/SuperannuationContributionType.java b/src/main/java/com/xero/models/payrollau/SuperannuationContributionType.java new file mode 100644 index 00000000..878283f5 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/SuperannuationContributionType.java @@ -0,0 +1,61 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets SuperannuationContributionType + */ +public enum SuperannuationContributionType { + + SGC("SGC"), + + SALARYSACRIFICE("SALARYSACRIFICE"), + + EMPLOYERADDITIONAL("EMPLOYERADDITIONAL"), + + EMPLOYEE("EMPLOYEE"); + + private String value; + + SuperannuationContributionType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SuperannuationContributionType fromValue(String value) { + for (SuperannuationContributionType b : SuperannuationContributionType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/Superfund.java b/src/main/java/com/xero/models/payrollau/Superfund.java new file mode 100644 index 00000000..a183c800 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/Superfund.java @@ -0,0 +1,334 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.SuperFundType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Superfund + */ + +public class Superfund { + + @JsonProperty("SuperFundID") + private Object superFundID = null; + + + @JsonProperty("Type") + private SuperFundType type; + + + @JsonProperty("Name") + private String name; + + + @JsonProperty("ABN") + private String ABN; + + + @JsonProperty("BSB") + private String BSB; + + + @JsonProperty("AccountNumber") + private String accountNumber; + + + @JsonProperty("AccountNme") + private String accountNme; + + + @JsonProperty("ElectronicServiceAddress") + private String electronicServiceAddress; + + + @JsonProperty("EmployerNumber") + private String employerNumber; + + + @JsonProperty("SPIN") + private String SPIN; + + + @JsonProperty("USI") + private String USI; + + public Superfund superFundID(Object superFundID) { + this.superFundID = superFundID; + return this; + } + + /** + * Xero identifier for a super fund + * @return superFundID + **/ + @ApiModelProperty(example = "bfac31bd-ea62-4fc8-a5e7-7965d9504b15", value = "Xero identifier for a super fund") + public Object getSuperFundID() { + return superFundID; + } + + public void setSuperFundID(Object superFundID) { + this.superFundID = superFundID; + } + + public Superfund type(SuperFundType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(required = true, value = "") + public SuperFundType getType() { + return type; + } + + public void setType(SuperFundType type) { + this.type = type; + } + + public Superfund name(String name) { + this.name = name; + return this; + } + + /** + * Name of the super fund + * @return name + **/ + @ApiModelProperty(example = "MLC Navigator Retirement Plan - Superannuation Service (including Series 2) (MLC Superannuation Fund)", value = "Name of the super fund") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Superfund ABN(String ABN) { + this.ABN = ABN; + return this; + } + + /** + * ABN of the self managed super fund + * @return ABN + **/ + @ApiModelProperty(example = "40022701955", value = "ABN of the self managed super fund") + public String getABN() { + return ABN; + } + + public void setABN(String ABN) { + this.ABN = ABN; + } + + public Superfund BSB(String BSB) { + this.BSB = BSB; + return this; + } + + /** + * BSB of the self managed super fund + * @return BSB + **/ + @ApiModelProperty(example = "234324", value = "BSB of the self managed super fund") + public String getBSB() { + return BSB; + } + + public void setBSB(String BSB) { + this.BSB = BSB; + } + + public Superfund accountNumber(String accountNumber) { + this.accountNumber = accountNumber; + return this; + } + + /** + * The account number for the self managed super fund. + * @return accountNumber + **/ + @ApiModelProperty(example = "234234234", value = "The account number for the self managed super fund.") + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public Superfund accountNme(String accountNme) { + this.accountNme = accountNme; + return this; + } + + /** + * The account name for the self managed super fund. + * @return accountNme + **/ + @ApiModelProperty(example = "Money account", value = "The account name for the self managed super fund.") + public String getAccountNme() { + return accountNme; + } + + public void setAccountNme(String accountNme) { + this.accountNme = accountNme; + } + + public Superfund electronicServiceAddress(String electronicServiceAddress) { + this.electronicServiceAddress = electronicServiceAddress; + return this; + } + + /** + * The electronic service address for the self managed super fund. + * @return electronicServiceAddress + **/ + @ApiModelProperty(example = "12345678", value = "The electronic service address for the self managed super fund.") + public String getElectronicServiceAddress() { + return electronicServiceAddress; + } + + public void setElectronicServiceAddress(String electronicServiceAddress) { + this.electronicServiceAddress = electronicServiceAddress; + } + + public Superfund employerNumber(String employerNumber) { + this.employerNumber = employerNumber; + return this; + } + + /** + * Some funds assign a unique number to each employer + * @return employerNumber + **/ + @ApiModelProperty(example = "324324", value = "Some funds assign a unique number to each employer") + public String getEmployerNumber() { + return employerNumber; + } + + public void setEmployerNumber(String employerNumber) { + this.employerNumber = employerNumber; + } + + public Superfund SPIN(String SPIN) { + this.SPIN = SPIN; + return this; + } + + /** + * The SPIN of the Regulated SuperFund. This field has been deprecated. It will only be present for legacy superfunds. New superfunds will not have a SPIN value. The USI field should be used instead of SPIN. + * @return SPIN + **/ + @ApiModelProperty(example = "4545445454", value = "The SPIN of the Regulated SuperFund. This field has been deprecated. It will only be present for legacy superfunds. New superfunds will not have a SPIN value. The USI field should be used instead of SPIN.") + public String getSPIN() { + return SPIN; + } + + public void setSPIN(String SPIN) { + this.SPIN = SPIN; + } + + public Superfund USI(String USI) { + this.USI = USI; + return this; + } + + /** + * The USI of the Regulated SuperFund + * @return USI + **/ + @ApiModelProperty(example = "40022701955001", value = "The USI of the Regulated SuperFund") + public String getUSI() { + return USI; + } + + public void setUSI(String USI) { + this.USI = USI; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Superfund superfund = (Superfund) o; + return Objects.equals(this.superFundID, superfund.superFundID) && + Objects.equals(this.type, superfund.type) && + Objects.equals(this.name, superfund.name) && + Objects.equals(this.ABN, superfund.ABN) && + Objects.equals(this.BSB, superfund.BSB) && + Objects.equals(this.accountNumber, superfund.accountNumber) && + Objects.equals(this.accountNme, superfund.accountNme) && + Objects.equals(this.electronicServiceAddress, superfund.electronicServiceAddress) && + Objects.equals(this.employerNumber, superfund.employerNumber) && + Objects.equals(this.SPIN, superfund.SPIN) && + Objects.equals(this.USI, superfund.USI); + } + + @Override + public int hashCode() { + return Objects.hash(superFundID, type, name, ABN, BSB, accountNumber, accountNme, electronicServiceAddress, employerNumber, SPIN, USI); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Superfund {\n"); + sb.append(" superFundID: ").append(toIndentedString(superFundID)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" ABN: ").append(toIndentedString(ABN)).append("\n"); + sb.append(" BSB: ").append(toIndentedString(BSB)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" accountNme: ").append(toIndentedString(accountNme)).append("\n"); + sb.append(" electronicServiceAddress: ").append(toIndentedString(electronicServiceAddress)).append("\n"); + sb.append(" employerNumber: ").append(toIndentedString(employerNumber)).append("\n"); + sb.append(" SPIN: ").append(toIndentedString(SPIN)).append("\n"); + sb.append(" USI: ").append(toIndentedString(USI)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/SuperfundProduct.java b/src/main/java/com/xero/models/payrollau/SuperfundProduct.java new file mode 100644 index 00000000..c3132c75 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/SuperfundProduct.java @@ -0,0 +1,165 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * SuperfundProduct + */ + +public class SuperfundProduct { + + @JsonProperty("ABN") + private Object ABN = null; + + + @JsonProperty("USI") + private Object USI = null; + + + @JsonProperty("SPIN") + private Object SPIN = null; + + + @JsonProperty("ProductName") + private Object productName = null; + + public SuperfundProduct ABN(Object ABN) { + this.ABN = ABN; + return this; + } + + /** + * The ABN of the Regulated SuperFund + * @return ABN + **/ + @ApiModelProperty(example = "839182848805", value = "The ABN of the Regulated SuperFund") + public Object getABN() { + return ABN; + } + + public void setABN(Object ABN) { + this.ABN = ABN; + } + + public SuperfundProduct USI(Object USI) { + this.USI = USI; + return this; + } + + /** + * The USI of the Regulated SuperFund + * @return USI + **/ + @ApiModelProperty(example = "839182848805001", value = "The USI of the Regulated SuperFund") + public Object getUSI() { + return USI; + } + + public void setUSI(Object USI) { + this.USI = USI; + } + + public SuperfundProduct SPIN(Object SPIN) { + this.SPIN = SPIN; + return this; + } + + /** + * The SPIN of the Regulated SuperFund. This field has been deprecated. New superfunds will not have a SPIN value. The USI field should be used instead of SPIN + * @return SPIN + **/ + @ApiModelProperty(example = "NML0117AU", value = "The SPIN of the Regulated SuperFund. This field has been deprecated. New superfunds will not have a SPIN value. The USI field should be used instead of SPIN") + public Object getSPIN() { + return SPIN; + } + + public void setSPIN(Object SPIN) { + this.SPIN = SPIN; + } + + public SuperfundProduct productName(Object productName) { + this.productName = productName; + return this; + } + + /** + * The name of the Regulated SuperFund + * @return productName + **/ + @ApiModelProperty(example = "MLC Navigator Retirement Plan - Superannuation Service (including Series 2) (MLC Superannuation Fund)", value = "The name of the Regulated SuperFund") + public Object getProductName() { + return productName; + } + + public void setProductName(Object productName) { + this.productName = productName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SuperfundProduct superfundProduct = (SuperfundProduct) o; + return Objects.equals(this.ABN, superfundProduct.ABN) && + Objects.equals(this.USI, superfundProduct.USI) && + Objects.equals(this.SPIN, superfundProduct.SPIN) && + Objects.equals(this.productName, superfundProduct.productName); + } + + @Override + public int hashCode() { + return Objects.hash(ABN, USI, SPIN, productName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SuperfundProduct {\n"); + sb.append(" ABN: ").append(toIndentedString(ABN)).append("\n"); + sb.append(" USI: ").append(toIndentedString(USI)).append("\n"); + sb.append(" SPIN: ").append(toIndentedString(SPIN)).append("\n"); + sb.append(" productName: ").append(toIndentedString(productName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/SuperfundProducts.java b/src/main/java/com/xero/models/payrollau/SuperfundProducts.java new file mode 100644 index 00000000..ec6b6b81 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/SuperfundProducts.java @@ -0,0 +1,104 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.SuperfundProduct; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * SuperfundProducts + */ + +public class SuperfundProducts { + + @JsonProperty("SuperfundProducts") + private List superfundProducts = new ArrayList(); + + public SuperfundProducts superfundProducts(List superfundProducts) { + this.superfundProducts = superfundProducts; + return this; + } + + public SuperfundProducts addSuperfundProductsItem(SuperfundProduct superfundProductsItem) { + if (this.superfundProducts == null) { + this.superfundProducts = new ArrayList(); + } + this.superfundProducts.add(superfundProductsItem); + return this; + } + + /** + * Get superfundProducts + * @return superfundProducts + **/ + @ApiModelProperty(value = "") + public List getSuperfundProducts() { + return superfundProducts; + } + + public void setSuperfundProducts(List superfundProducts) { + this.superfundProducts = superfundProducts; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SuperfundProducts superfundProducts = (SuperfundProducts) o; + return Objects.equals(this.superfundProducts, superfundProducts.superfundProducts); + } + + @Override + public int hashCode() { + return Objects.hash(superfundProducts); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SuperfundProducts {\n"); + sb.append(" superfundProducts: ").append(toIndentedString(superfundProducts)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/Superfunds.java b/src/main/java/com/xero/models/payrollau/Superfunds.java new file mode 100644 index 00000000..ebef1ee0 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/Superfunds.java @@ -0,0 +1,104 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.Superfund; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Superfunds + */ + +public class Superfunds { + + @JsonProperty("Superfunds") + private List superfunds = new ArrayList(); + + public Superfunds superfunds(List superfunds) { + this.superfunds = superfunds; + return this; + } + + public Superfunds addSuperfundsItem(Superfund superfundsItem) { + if (this.superfunds == null) { + this.superfunds = new ArrayList(); + } + this.superfunds.add(superfundsItem); + return this; + } + + /** + * Get superfunds + * @return superfunds + **/ + @ApiModelProperty(value = "") + public List getSuperfunds() { + return superfunds; + } + + public void setSuperfunds(List superfunds) { + this.superfunds = superfunds; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Superfunds superfunds = (Superfunds) o; + return Objects.equals(this.superfunds, superfunds.superfunds); + } + + @Override + public int hashCode() { + return Objects.hash(superfunds); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Superfunds {\n"); + sb.append(" superfunds: ").append(toIndentedString(superfunds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/TFNExemptionType.java b/src/main/java/com/xero/models/payrollau/TFNExemptionType.java new file mode 100644 index 00000000..5b95b541 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/TFNExemptionType.java @@ -0,0 +1,61 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets TFNExemptionType + */ +public enum TFNExemptionType { + + NOTQUOTED("NOTQUOTED"), + + PENDING("PENDING"), + + PENSIONER("PENSIONER"), + + UNDER18("UNDER18"); + + private String value; + + TFNExemptionType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TFNExemptionType fromValue(String value) { + for (TFNExemptionType b : TFNExemptionType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/TaxDeclaration.java b/src/main/java/com/xero/models/payrollau/TaxDeclaration.java new file mode 100644 index 00000000..54698f89 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/TaxDeclaration.java @@ -0,0 +1,410 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.EmploymentBasis; +import com.xero.models.payrollau.ResidencyStatus; +import com.xero.models.payrollau.TFNExemptionType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.UUID; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * TaxDeclaration + */ + +public class TaxDeclaration { + + @JsonProperty("EmployeeID") + private UUID employeeID; + + + @JsonProperty("EmploymentBasis") + private EmploymentBasis employmentBasis; + + + @JsonProperty("TFNExemptionType") + private TFNExemptionType tfNExemptionType; + + + @JsonProperty("TaxFileNumber") + private String taxFileNumber; + + + @JsonProperty("AustralianResidentForTaxPurposes") + private Boolean australianResidentForTaxPurposes; + + + @JsonProperty("ResidencyStatus") + private ResidencyStatus residencyStatus; + + + @JsonProperty("TaxFreeThresholdClaimed") + private Boolean taxFreeThresholdClaimed; + + + @JsonProperty("TaxOffsetEstimatedAmount") + private BigDecimal taxOffsetEstimatedAmount; + + + @JsonProperty("HasHELPDebt") + private Boolean hasHELPDebt; + + + @JsonProperty("HasSFSSDebt") + private Boolean hasSFSSDebt; + + + @JsonProperty("HasTradeSupportLoanDebt") + private Boolean hasTradeSupportLoanDebt; + + + @JsonProperty("UpwardVariationTaxWithholdingAmount") + private BigDecimal upwardVariationTaxWithholdingAmount; + + + @JsonProperty("EligibleToReceiveLeaveLoading") + private Boolean eligibleToReceiveLeaveLoading; + + + @JsonProperty("ApprovedWithholdingVariationPercentage") + private BigDecimal approvedWithholdingVariationPercentage; + + public TaxDeclaration employeeID(UUID employeeID) { + this.employeeID = employeeID; + return this; + } + + /** + * Address line 1 for employee home address + * @return employeeID + **/ + @ApiModelProperty(required = true, value = "Address line 1 for employee home address") + public UUID getEmployeeID() { + return employeeID; + } + + public void setEmployeeID(UUID employeeID) { + this.employeeID = employeeID; + } + + public TaxDeclaration employmentBasis(EmploymentBasis employmentBasis) { + this.employmentBasis = employmentBasis; + return this; + } + + /** + * Get employmentBasis + * @return employmentBasis + **/ + @ApiModelProperty(required = true, value = "") + public EmploymentBasis getEmploymentBasis() { + return employmentBasis; + } + + public void setEmploymentBasis(EmploymentBasis employmentBasis) { + this.employmentBasis = employmentBasis; + } + + public TaxDeclaration tfNExemptionType(TFNExemptionType tfNExemptionType) { + this.tfNExemptionType = tfNExemptionType; + return this; + } + + /** + * Get tfNExemptionType + * @return tfNExemptionType + **/ + @ApiModelProperty(value = "") + public TFNExemptionType getTfNExemptionType() { + return tfNExemptionType; + } + + public void setTfNExemptionType(TFNExemptionType tfNExemptionType) { + this.tfNExemptionType = tfNExemptionType; + } + + public TaxDeclaration taxFileNumber(String taxFileNumber) { + this.taxFileNumber = taxFileNumber; + return this; + } + + /** + * The tax file number e.g 123123123. + * @return taxFileNumber + **/ + @ApiModelProperty(example = "123123123", value = "The tax file number e.g 123123123.") + public String getTaxFileNumber() { + return taxFileNumber; + } + + public void setTaxFileNumber(String taxFileNumber) { + this.taxFileNumber = taxFileNumber; + } + + public TaxDeclaration australianResidentForTaxPurposes(Boolean australianResidentForTaxPurposes) { + this.australianResidentForTaxPurposes = australianResidentForTaxPurposes; + return this; + } + + /** + * If the employee is Australian resident for tax purposes. e.g true or false + * @return australianResidentForTaxPurposes + **/ + @ApiModelProperty(example = "true", value = "If the employee is Australian resident for tax purposes. e.g true or false") + public Boolean getAustralianResidentForTaxPurposes() { + return australianResidentForTaxPurposes; + } + + public void setAustralianResidentForTaxPurposes(Boolean australianResidentForTaxPurposes) { + this.australianResidentForTaxPurposes = australianResidentForTaxPurposes; + } + + public TaxDeclaration residencyStatus(ResidencyStatus residencyStatus) { + this.residencyStatus = residencyStatus; + return this; + } + + /** + * Get residencyStatus + * @return residencyStatus + **/ + @ApiModelProperty(value = "") + public ResidencyStatus getResidencyStatus() { + return residencyStatus; + } + + public void setResidencyStatus(ResidencyStatus residencyStatus) { + this.residencyStatus = residencyStatus; + } + + public TaxDeclaration taxFreeThresholdClaimed(Boolean taxFreeThresholdClaimed) { + this.taxFreeThresholdClaimed = taxFreeThresholdClaimed; + return this; + } + + /** + * If tax free threshold claimed. e.g true or false + * @return taxFreeThresholdClaimed + **/ + @ApiModelProperty(example = "false", value = "If tax free threshold claimed. e.g true or false") + public Boolean getTaxFreeThresholdClaimed() { + return taxFreeThresholdClaimed; + } + + public void setTaxFreeThresholdClaimed(Boolean taxFreeThresholdClaimed) { + this.taxFreeThresholdClaimed = taxFreeThresholdClaimed; + } + + public TaxDeclaration taxOffsetEstimatedAmount(BigDecimal taxOffsetEstimatedAmount) { + this.taxOffsetEstimatedAmount = taxOffsetEstimatedAmount; + return this; + } + + /** + * If has tax offset estimated then the tax offset estimated amount. e.g 100 + * @return taxOffsetEstimatedAmount + **/ + @ApiModelProperty(example = "100", value = "If has tax offset estimated then the tax offset estimated amount. e.g 100") + public BigDecimal getTaxOffsetEstimatedAmount() { + return taxOffsetEstimatedAmount; + } + + public void setTaxOffsetEstimatedAmount(BigDecimal taxOffsetEstimatedAmount) { + this.taxOffsetEstimatedAmount = taxOffsetEstimatedAmount; + } + + public TaxDeclaration hasHELPDebt(Boolean hasHELPDebt) { + this.hasHELPDebt = hasHELPDebt; + return this; + } + + /** + * If employee has HECS or HELP debt. e.g true or false + * @return hasHELPDebt + **/ + @ApiModelProperty(example = "false", value = "If employee has HECS or HELP debt. e.g true or false") + public Boolean getHasHELPDebt() { + return hasHELPDebt; + } + + public void setHasHELPDebt(Boolean hasHELPDebt) { + this.hasHELPDebt = hasHELPDebt; + } + + public TaxDeclaration hasSFSSDebt(Boolean hasSFSSDebt) { + this.hasSFSSDebt = hasSFSSDebt; + return this; + } + + /** + * If employee has financial supplement debt. e.g true or false + * @return hasSFSSDebt + **/ + @ApiModelProperty(example = "false", value = "If employee has financial supplement debt. e.g true or false") + public Boolean getHasSFSSDebt() { + return hasSFSSDebt; + } + + public void setHasSFSSDebt(Boolean hasSFSSDebt) { + this.hasSFSSDebt = hasSFSSDebt; + } + + public TaxDeclaration hasTradeSupportLoanDebt(Boolean hasTradeSupportLoanDebt) { + this.hasTradeSupportLoanDebt = hasTradeSupportLoanDebt; + return this; + } + + /** + * If employee has trade support loan. e.g true or false + * @return hasTradeSupportLoanDebt + **/ + @ApiModelProperty(example = "false", value = "If employee has trade support loan. e.g true or false") + public Boolean getHasTradeSupportLoanDebt() { + return hasTradeSupportLoanDebt; + } + + public void setHasTradeSupportLoanDebt(Boolean hasTradeSupportLoanDebt) { + this.hasTradeSupportLoanDebt = hasTradeSupportLoanDebt; + } + + public TaxDeclaration upwardVariationTaxWithholdingAmount(BigDecimal upwardVariationTaxWithholdingAmount) { + this.upwardVariationTaxWithholdingAmount = upwardVariationTaxWithholdingAmount; + return this; + } + + /** + * If the employee has requested that additional tax be withheld each pay run. e.g 50 + * @return upwardVariationTaxWithholdingAmount + **/ + @ApiModelProperty(example = "50", value = "If the employee has requested that additional tax be withheld each pay run. e.g 50") + public BigDecimal getUpwardVariationTaxWithholdingAmount() { + return upwardVariationTaxWithholdingAmount; + } + + public void setUpwardVariationTaxWithholdingAmount(BigDecimal upwardVariationTaxWithholdingAmount) { + this.upwardVariationTaxWithholdingAmount = upwardVariationTaxWithholdingAmount; + } + + public TaxDeclaration eligibleToReceiveLeaveLoading(Boolean eligibleToReceiveLeaveLoading) { + this.eligibleToReceiveLeaveLoading = eligibleToReceiveLeaveLoading; + return this; + } + + /** + * If the employee is eligible to receive an additional percentage on top of ordinary earnings when they take leave (typically 17.5%). e.g true or false + * @return eligibleToReceiveLeaveLoading + **/ + @ApiModelProperty(example = "false", value = "If the employee is eligible to receive an additional percentage on top of ordinary earnings when they take leave (typically 17.5%). e.g true or false") + public Boolean getEligibleToReceiveLeaveLoading() { + return eligibleToReceiveLeaveLoading; + } + + public void setEligibleToReceiveLeaveLoading(Boolean eligibleToReceiveLeaveLoading) { + this.eligibleToReceiveLeaveLoading = eligibleToReceiveLeaveLoading; + } + + public TaxDeclaration approvedWithholdingVariationPercentage(BigDecimal approvedWithholdingVariationPercentage) { + this.approvedWithholdingVariationPercentage = approvedWithholdingVariationPercentage; + return this; + } + + /** + * If the employee has approved withholding variation. e.g (0 - 100) + * @return approvedWithholdingVariationPercentage + **/ + @ApiModelProperty(example = "75", value = "If the employee has approved withholding variation. e.g (0 - 100)") + public BigDecimal getApprovedWithholdingVariationPercentage() { + return approvedWithholdingVariationPercentage; + } + + public void setApprovedWithholdingVariationPercentage(BigDecimal approvedWithholdingVariationPercentage) { + this.approvedWithholdingVariationPercentage = approvedWithholdingVariationPercentage; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TaxDeclaration taxDeclaration = (TaxDeclaration) o; + return Objects.equals(this.employeeID, taxDeclaration.employeeID) && + Objects.equals(this.employmentBasis, taxDeclaration.employmentBasis) && + Objects.equals(this.tfNExemptionType, taxDeclaration.tfNExemptionType) && + Objects.equals(this.taxFileNumber, taxDeclaration.taxFileNumber) && + Objects.equals(this.australianResidentForTaxPurposes, taxDeclaration.australianResidentForTaxPurposes) && + Objects.equals(this.residencyStatus, taxDeclaration.residencyStatus) && + Objects.equals(this.taxFreeThresholdClaimed, taxDeclaration.taxFreeThresholdClaimed) && + Objects.equals(this.taxOffsetEstimatedAmount, taxDeclaration.taxOffsetEstimatedAmount) && + Objects.equals(this.hasHELPDebt, taxDeclaration.hasHELPDebt) && + Objects.equals(this.hasSFSSDebt, taxDeclaration.hasSFSSDebt) && + Objects.equals(this.hasTradeSupportLoanDebt, taxDeclaration.hasTradeSupportLoanDebt) && + Objects.equals(this.upwardVariationTaxWithholdingAmount, taxDeclaration.upwardVariationTaxWithholdingAmount) && + Objects.equals(this.eligibleToReceiveLeaveLoading, taxDeclaration.eligibleToReceiveLeaveLoading) && + Objects.equals(this.approvedWithholdingVariationPercentage, taxDeclaration.approvedWithholdingVariationPercentage); + } + + @Override + public int hashCode() { + return Objects.hash(employeeID, employmentBasis, tfNExemptionType, taxFileNumber, australianResidentForTaxPurposes, residencyStatus, taxFreeThresholdClaimed, taxOffsetEstimatedAmount, hasHELPDebt, hasSFSSDebt, hasTradeSupportLoanDebt, upwardVariationTaxWithholdingAmount, eligibleToReceiveLeaveLoading, approvedWithholdingVariationPercentage); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TaxDeclaration {\n"); + sb.append(" employeeID: ").append(toIndentedString(employeeID)).append("\n"); + sb.append(" employmentBasis: ").append(toIndentedString(employmentBasis)).append("\n"); + sb.append(" tfNExemptionType: ").append(toIndentedString(tfNExemptionType)).append("\n"); + sb.append(" taxFileNumber: ").append(toIndentedString(taxFileNumber)).append("\n"); + sb.append(" australianResidentForTaxPurposes: ").append(toIndentedString(australianResidentForTaxPurposes)).append("\n"); + sb.append(" residencyStatus: ").append(toIndentedString(residencyStatus)).append("\n"); + sb.append(" taxFreeThresholdClaimed: ").append(toIndentedString(taxFreeThresholdClaimed)).append("\n"); + sb.append(" taxOffsetEstimatedAmount: ").append(toIndentedString(taxOffsetEstimatedAmount)).append("\n"); + sb.append(" hasHELPDebt: ").append(toIndentedString(hasHELPDebt)).append("\n"); + sb.append(" hasSFSSDebt: ").append(toIndentedString(hasSFSSDebt)).append("\n"); + sb.append(" hasTradeSupportLoanDebt: ").append(toIndentedString(hasTradeSupportLoanDebt)).append("\n"); + sb.append(" upwardVariationTaxWithholdingAmount: ").append(toIndentedString(upwardVariationTaxWithholdingAmount)).append("\n"); + sb.append(" eligibleToReceiveLeaveLoading: ").append(toIndentedString(eligibleToReceiveLeaveLoading)).append("\n"); + sb.append(" approvedWithholdingVariationPercentage: ").append(toIndentedString(approvedWithholdingVariationPercentage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/Timesheet.java b/src/main/java/com/xero/models/payrollau/Timesheet.java new file mode 100644 index 00000000..56d062bd --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/Timesheet.java @@ -0,0 +1,250 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.TimesheetLine; +import com.xero.models.payrollau.TimesheetStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.threeten.bp.LocalDate; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Timesheet + */ + +public class Timesheet { + + @JsonProperty("EmployeeID") + private Object employeeID = null; + + @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("StartDate") + private LocalDate startDate; + + @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("EndDate") + private LocalDate endDate; + + + @JsonProperty("Status") + private TimesheetStatus status; + + + @JsonProperty("Hours") + private Float hours; + + + @JsonProperty("TimesheetID") + private Object timesheetID = null; + + + @JsonProperty("TimesheetLines") + private List timesheetLines = new ArrayList(); + + public Timesheet employeeID(Object employeeID) { + this.employeeID = employeeID; + return this; + } + + /** + * The Xero identifier for an employee + * @return employeeID + **/ + @ApiModelProperty(example = "72a0d0c2-0cf8-4f0b-ade1-33231f47b41b", required = true, value = "The Xero identifier for an employee") + public Object getEmployeeID() { + return employeeID; + } + + public void setEmployeeID(Object employeeID) { + this.employeeID = employeeID; + } + + public Timesheet startDate(LocalDate startDate) { + this.startDate = startDate; + return this; + } + + /** + * Period start date (YYYY-MM-DD) + * @return startDate + **/ + @ApiModelProperty(required = true, value = "Period start date (YYYY-MM-DD)") + public LocalDate getStartDate() { + return startDate; + } + + public void setStartDate(LocalDate startDate) { + this.startDate = startDate; + } + + public Timesheet endDate(LocalDate endDate) { + this.endDate = endDate; + return this; + } + + /** + * Period end date (YYYY-MM-DD) + * @return endDate + **/ + @ApiModelProperty(required = true, value = "Period end date (YYYY-MM-DD)") + public LocalDate getEndDate() { + return endDate; + } + + public void setEndDate(LocalDate endDate) { + this.endDate = endDate; + } + + public Timesheet status(TimesheetStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(value = "") + public TimesheetStatus getStatus() { + return status; + } + + public void setStatus(TimesheetStatus status) { + this.status = status; + } + + public Timesheet hours(Float hours) { + this.hours = hours; + return this; + } + + /** + * Timesheet total hours + * @return hours + **/ + @ApiModelProperty(example = "31.0", value = "Timesheet total hours") + public Float getHours() { + return hours; + } + + public void setHours(Float hours) { + this.hours = hours; + } + + public Timesheet timesheetID(Object timesheetID) { + this.timesheetID = timesheetID; + return this; + } + + /** + * The Xero identifier for a Payroll Timesheet + * @return timesheetID + **/ + @ApiModelProperty(example = "049765fc-4506-48fb-bf88-3578dec0ec47", value = "The Xero identifier for a Payroll Timesheet") + public Object getTimesheetID() { + return timesheetID; + } + + public void setTimesheetID(Object timesheetID) { + this.timesheetID = timesheetID; + } + + public Timesheet timesheetLines(List timesheetLines) { + this.timesheetLines = timesheetLines; + return this; + } + + public Timesheet addTimesheetLinesItem(TimesheetLine timesheetLinesItem) { + if (this.timesheetLines == null) { + this.timesheetLines = new ArrayList(); + } + this.timesheetLines.add(timesheetLinesItem); + return this; + } + + /** + * Get timesheetLines + * @return timesheetLines + **/ + @ApiModelProperty(value = "") + public List getTimesheetLines() { + return timesheetLines; + } + + public void setTimesheetLines(List timesheetLines) { + this.timesheetLines = timesheetLines; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Timesheet timesheet = (Timesheet) o; + return Objects.equals(this.employeeID, timesheet.employeeID) && + Objects.equals(this.startDate, timesheet.startDate) && + Objects.equals(this.endDate, timesheet.endDate) && + Objects.equals(this.status, timesheet.status) && + Objects.equals(this.hours, timesheet.hours) && + Objects.equals(this.timesheetID, timesheet.timesheetID) && + Objects.equals(this.timesheetLines, timesheet.timesheetLines); + } + + @Override + public int hashCode() { + return Objects.hash(employeeID, startDate, endDate, status, hours, timesheetID, timesheetLines); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Timesheet {\n"); + sb.append(" employeeID: ").append(toIndentedString(employeeID)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" hours: ").append(toIndentedString(hours)).append("\n"); + sb.append(" timesheetID: ").append(toIndentedString(timesheetID)).append("\n"); + sb.append(" timesheetLines: ").append(toIndentedString(timesheetLines)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/TimesheetLine.java b/src/main/java/com/xero/models/payrollau/TimesheetLine.java new file mode 100644 index 00000000..4b19d23a --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/TimesheetLine.java @@ -0,0 +1,177 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * TimesheetLine + */ + +public class TimesheetLine { + + @JsonProperty("EarningsRateID") + private UUID earningsRateID; + + + @JsonProperty("TrackingItemID") + private UUID trackingItemID; + + + @JsonProperty("NumberOfUnits") + private List numberOfUnits = new ArrayList(); + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + public TimesheetLine earningsRateID(UUID earningsRateID) { + this.earningsRateID = earningsRateID; + return this; + } + + /** + * The Xero identifier for an Earnings Rate + * @return earningsRateID + **/ + @ApiModelProperty(example = "966c5c77-2ef0-4320-b6a9-6c27b080ecc5", value = "The Xero identifier for an Earnings Rate") + public UUID getEarningsRateID() { + return earningsRateID; + } + + public void setEarningsRateID(UUID earningsRateID) { + this.earningsRateID = earningsRateID; + } + + public TimesheetLine trackingItemID(UUID trackingItemID) { + this.trackingItemID = trackingItemID; + return this; + } + + /** + * The Xero identifier for a Tracking Category. The TrackingOptionID must belong to the TrackingCategory selected as TimesheetCategories under Payroll Settings. + * @return trackingItemID + **/ + @ApiModelProperty(example = "ae777a87-5ef3-4fa0-a4f0-d10e1f13073a", value = "The Xero identifier for a Tracking Category. The TrackingOptionID must belong to the TrackingCategory selected as TimesheetCategories under Payroll Settings.") + public UUID getTrackingItemID() { + return trackingItemID; + } + + public void setTrackingItemID(UUID trackingItemID) { + this.trackingItemID = trackingItemID; + } + + public TimesheetLine numberOfUnits(List numberOfUnits) { + this.numberOfUnits = numberOfUnits; + return this; + } + + public TimesheetLine addNumberOfUnitsItem(Float numberOfUnitsItem) { + if (this.numberOfUnits == null) { + this.numberOfUnits = new ArrayList(); + } + this.numberOfUnits.add(numberOfUnitsItem); + return this; + } + + /** + * The number of units on a timesheet line + * @return numberOfUnits + **/ + @ApiModelProperty(value = "The number of units on a timesheet line") + public List getNumberOfUnits() { + return numberOfUnits; + } + + public void setNumberOfUnits(List numberOfUnits) { + this.numberOfUnits = numberOfUnits; + } + + public TimesheetLine updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * Last modified timestamp + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Last modified timestamp") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TimesheetLine timesheetLine = (TimesheetLine) o; + return Objects.equals(this.earningsRateID, timesheetLine.earningsRateID) && + Objects.equals(this.trackingItemID, timesheetLine.trackingItemID) && + Objects.equals(this.numberOfUnits, timesheetLine.numberOfUnits) && + Objects.equals(this.updatedDateUTC, timesheetLine.updatedDateUTC); + } + + @Override + public int hashCode() { + return Objects.hash(earningsRateID, trackingItemID, numberOfUnits, updatedDateUTC); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TimesheetLine {\n"); + sb.append(" earningsRateID: ").append(toIndentedString(earningsRateID)).append("\n"); + sb.append(" trackingItemID: ").append(toIndentedString(trackingItemID)).append("\n"); + sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/TimesheetStatus.java b/src/main/java/com/xero/models/payrollau/TimesheetStatus.java new file mode 100644 index 00000000..87dd96b2 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/TimesheetStatus.java @@ -0,0 +1,59 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets TimesheetStatus + */ +public enum TimesheetStatus { + + DRAFT("DRAFT"), + + PROCESSED("PROCESSED"), + + APPROVED("APPROVED"); + + private String value; + + TimesheetStatus(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TimesheetStatus fromValue(String value) { + for (TimesheetStatus b : TimesheetStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/payrollau/Timesheets.java b/src/main/java/com/xero/models/payrollau/Timesheets.java new file mode 100644 index 00000000..9233aed5 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/Timesheets.java @@ -0,0 +1,104 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.Timesheet; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Timesheets + */ + +public class Timesheets { + + @JsonProperty("Employees") + private List employees = new ArrayList(); + + public Timesheets employees(List employees) { + this.employees = employees; + return this; + } + + public Timesheets addEmployeesItem(Timesheet employeesItem) { + if (this.employees == null) { + this.employees = new ArrayList(); + } + this.employees.add(employeesItem); + return this; + } + + /** + * Get employees + * @return employees + **/ + @ApiModelProperty(value = "") + public List getEmployees() { + return employees; + } + + public void setEmployees(List employees) { + this.employees = employees; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Timesheets timesheets = (Timesheets) o; + return Objects.equals(this.employees, timesheets.employees); + } + + @Override + public int hashCode() { + return Objects.hash(employees); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Timesheets {\n"); + sb.append(" employees: ").append(toIndentedString(employees)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + From dbd71966c7e99323d3ea6426e543c12b156b26f9 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Thu, 14 Nov 2019 06:23:39 -0800 Subject: [PATCH 74/76] Adding quotes and AU Payroll endpoints --- src/main/java/com/xero/api/ApiClient.java | 7 +- .../com/xero/api/client/AccountingApi.java | 1231 ++++++++--------- .../com/xero/api/client/PayrollAuApi.java | 564 ++++---- .../xero/models/accounting/BatchPayment.java | 39 +- .../com/xero/models/accounting/Quote.java | 570 ++++++++ .../models/accounting/QuoteStatusCodes.java | 64 + .../com/xero/models/accounting/Quotes.java | 104 ++ .../com/xero/models/accounting/TaxRate.java | 4 +- .../xero/models/payrollau/DeductionLine.java | 52 +- .../xero/models/payrollau/DeductionType.java | 18 +- .../xero/models/payrollau/EarningsLine.java | 52 +- .../xero/models/payrollau/EarningsRate.java | 13 +- .../com/xero/models/payrollau/Employee.java | 26 +- ...AccrualLine.java => LeaveAccrualLine.java} | 20 +- ...ningsLines.java => LeaveEarningsLine.java} | 20 +- .../xero/models/payrollau/LeavePeriod.java | 25 +- .../com/xero/models/payrollau/LeaveType.java | 18 +- .../models/payrollau/OpeningBalances.java | 11 +- .../models/payrollau/PayrollCalendar.java | 25 +- .../com/xero/models/payrollau/Payrun.java | 125 +- .../com/xero/models/payrollau/Payruns.java | 44 +- .../com/xero/models/payrollau/Payslip.java | 225 ++- .../payrollau/PayslipDeductionLine.java | 167 --- .../payrollau/PayslipEarningsLines.java | 166 --- .../xero/models/payrollau/PayslipObject.java | 94 ++ .../payrollau/PayslipReimbursementLine.java | 166 --- .../xero/models/payrollau/PayslipSummary.java | 22 +- .../models/payrollau/ReimbursementLine.java | 52 +- .../models/payrollau/ReimbursementLines.java | 34 +- .../models/payrollau/ReimbursementType.java | 13 +- .../xero/models/payrollau/SettingsObject.java | 94 ++ ...ationLine.java => SuperannuationLine.java} | 55 +- .../com/xero/models/payrollau/Superfund.java | 79 +- .../models/payrollau/SuperfundProduct.java | 24 +- .../models/payrollau/SuperfundProducts.java | 44 +- .../com/xero/models/payrollau/Superfunds.java | 44 +- .../{PayslipTaxLine.java => TaxLine.java} | 28 +- .../com/xero/models/payrollau/Timesheet.java | 42 +- .../xero/models/payrollau/TimesheetLine.java | 13 +- .../models/payrollau/TimesheetObject.java | 94 ++ .../com/xero/models/payrollau/Timesheets.java | 34 +- .../api/client/AccountingApiAccountsTest.java | 4 +- 42 files changed, 2566 insertions(+), 1960 deletions(-) create mode 100644 src/main/java/com/xero/models/accounting/Quote.java create mode 100644 src/main/java/com/xero/models/accounting/QuoteStatusCodes.java create mode 100644 src/main/java/com/xero/models/accounting/Quotes.java rename src/main/java/com/xero/models/payrollau/{PayslipLeaveAccrualLine.java => LeaveAccrualLine.java} (82%) rename src/main/java/com/xero/models/payrollau/{PayslipLeaveEarningsLines.java => LeaveEarningsLine.java} (81%) delete mode 100644 src/main/java/com/xero/models/payrollau/PayslipDeductionLine.java delete mode 100644 src/main/java/com/xero/models/payrollau/PayslipEarningsLines.java create mode 100644 src/main/java/com/xero/models/payrollau/PayslipObject.java delete mode 100644 src/main/java/com/xero/models/payrollau/PayslipReimbursementLine.java create mode 100644 src/main/java/com/xero/models/payrollau/SettingsObject.java rename src/main/java/com/xero/models/payrollau/{PayslipSuperannuationLine.java => SuperannuationLine.java} (75%) rename src/main/java/com/xero/models/payrollau/{PayslipTaxLine.java => TaxLine.java} (83%) create mode 100644 src/main/java/com/xero/models/payrollau/TimesheetObject.java diff --git a/src/main/java/com/xero/api/ApiClient.java b/src/main/java/com/xero/api/ApiClient.java index de5c3f52..e9984c35 100644 --- a/src/main/java/com/xero/api/ApiClient.java +++ b/src/main/java/com/xero/api/ApiClient.java @@ -12,15 +12,16 @@ import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.Json; import java.io.IOException; import java.io.OutputStream; - public class ApiClient { private final String basePath; private final HttpRequestFactory httpRequestFactory; private final ObjectMapper objectMapper; + private HttpTransport httpTransport = new NetHttpTransport(); private static final String defaultBasePath = "https://api.xero.com/api.xro/2.0"; @@ -63,6 +64,10 @@ public HttpRequestFactory getHttpRequestFactory() { return httpRequestFactory; } + public HttpTransport getHttpTransport() { + return httpTransport; + } + public String getBasePath() { return basePath; } diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index ba952ff3..4d0e3c9b 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -49,6 +49,7 @@ import com.xero.models.accounting.Prepayments; import com.xero.models.accounting.PurchaseOrder; import com.xero.models.accounting.PurchaseOrders; +import com.xero.models.accounting.Quotes; import com.xero.models.accounting.Receipts; import com.xero.models.accounting.RepeatingInvoices; import com.xero.models.accounting.ReportWithRows; @@ -180,12 +181,11 @@ public HttpResponse createAccountForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(account); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -255,12 +255,10 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String acce HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -314,12 +312,11 @@ public HttpResponse createBankTransactionForHttpResponse(String accessToken, St HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(bankTransaction); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -389,12 +386,10 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -457,12 +452,11 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String acc HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -528,12 +522,11 @@ public HttpResponse createBankTransactionsForHttpResponse(String accessToken, S HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(bankTransactions); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -587,12 +580,11 @@ public HttpResponse createBankTransferForHttpResponse(String accessToken, Strin HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(bankTransfers); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -661,12 +653,10 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -728,12 +718,11 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse(String access HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -787,12 +776,11 @@ public HttpResponse createBatchPaymentForHttpResponse(String accessToken, Strin HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(batchPayments); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -855,12 +843,11 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String access HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -923,12 +910,11 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String acc HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(paymentService); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -981,12 +967,11 @@ public HttpResponse createContactForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contact); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1055,12 +1040,10 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String acce HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1114,12 +1097,11 @@ public HttpResponse createContactGroupForHttpResponse(String accessToken, Strin HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contactGroups); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1182,12 +1164,11 @@ public HttpResponse createContactGroupContactsForHttpResponse(String accessToken HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contacts); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1250,12 +1231,11 @@ public HttpResponse createContactHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1308,12 +1288,11 @@ public HttpResponse createContactsForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contacts); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1367,12 +1346,11 @@ public HttpResponse createCreditNoteForHttpResponse(String accessToken, String HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(creditNote); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1435,12 +1413,11 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String accessToken HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(allocations); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1510,12 +1487,10 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String a HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1578,12 +1553,11 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1649,12 +1623,11 @@ public HttpResponse createCreditNotesForHttpResponse(String accessToken, String HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(creditNotes); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1706,12 +1679,11 @@ public HttpResponse createCurrencyForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(currency); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1765,12 +1737,11 @@ public HttpResponse createEmployeeForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(employee); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1824,12 +1795,11 @@ public HttpResponse createEmployeesForHttpResponse(String accessToken, String x HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(employees); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1891,12 +1861,11 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -1950,12 +1919,11 @@ public HttpResponse createExpenseClaimsForHttpResponse(String accessToken, Stri HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(expenseClaims); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2009,12 +1977,11 @@ public HttpResponse createInvoiceForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(invoice); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2084,12 +2051,10 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String acce HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2152,12 +2117,11 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2223,12 +2187,11 @@ public HttpResponse createInvoicesForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(invoices); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2282,12 +2245,11 @@ public HttpResponse createItemForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(item); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2349,12 +2311,11 @@ public HttpResponse createItemHistoryForHttpResponse(String accessToken, String HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2408,12 +2369,11 @@ public HttpResponse createItemsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(items); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2467,12 +2427,11 @@ public HttpResponse createLinkedTransactionForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(linkedTransaction); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2526,12 +2485,11 @@ public HttpResponse createLinkedTransactionsForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2585,12 +2543,11 @@ public HttpResponse createManualJournalForHttpResponse(String accessToken, Stri HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(manualJournal); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2660,12 +2617,10 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2719,12 +2674,11 @@ public HttpResponse createManualJournalsForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(manualJournals); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2787,12 +2741,11 @@ public HttpResponse createOverpaymentAllocationForHttpResponse(String accessToke HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(allocation); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2855,12 +2808,11 @@ public HttpResponse createOverpaymentAllocationsForHttpResponse(String accessTok HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(allocations); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2923,12 +2875,11 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -2982,12 +2933,11 @@ public HttpResponse createPaymentForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payment); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3050,12 +3000,11 @@ public HttpResponse createPaymentHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3109,12 +3058,11 @@ public HttpResponse createPaymentServiceForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(paymentServices); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3168,12 +3116,11 @@ public HttpResponse createPaymentsForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payments); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3236,12 +3183,11 @@ public HttpResponse createPrepaymentAllocationForHttpResponse(String accessToken HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(allocations); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3304,12 +3250,11 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3363,12 +3308,11 @@ public HttpResponse createPurchaseOrderForHttpResponse(String accessToken, Stri HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(purchaseOrder); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3431,12 +3375,11 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String accessToken HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3502,12 +3445,11 @@ public HttpResponse createPurchaseOrdersForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3561,12 +3503,11 @@ public HttpResponse createReceiptForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(receipts); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3636,12 +3577,10 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String acce HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3704,12 +3643,11 @@ public HttpResponse createReceiptHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3779,12 +3717,10 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3847,12 +3783,11 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String accessTo HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3906,12 +3841,11 @@ public HttpResponse createTaxRateForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(taxRate); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -3965,12 +3899,11 @@ public HttpResponse createTaxRatesForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(taxRates); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -4024,12 +3957,11 @@ public HttpResponse createTrackingCategoryForHttpResponse(String accessToken, S HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(trackingCategory); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -4092,12 +4024,11 @@ public HttpResponse createTrackingOptionsForHttpResponse(String accessToken, St HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(trackingOption); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.PUT, genericUrl, content).setHeaders(headers).execute(); @@ -4156,10 +4087,9 @@ public HttpResponse deleteAccountForHttpResponse(String accessToken, String xer HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); @@ -4219,10 +4149,9 @@ public HttpResponse deleteContactGroupContactForHttpResponse(String accessToken, HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); @@ -4276,10 +4205,9 @@ public HttpResponse deleteContactGroupContactsForHttpResponse(String accessToken HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); @@ -4334,10 +4262,9 @@ public HttpResponse deleteItemForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); @@ -4392,10 +4319,9 @@ public HttpResponse deleteLinkedTransactionForHttpResponse(String accessToken, HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); @@ -4458,12 +4384,11 @@ public HttpResponse deletePaymentForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payments); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -4522,10 +4447,9 @@ public HttpResponse deleteTrackingCategoryForHttpResponse(String accessToken, S HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); @@ -4589,10 +4513,9 @@ public HttpResponse deleteTrackingOptionsForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.DELETE, genericUrl, content).setHeaders(headers).execute(); @@ -4651,12 +4574,11 @@ public HttpResponse emailInvoiceForHttpResponse(String accessToken, String xero HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(requestEmpty); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -4714,10 +4636,9 @@ public HttpResponse getAccountForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -4793,10 +4714,9 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String accessT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -4872,10 +4792,9 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse(String accessToken, HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -4933,10 +4852,9 @@ public HttpResponse getAccountAttachmentsForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5009,10 +4927,9 @@ public HttpResponse getAccountsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5070,10 +4987,9 @@ public HttpResponse getBankTransactionForHttpResponse(String accessToken, Strin HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5149,10 +5065,9 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5228,10 +5143,9 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String acces HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5289,10 +5203,9 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse(String accessTo HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5387,10 +5300,9 @@ public HttpResponse getBankTransactionsForHttpResponse(String accessToken, Stri HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5448,10 +5360,9 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse(String accessToken HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5509,10 +5420,9 @@ public HttpResponse getBankTransferForHttpResponse(String accessToken, String x HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5588,10 +5498,9 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String ac HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5667,10 +5576,9 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String accessTo HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5728,10 +5636,9 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse(String accessToken HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5789,10 +5696,9 @@ public HttpResponse getBankTransferHistoryForHttpResponse(String accessToken, S HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5865,10 +5771,9 @@ public HttpResponse getBankTransfersForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -5926,10 +5831,9 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse(String accessToken, S HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6002,10 +5906,9 @@ public HttpResponse getBatchPaymentsForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6063,10 +5966,9 @@ public HttpResponse getBrandingThemeForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6124,10 +6026,9 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String access HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6176,10 +6077,9 @@ public HttpResponse getBrandingThemesForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6237,10 +6137,9 @@ public HttpResponse getContactForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6316,10 +6215,9 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse(String accessT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6395,10 +6293,9 @@ public HttpResponse getContactAttachmentByIdForHttpResponse(String accessToken, HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6456,10 +6353,9 @@ public HttpResponse getContactAttachmentsForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6517,10 +6413,9 @@ public HttpResponse getContactCISSettingsForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6578,10 +6473,9 @@ public HttpResponse getContactGroupForHttpResponse(String accessToken, String x HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6653,10 +6547,9 @@ public HttpResponse getContactGroupsForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6714,10 +6607,9 @@ public HttpResponse getContactHistoryForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6823,10 +6715,9 @@ public HttpResponse getContactsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6884,10 +6775,9 @@ public HttpResponse getCreditNoteForHttpResponse(String accessToken, String xer HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -6958,10 +6848,9 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse(String accessToken, Strin HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7037,10 +6926,9 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String acce HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7116,10 +7004,9 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String accessToke HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7177,10 +7064,9 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse(String accessToken, HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7238,10 +7124,9 @@ public HttpResponse getCreditNoteHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7325,10 +7210,9 @@ public HttpResponse getCreditNotesForHttpResponse(String accessToken, String xe HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7400,10 +7284,9 @@ public HttpResponse getCurrenciesForHttpResponse(String accessToken, String xer HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7461,10 +7344,9 @@ public HttpResponse getEmployeeForHttpResponse(String accessToken, String xeroT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7537,10 +7419,9 @@ public HttpResponse getEmployeesForHttpResponse(String accessToken, String xero HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7598,10 +7479,9 @@ public HttpResponse getExpenseClaimForHttpResponse(String accessToken, String x HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7659,10 +7539,9 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse(String accessToken, S HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7735,10 +7614,9 @@ public HttpResponse getExpenseClaimsForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7796,10 +7674,9 @@ public HttpResponse getInvoiceForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7870,10 +7747,9 @@ public HttpResponse getInvoiceAsPdfForHttpResponse(String accessToken, String x HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -7949,10 +7825,9 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String accessT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8028,10 +7903,9 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String accessToken, HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8089,10 +7963,9 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8150,10 +8023,9 @@ public HttpResponse getInvoiceHistoryForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8202,10 +8074,9 @@ public HttpResponse getInvoiceRemindersForHttpResponse(String accessToken, Stri HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8366,10 +8237,9 @@ public HttpResponse getInvoicesForHttpResponse(String accessToken, String xeroT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8427,10 +8297,9 @@ public HttpResponse getItemForHttpResponse(String accessToken, String xeroTenan HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8488,10 +8357,9 @@ public HttpResponse getItemHistoryForHttpResponse(String accessToken, String xe HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8575,10 +8443,9 @@ public HttpResponse getItemsForHttpResponse(String accessToken, String xeroTena HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8636,10 +8503,9 @@ public HttpResponse getJournalForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8712,10 +8578,9 @@ public HttpResponse getJournalsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8773,10 +8638,9 @@ public HttpResponse getLinkedTransactionForHttpResponse(String accessToken, Str HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8892,10 +8756,9 @@ public HttpResponse getLinkedTransactionsForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -8953,10 +8816,9 @@ public HttpResponse getManualJournalForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9032,10 +8894,9 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String a HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9111,10 +8972,9 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String accessT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9172,10 +9032,9 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse(String accessToke HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9259,10 +9118,9 @@ public HttpResponse getManualJournalsForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9320,10 +9178,9 @@ public HttpResponse getOnlineInvoiceForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9381,10 +9238,9 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse(String accessToken HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9433,10 +9289,9 @@ public HttpResponse getOrganisationsForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9494,10 +9349,9 @@ public HttpResponse getOverpaymentForHttpResponse(String accessToken, String xe HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9555,10 +9409,9 @@ public HttpResponse getOverpaymentHistoryForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9653,10 +9506,9 @@ public HttpResponse getOverpaymentsForHttpResponse(String accessToken, String x HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9714,10 +9566,9 @@ public HttpResponse getPaymentForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9775,10 +9626,9 @@ public HttpResponse getPaymentHistoryForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9827,10 +9677,9 @@ public HttpResponse getPaymentServicesForHttpResponse(String accessToken, Strin HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9903,10 +9752,9 @@ public HttpResponse getPaymentsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -9964,10 +9812,9 @@ public HttpResponse getPrepaymentForHttpResponse(String accessToken, String xer HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10025,10 +9872,9 @@ public HttpResponse getPrepaymentHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10123,10 +9969,9 @@ public HttpResponse getPrepaymentsForHttpResponse(String accessToken, String xe HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10184,10 +10029,9 @@ public HttpResponse getPurchaseOrderForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10245,10 +10089,9 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse(String accessToken, HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10354,10 +10197,210 @@ public HttpResponse getPurchaseOrdersForHttpResponse(String accessToken, String HttpContent content = null; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to retrieve a specified quote + *

200 - Success - return response of type Quotes array with specified Quote + * @param xeroTenantId Xero identifier for Tenant + * @param quoteID Unique identifier for an Quote + * @param accessToken Authorization token for user set in header of each request + * @return Quotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Quotes getQuote(String accessToken, String xeroTenantId, UUID quoteID) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getQuoteForHttpResponse(accessToken, xeroTenantId, quoteID); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getQuoteForHttpResponse(String accessToken, String xeroTenantId, UUID quoteID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getQuote"); + }// verify the required parameter 'quoteID' is set + if (quoteID == null) { + throw new IllegalArgumentException("Missing the required parameter 'quoteID' when calling getQuote"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getQuote"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Quotes/{QuoteID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("QuoteID", quoteID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * Allows you to retrieve any sales quotes + *

200 - Success - return response of type quotes array with all quotes + * @param xeroTenantId Xero identifier for Tenant + * @param ifModifiedSince Only records created or modified since this timestamp will be returned + * @param dateFrom Filter for quotes after a particular date + * @param dateTo Filter for quotes before a particular date + * @param expiryDateFrom Filter for quotes expiring after a particular date + * @param expiryDateTo Filter for quotes before a particular date + * @param contactID Filter for quotes belonging to a particular contact + * @param status Filter for quotes of a particular Status + * @param page e.g. page=1 – Up to 100 Quotes will be returned in a single API call with line items shown for each quote + * @param order Order by an any element + * @param accessToken Authorization token for user set in header of each request + * @return Quotes + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public Quotes getQuotes(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, LocalDate dateFrom, LocalDate dateTo, LocalDate expiryDateFrom, LocalDate expiryDateTo, UUID contactID, String status, Integer page, String order) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getQuotesForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getQuotesForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, LocalDate dateFrom, LocalDate dateTo, LocalDate expiryDateFrom, LocalDate expiryDateTo, UUID contactID, String status, Integer page, String order) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getQuotes"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getQuotes"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Quotes"; + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + if (dateFrom != null) { + String key = "DateFrom"; + Object value = dateFrom; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (dateTo != null) { + String key = "DateTo"; + Object value = dateTo; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (expiryDateFrom != null) { + String key = "ExpiryDateFrom"; + Object value = expiryDateFrom; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (expiryDateTo != null) { + String key = "ExpiryDateTo"; + Object value = expiryDateTo; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (contactID != null) { + String key = "ContactID"; + Object value = contactID; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (order != null) { + String key = "order"; + Object value = order; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } 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); + + HttpContent content = null; Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10415,10 +10458,9 @@ public HttpResponse getReceiptForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10494,10 +10536,9 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String accessT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10573,10 +10614,9 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse(String accessToken, HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10634,10 +10674,9 @@ public HttpResponse getReceiptAttachmentsForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10695,10 +10734,9 @@ public HttpResponse getReceiptHistoryForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10782,10 +10820,9 @@ public HttpResponse getReceiptsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10843,10 +10880,9 @@ public HttpResponse getRepeatingInvoiceForHttpResponse(String accessToken, Stri HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -10922,10 +10958,9 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(Strin HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11001,10 +11036,9 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String acce HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11062,10 +11096,9 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String accessT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11123,10 +11156,9 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String accessToken HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11198,10 +11230,9 @@ public HttpResponse getRepeatingInvoicesForHttpResponse(String accessToken, Str HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11298,10 +11329,9 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse(String accessT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11398,10 +11428,9 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String acce HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11459,10 +11488,9 @@ public HttpResponse getReportBASorGSTForHttpResponse(String accessToken, String HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11511,10 +11539,9 @@ public HttpResponse getReportBASorGSTListForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11641,10 +11668,9 @@ public HttpResponse getReportBalanceSheetForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11727,10 +11753,9 @@ public HttpResponse getReportBankSummaryForHttpResponse(String accessToken, Str HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11813,10 +11838,9 @@ public HttpResponse getReportBudgetSummaryForHttpResponse(String accessToken, S HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -11877,10 +11901,9 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse(String accessToken, HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -12040,10 +12063,9 @@ public HttpResponse getReportProfitAndLossForHttpResponse(String accessToken, S HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -12104,10 +12126,9 @@ public HttpResponse getReportTenNinetyNineForHttpResponse(String accessToken, S HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -12179,10 +12200,9 @@ public HttpResponse getReportTrialBalanceForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -12265,10 +12285,9 @@ public HttpResponse getTaxRatesForHttpResponse(String accessToken, String xeroT HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -12351,10 +12370,9 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String accessToken, St HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -12412,10 +12430,9 @@ public HttpResponse getTrackingCategoryForHttpResponse(String accessToken, Stri HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -12473,10 +12490,9 @@ public HttpResponse getUserForHttpResponse(String accessToken, String xeroTenan HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -12549,10 +12565,9 @@ public HttpResponse getUsersForHttpResponse(String accessToken, String xeroTena HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -12615,12 +12630,11 @@ public HttpResponse updateAccountForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(accounts); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -12690,12 +12704,10 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String acce HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -12758,12 +12770,11 @@ public HttpResponse updateBankTransactionForHttpResponse(String accessToken, St HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(bankTransactions); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -12833,12 +12844,10 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -12907,12 +12916,10 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -12974,12 +12981,11 @@ public HttpResponse updateContactForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contacts); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13048,12 +13054,10 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String acce HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13116,12 +13120,11 @@ public HttpResponse updateContactGroupForHttpResponse(String accessToken, Strin HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contactGroups); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13184,12 +13187,11 @@ public HttpResponse updateCreditNoteForHttpResponse(String accessToken, String HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(creditNotes); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13259,12 +13261,10 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String a HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13327,12 +13327,11 @@ public HttpResponse updateEmployeeForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(employees); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13395,12 +13394,11 @@ public HttpResponse updateExpenseClaimForHttpResponse(String accessToken, Strin HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(expenseClaims); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13463,12 +13461,11 @@ public HttpResponse updateInvoiceForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(invoices); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13538,12 +13535,10 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String acce HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13606,12 +13601,11 @@ public HttpResponse updateItemForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(items); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13674,12 +13668,11 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13742,12 +13735,11 @@ public HttpResponse updateManualJournalForHttpResponse(String accessToken, Stri HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(manualJournals); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13817,12 +13809,10 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13885,12 +13875,11 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String accessToken, Stri HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(purchaseOrders); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -13953,12 +13942,11 @@ public HttpResponse updateReceiptForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(receipts); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -14028,12 +14016,10 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String acce HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -14103,12 +14089,10 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St HttpContent content = null; - - content = new FileContent(mimeType, body); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -14162,12 +14146,11 @@ public HttpResponse updateTaxRateForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(taxRates); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -14230,12 +14213,11 @@ public HttpResponse updateTrackingCategoryForHttpResponse(String accessToken, S HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(trackingCategory); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -14303,12 +14285,11 @@ public HttpResponse updateTrackingOptionsForHttpResponse(String accessToken, St HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(trackingOption); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + //HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); diff --git a/src/main/java/com/xero/api/client/PayrollAuApi.java b/src/main/java/com/xero/api/client/PayrollAuApi.java index 26ab3f25..4476b098 100644 --- a/src/main/java/com/xero/api/client/PayrollAuApi.java +++ b/src/main/java/com/xero/api/client/PayrollAuApi.java @@ -7,14 +7,19 @@ import com.xero.models.payrollau.LeaveApplication; import com.xero.models.payrollau.LeaveApplications; import com.xero.models.payrollau.ModelAPIException; -import org.threeten.bp.OffsetDateTime; +import com.xero.models.payrollau.PayItem; import com.xero.models.payrollau.PayItems; +import com.xero.models.payrollau.PayRun; +import com.xero.models.payrollau.PayRuns; +import com.xero.models.payrollau.PayrollCalendar; import com.xero.models.payrollau.PayrollCalendars; -import com.xero.models.payrollau.Payruns; -import com.xero.models.payrollau.Payslip; -import com.xero.models.payrollau.Settings; -import com.xero.models.payrollau.SuperfundProducts; -import com.xero.models.payrollau.Superfunds; +import com.xero.models.payrollau.PayslipObject; +import com.xero.models.payrollau.SettingsObject; +import com.xero.models.payrollau.SuperFund; +import com.xero.models.payrollau.SuperFundProducts; +import com.xero.models.payrollau.SuperFunds; +import com.xero.models.payrollau.Timesheet; +import com.xero.models.payrollau.TimesheetObject; import com.xero.models.payrollau.Timesheets; import java.util.UUID; import com.xero.api.XeroApiException; @@ -207,18 +212,18 @@ public HttpResponse createLeaveApplicationForHttpResponse(String accessToken, S /** * Use this method to create a Pay Item - *

200 - A successful request + *

200 - A successful request - currently returns empty array for JSON *

400 - invalid input, object invalid - TODO * @param xeroTenantId Xero identifier for Tenant - * @param payItems The payItems parameter + * @param payItem The payItem parameter * @param accessToken Authorization token for user set in header of each request * @return PayItems * @throws IOException if an error occurs while attempting to invoke the API **/ - public PayItems createPayItem(String accessToken, String xeroTenantId, List payItems) throws IOException { + public PayItems createPayItem(String accessToken, String xeroTenantId, List payItem) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createPayItemForHttpResponse(accessToken, xeroTenantId, payItems); + HttpResponse response = createPayItemForHttpResponse(accessToken, xeroTenantId, payItem); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -229,13 +234,13 @@ public PayItems createPayItem(String accessToken, String xeroTenantId, List payItems) throws IOException { + public HttpResponse createPayItemForHttpResponse(String accessToken, String xeroTenantId, List payItem) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayItem"); - }// verify the required parameter 'payItems' is set - if (payItems == null) { - throw new IllegalArgumentException("Missing the required parameter 'payItems' when calling createPayItem"); + }// verify the required parameter 'payItem' is set + if (payItem == null) { + throw new IllegalArgumentException("Missing the required parameter 'payItem' when calling createPayItem"); } if (accessToken == null) { throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPayItem"); @@ -254,7 +259,7 @@ public HttpResponse createPayItemForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payItems); + content = apiClient.new JacksonJsonHttpContent(payItem); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -265,19 +270,19 @@ public HttpResponse createPayItemForHttpResponse(String accessToken, String xer } /** - * Use this method to create a Payroll Calendars + * Use this method to create a PayRun *

200 - A successful request *

400 - invalid input, object invalid - TODO * @param xeroTenantId Xero identifier for Tenant - * @param payrollCalendars The payrollCalendars parameter + * @param payRun The payRun parameter * @param accessToken Authorization token for user set in header of each request - * @return PayrollCalendars + * @return PayRuns * @throws IOException if an error occurs while attempting to invoke the API **/ - public PayrollCalendars createPayrollCalendar(String accessToken, String xeroTenantId, List payrollCalendars) throws IOException { + public PayRuns createPayRun(String accessToken, String xeroTenantId, List payRun) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createPayrollCalendarForHttpResponse(accessToken, xeroTenantId, payrollCalendars); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createPayRunForHttpResponse(accessToken, xeroTenantId, payRun); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -288,23 +293,23 @@ public PayrollCalendars createPayrollCalendar(String accessToken, String xeroTe return null; } - public HttpResponse createPayrollCalendarForHttpResponse(String accessToken, String xeroTenantId, List payrollCalendars) throws IOException { + public HttpResponse createPayRunForHttpResponse(String accessToken, String xeroTenantId, List payRun) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayrollCalendar"); - }// verify the required parameter 'payrollCalendars' is set - if (payrollCalendars == null) { - throw new IllegalArgumentException("Missing the required parameter 'payrollCalendars' when calling createPayrollCalendar"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayRun"); + }// verify the required parameter 'payRun' is set + if (payRun == null) { + throw new IllegalArgumentException("Missing the required parameter 'payRun' when calling createPayRun"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPayrollCalendar"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPayRun"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/PayrollCalendars"; + String correctPath = "/PayRuns"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -313,7 +318,7 @@ public HttpResponse createPayrollCalendarForHttpResponse(String accessToken, St HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payrollCalendars); + content = apiClient.new JacksonJsonHttpContent(payRun); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -324,19 +329,19 @@ public HttpResponse createPayrollCalendarForHttpResponse(String accessToken, St } /** - * Use this method to create a payrun + * Use this method to create a Payroll Calendars *

200 - A successful request *

400 - invalid input, object invalid - TODO * @param xeroTenantId Xero identifier for Tenant - * @param payruns The payruns parameter + * @param payrollCalendar The payrollCalendar parameter * @param accessToken Authorization token for user set in header of each request - * @return Payruns + * @return PayrollCalendars * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payruns createPayrun(String accessToken, String xeroTenantId, List payruns) throws IOException { + public PayrollCalendars createPayrollCalendar(String accessToken, String xeroTenantId, List payrollCalendar) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createPayrunForHttpResponse(accessToken, xeroTenantId, payruns); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createPayrollCalendarForHttpResponse(accessToken, xeroTenantId, payrollCalendar); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -347,23 +352,23 @@ public Payruns createPayrun(String accessToken, String xeroTenantId, List payruns) throws IOException { + public HttpResponse createPayrollCalendarForHttpResponse(String accessToken, String xeroTenantId, List payrollCalendar) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayrun"); - }// verify the required parameter 'payruns' is set - if (payruns == null) { - throw new IllegalArgumentException("Missing the required parameter 'payruns' when calling createPayrun"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createPayrollCalendar"); + }// verify the required parameter 'payrollCalendar' is set + if (payrollCalendar == null) { + throw new IllegalArgumentException("Missing the required parameter 'payrollCalendar' when calling createPayrollCalendar"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPayrun"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createPayrollCalendar"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/Payruns"; + String correctPath = "/PayrollCalendars"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); @@ -372,7 +377,7 @@ public HttpResponse createPayrunForHttpResponse(String accessToken, String xero HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payruns); + content = apiClient.new JacksonJsonHttpContent(payrollCalendar); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -387,15 +392,15 @@ public HttpResponse createPayrunForHttpResponse(String accessToken, String xero *

200 - A successful request *

400 - invalid input, object invalid - TODO * @param xeroTenantId Xero identifier for Tenant - * @param superfunds The superfunds parameter + * @param superFund The superFund parameter * @param accessToken Authorization token for user set in header of each request - * @return Superfunds + * @return SuperFunds * @throws IOException if an error occurs while attempting to invoke the API **/ - public Superfunds createSuperfund(String accessToken, String xeroTenantId, List superfunds) throws IOException { + public SuperFunds createSuperfund(String accessToken, String xeroTenantId, List superFund) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createSuperfundForHttpResponse(accessToken, xeroTenantId, superfunds); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = createSuperfundForHttpResponse(accessToken, xeroTenantId, superFund); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -406,13 +411,13 @@ public Superfunds createSuperfund(String accessToken, String xeroTenantId, List return null; } - public HttpResponse createSuperfundForHttpResponse(String accessToken, String xeroTenantId, List superfunds) throws IOException { + public HttpResponse createSuperfundForHttpResponse(String accessToken, String xeroTenantId, List superFund) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createSuperfund"); - }// verify the required parameter 'superfunds' is set - if (superfunds == null) { - throw new IllegalArgumentException("Missing the required parameter 'superfunds' when calling createSuperfund"); + }// verify the required parameter 'superFund' is set + if (superFund == null) { + throw new IllegalArgumentException("Missing the required parameter 'superFund' when calling createSuperfund"); } if (accessToken == null) { throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createSuperfund"); @@ -431,7 +436,7 @@ public HttpResponse createSuperfundForHttpResponse(String accessToken, String x HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(superfunds); + content = apiClient.new JacksonJsonHttpContent(superFund); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -446,15 +451,15 @@ public HttpResponse createSuperfundForHttpResponse(String accessToken, String x *

200 - A successful request *

400 - invalid input, object invalid - TODO * @param xeroTenantId Xero identifier for Tenant - * @param timesheets The timesheets parameter + * @param timesheet The timesheet parameter * @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 createTimesheet(String accessToken, String xeroTenantId, Timesheets timesheets) throws IOException { + public Timesheets createTimesheet(String accessToken, String xeroTenantId, List timesheet) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = createTimesheetForHttpResponse(accessToken, xeroTenantId, timesheets); + HttpResponse response = createTimesheetForHttpResponse(accessToken, xeroTenantId, timesheet); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -465,13 +470,13 @@ public Timesheets createTimesheet(String accessToken, String xeroTenantId, Time return null; } - public HttpResponse createTimesheetForHttpResponse(String accessToken, String xeroTenantId, Timesheets timesheets) throws IOException { + public HttpResponse createTimesheetForHttpResponse(String accessToken, String xeroTenantId, List timesheet) 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 'timesheets' is set - if (timesheets == null) { - throw new IllegalArgumentException("Missing the required parameter 'timesheets' 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"); @@ -490,7 +495,7 @@ public HttpResponse createTimesheetForHttpResponse(String accessToken, String x HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(timesheets); + content = apiClient.new JacksonJsonHttpContent(timesheet); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -574,7 +579,7 @@ public HttpResponse getEmployeeForHttpResponse(String accessToken, String xeroT * @return Employees * @throws IOException if an error occurs while attempting to invoke the API **/ - public Employees getEmployees(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public Employees getEmployees(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeesForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); @@ -588,7 +593,7 @@ public Employees getEmployees(String accessToken, String xeroTenantId, OffsetDa return null; } - public HttpResponse getEmployeesForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public HttpResponse getEmployeesForHttpResponse(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, 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"); @@ -723,7 +728,7 @@ public HttpResponse getLeaveApplicationForHttpResponse(String accessToken, Stri * @return LeaveApplications * @throws IOException if an error occurs while attempting to invoke the API **/ - public LeaveApplications getLeaveApplications(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public LeaveApplications getLeaveApplications(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getLeaveApplicationsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); @@ -737,7 +742,7 @@ public LeaveApplications getLeaveApplications(String accessToken, String xeroTe return null; } - public HttpResponse getLeaveApplicationsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public HttpResponse getLeaveApplicationsForHttpResponse(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getLeaveApplications"); @@ -811,7 +816,7 @@ public HttpResponse getLeaveApplicationsForHttpResponse(String accessToken, Str * @return PayItems * @throws IOException if an error occurs while attempting to invoke the API **/ - public PayItems getPayItems(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public PayItems getPayItems(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getPayItemsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); @@ -825,7 +830,7 @@ public PayItems getPayItems(String accessToken, String xeroTenantId, OffsetDate return null; } - public HttpResponse getPayItemsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public HttpResponse getPayItemsForHttpResponse(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayItems"); @@ -887,19 +892,18 @@ public HttpResponse getPayItemsForHttpResponse(String accessToken, String xeroT } /** - * searches Payroll Calendars + * searches for an payrun by unique id *

200 - search results matching criteria - *

400 - validation error for a bad request * @param xeroTenantId Xero identifier for Tenant - * @param payrollCalendarID Payroll Calendar id for single object + * @param payRunID PayRun id for single object * @param accessToken Authorization token for user set in header of each request - * @return PayrollCalendars + * @return PayRuns * @throws IOException if an error occurs while attempting to invoke the API **/ - public PayrollCalendars getPayrollCalendar(String accessToken, String xeroTenantId, UUID payrollCalendarID) throws IOException { + public PayRuns getPayRun(String accessToken, String xeroTenantId, UUID payRunID) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = getPayrollCalendarForHttpResponse(accessToken, xeroTenantId, payrollCalendarID); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getPayRunForHttpResponse(accessToken, xeroTenantId, payRunID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -910,27 +914,27 @@ public PayrollCalendars getPayrollCalendar(String accessToken, String xeroTenan return null; } - public HttpResponse getPayrollCalendarForHttpResponse(String accessToken, String xeroTenantId, UUID payrollCalendarID) throws IOException { + 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 getPayrollCalendar"); - }// verify the required parameter 'payrollCalendarID' is set - if (payrollCalendarID == null) { - throw new IllegalArgumentException("Missing the required parameter 'payrollCalendarID' when calling getPayrollCalendar"); + 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 getPayrollCalendar"); + 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()); - String correctPath = "/PayrollCalendars/{PayrollCalendarID}"; + String correctPath = "/PayRuns/{PayRunID}"; // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("PayrollCalendarID", payrollCalendarID); + uriVariables.put("PayRunID", payRunID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); @@ -949,22 +953,22 @@ public HttpResponse getPayrollCalendarForHttpResponse(String accessToken, Strin } /** - * searches Payroll Calendars + * searches PayRuns *

200 - search results matching criteria *

400 - validation error for a bad request * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 objects will be returned in a single API call + * @param page e.g. page=1 – Up to 100 PayRuns will be returned in a single API call * @param accessToken Authorization token for user set in header of each request - * @return PayrollCalendars + * @return PayRuns * @throws IOException if an error occurs while attempting to invoke the API **/ - public PayrollCalendars getPayrollCalendars(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public PayRuns getPayRuns(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = getPayrollCalendarsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getPayRunsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -975,20 +979,20 @@ public PayrollCalendars getPayrollCalendars(String accessToken, String xeroTena return null; } - public HttpResponse getPayrollCalendarsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public HttpResponse getPayRunsForHttpResponse(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayrollCalendars"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayRuns"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getPayrollCalendars"); + 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()); - String correctPath = "/PayrollCalendars"; + String correctPath = "/PayRuns"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -1037,18 +1041,19 @@ public HttpResponse getPayrollCalendarsForHttpResponse(String accessToken, Stri } /** - * searches for an payrun by unique id + * searches Payroll Calendars *

200 - search results matching criteria + *

400 - validation error for a bad request * @param xeroTenantId Xero identifier for Tenant - * @param payrunID Payrun id for single object + * @param payrollCalendarID Payroll Calendar id for single object * @param accessToken Authorization token for user set in header of each request - * @return Payruns + * @return PayrollCalendars * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payruns getPayrun(String accessToken, String xeroTenantId, UUID payrunID) throws IOException { + public PayrollCalendars getPayrollCalendar(String accessToken, String xeroTenantId, UUID payrollCalendarID) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = getPayrunForHttpResponse(accessToken, xeroTenantId, payrunID); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getPayrollCalendarForHttpResponse(accessToken, xeroTenantId, payrollCalendarID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1059,27 +1064,27 @@ public Payruns getPayrun(String accessToken, String xeroTenantId, UUID payrunID return null; } - public HttpResponse getPayrunForHttpResponse(String accessToken, String xeroTenantId, UUID payrunID) throws IOException { + public HttpResponse getPayrollCalendarForHttpResponse(String accessToken, String xeroTenantId, UUID payrollCalendarID) 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"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayrollCalendar"); + }// verify the required parameter 'payrollCalendarID' is set + if (payrollCalendarID == null) { + throw new IllegalArgumentException("Missing the required parameter 'payrollCalendarID' when calling getPayrollCalendar"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getPayrun"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getPayrollCalendar"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/Payruns/{PayrunID}"; + String correctPath = "/PayrollCalendars/{PayrollCalendarID}"; // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("PayrunID", payrunID); + uriVariables.put("PayrollCalendarID", payrollCalendarID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); @@ -1098,22 +1103,22 @@ public HttpResponse getPayrunForHttpResponse(String accessToken, String xeroTen } /** - * searches payruns + * searches Payroll Calendars *

200 - search results matching criteria *

400 - validation error for a bad request * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 payruns will be returned in a single API call + * @param page e.g. page=1 – Up to 100 objects will be returned in a single API call * @param accessToken Authorization token for user set in header of each request - * @return Payruns + * @return PayrollCalendars * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payruns getPayruns(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public PayrollCalendars getPayrollCalendars(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = getPayrunsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getPayrollCalendarsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1124,20 +1129,20 @@ public Payruns getPayruns(String accessToken, String xeroTenantId, OffsetDateTi return null; } - public HttpResponse getPayrunsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public HttpResponse getPayrollCalendarsForHttpResponse(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayruns"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayrollCalendars"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getPayruns"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getPayrollCalendars"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/Payruns"; + String correctPath = "/PayrollCalendars"; UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); if (where != null) { String key = "where"; @@ -1191,12 +1196,12 @@ public HttpResponse getPayrunsForHttpResponse(String accessToken, String xeroTe * @param xeroTenantId Xero identifier for Tenant * @param payslipID Payslip id for single object * @param accessToken Authorization token for user set in header of each request - * @return Payslip + * @return PayslipObject * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payslip getPayslip(String accessToken, String xeroTenantId, UUID payslipID) throws IOException { + public PayslipObject getPayslip(String accessToken, String xeroTenantId, UUID payslipID) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = getPayslipForHttpResponse(accessToken, xeroTenantId, payslipID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { @@ -1251,12 +1256,12 @@ public HttpResponse getPayslipForHttpResponse(String accessToken, String xeroTe *

200 - payroll settings * @param xeroTenantId Xero identifier for Tenant * @param accessToken Authorization token for user set in header of each request - * @return Settings + * @return SettingsObject * @throws IOException if an error occurs while attempting to invoke the API **/ - public Settings getSettings(String accessToken, String xeroTenantId) throws IOException { + public SettingsObject getSettings(String accessToken, String xeroTenantId) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = getSettingsForHttpResponse(accessToken, xeroTenantId); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { @@ -1299,81 +1304,20 @@ public HttpResponse getSettingsForHttpResponse(String accessToken, String xeroT } /** - * searches for an Superfund by unique id - *

200 - search results matching criteria - * @param xeroTenantId Xero identifier for Tenant - * @param superfundID Superfund id for single object - * @param accessToken Authorization token for user set in header of each request - * @return Superfunds - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Superfunds getSuperfund(String accessToken, String xeroTenantId, UUID superfundID) throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = getSuperfundForHttpResponse(accessToken, xeroTenantId, superfundID); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e,apiClient); - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - public HttpResponse getSuperfundForHttpResponse(String accessToken, String xeroTenantId, UUID superfundID) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getSuperfund"); - }// verify the required parameter 'superfundID' is set - if (superfundID == null) { - throw new IllegalArgumentException("Missing the required parameter 'superfundID' when calling getSuperfund"); - } - if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getSuperfund"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - headers.setUserAgent(this.getUserAgent()); - - String correctPath = "/Superfunds/{SuperfundID}"; - - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("SuperfundID", superfundID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - - - HttpContent content = null; - - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - - return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); - } - - /** - * searches SuperfundProducts + * searches SuperFundProducts *

200 - search results matching criteria *

400 - validation error for a bad request * @param xeroTenantId Xero identifier for Tenant * @param ABN The ABN of the Regulated SuperFund * @param USI The USI of the Regulated SuperFund * @param accessToken Authorization token for user set in header of each request - * @return SuperfundProducts + * @return SuperFundProducts * @throws IOException if an error occurs while attempting to invoke the API **/ - public SuperfundProducts getSuperfundProducts(String accessToken, String xeroTenantId, String ABN, String USI) throws IOException { + public SuperFundProducts getSuperFundProducts(String accessToken, String xeroTenantId, String ABN, String USI) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = getSuperfundProductsForHttpResponse(accessToken, xeroTenantId, ABN, USI); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getSuperFundProductsForHttpResponse(accessToken, xeroTenantId, ABN, USI); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1384,13 +1328,13 @@ public SuperfundProducts getSuperfundProducts(String accessToken, String xeroTe return null; } - public HttpResponse getSuperfundProductsForHttpResponse(String accessToken, String xeroTenantId, String ABN, String USI) throws IOException { + public HttpResponse getSuperFundProductsForHttpResponse(String accessToken, String xeroTenantId, String ABN, String USI) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getSuperfundProducts"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getSuperFundProducts"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getSuperfundProducts"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getSuperFundProducts"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -1436,22 +1380,22 @@ public HttpResponse getSuperfundProductsForHttpResponse(String accessToken, Str } /** - * searches Superfunds + * searches SuperFunds *

200 - search results matching criteria *

400 - validation error for a bad request * @param xeroTenantId Xero identifier for Tenant * @param ifModifiedSince Only records created or modified since this timestamp will be returned * @param where Filter by an any element * @param order Order by an any element - * @param page e.g. page=1 – Up to 100 Superfunds will be returned in a single API call + * @param page e.g. page=1 – Up to 100 SuperFunds will be returned in a single API call * @param accessToken Authorization token for user set in header of each request - * @return Superfunds + * @return SuperFunds * @throws IOException if an error occurs while attempting to invoke the API **/ - public Superfunds getSuperfunds(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public SuperFunds getSuperFunds(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = getSuperfundsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getSuperFundsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1462,13 +1406,13 @@ public Superfunds getSuperfunds(String accessToken, String xeroTenantId, Offset return null; } - public HttpResponse getSuperfundsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public HttpResponse getSuperFundsForHttpResponse(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getSuperfunds"); + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getSuperFunds"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getSuperfunds"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getSuperFunds"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -1516,6 +1460,67 @@ public HttpResponse getSuperfundsForHttpResponse(String accessToken, String xer + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = new NetHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); + + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + } + + /** + * searches for an Superfund by unique id + *

200 - search results matching criteria + * @param xeroTenantId Xero identifier for Tenant + * @param superFundID Superfund id for single object + * @param accessToken Authorization token for user set in header of each request + * @return SuperFunds + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public SuperFunds getSuperfund(String accessToken, String xeroTenantId, UUID superFundID) throws IOException { + try { + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = getSuperfundForHttpResponse(accessToken, xeroTenantId, superFundID); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + public HttpResponse getSuperfundForHttpResponse(String accessToken, String xeroTenantId, UUID superFundID) throws IOException { + // verify the required parameter 'xeroTenantId' is set + if (xeroTenantId == null) { + throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getSuperfund"); + }// verify the required parameter 'superFundID' is set + if (superFundID == null) { + throw new IllegalArgumentException("Missing the required parameter 'superFundID' when calling getSuperfund"); + } + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getSuperfund"); + } + HttpHeaders headers = new HttpHeaders(); + headers.set("xero-tenant-id", xeroTenantId); + headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + + String correctPath = "/Superfunds/{SuperFundID}"; + + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("SuperFundID", superFundID); + + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); + String url = uriBuilder.buildFromMap(uriVariables).toString(); + GenericUrl genericUrl = new GenericUrl(url); + + + HttpContent content = null; + + + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = new NetHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1529,12 +1534,12 @@ public HttpResponse getSuperfundsForHttpResponse(String accessToken, String xer * @param xeroTenantId Xero identifier for Tenant * @param timesheetID Timesheet id for single object * @param accessToken Authorization token for user set in header of each request - * @return Timesheets + * @return TimesheetObject * @throws IOException if an error occurs while attempting to invoke the API **/ - public Timesheets getTimesheet(String accessToken, String xeroTenantId, UUID timesheetID) throws IOException { + public TimesheetObject getTimesheet(String accessToken, String xeroTenantId, UUID timesheetID) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = getTimesheetForHttpResponse(accessToken, xeroTenantId, timesheetID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { @@ -1597,7 +1602,7 @@ public HttpResponse getTimesheetForHttpResponse(String accessToken, String xero * @return Timesheets * @throws IOException if an error occurs while attempting to invoke the API **/ - public Timesheets getTimesheets(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public Timesheets getTimesheets(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getTimesheetsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page); @@ -1611,7 +1616,7 @@ public Timesheets getTimesheets(String accessToken, String xeroTenantId, Offset return null; } - public HttpResponse getTimesheetsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException { + public HttpResponse getTimesheetsForHttpResponse(String accessToken, String xeroTenantId, String ifModifiedSince, String where, String order, Integer page) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTimesheets"); @@ -1738,7 +1743,7 @@ public HttpResponse updateEmployeeForHttpResponse(String accessToken, String xe } /** - * Use this method to create a Leave Application + * Use this method to update a Leave Application *

200 - A successful request *

400 - invalid input, object invalid - TODO * @param xeroTenantId Xero identifier for Tenant @@ -1806,20 +1811,20 @@ public HttpResponse updateLeaveApplicationForHttpResponse(String accessToken, S } /** - * Update a Payrun - * Update properties on a single payrun + * Update a PayRun + * Update properties on a single PayRun *

200 - A successful request * @param xeroTenantId Xero identifier for Tenant - * @param payrunID Payrun id for single object - * @param payruns The payruns parameter + * @param payRunID PayRun id for single object + * @param payRun The payRun parameter * @param accessToken Authorization token for user set in header of each request - * @return Payruns + * @return PayRuns * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payruns updatePayrun(String accessToken, String xeroTenantId, UUID payrunID, List payruns) throws IOException { + public PayRuns updatePayRun(String accessToken, String xeroTenantId, UUID payRunID, List payRun) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = updatePayrunForHttpResponse(accessToken, xeroTenantId, payrunID, payruns); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = updatePayRunForHttpResponse(accessToken, xeroTenantId, payRunID, payRun); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1830,27 +1835,27 @@ public Payruns updatePayrun(String accessToken, String xeroTenantId, UUID payru return null; } - public HttpResponse updatePayrunForHttpResponse(String accessToken, String xeroTenantId, UUID payrunID, List payruns) throws IOException { + public HttpResponse updatePayRunForHttpResponse(String accessToken, String xeroTenantId, UUID payRunID, List payRun) 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"); + 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"); } if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updatePayrun"); + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updatePayRun"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/Payruns/{PayrunID}"; + String correctPath = "/PayRuns/{PayRunID}"; // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("PayrunID", payrunID); + uriVariables.put("PayRunID", payRunID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); @@ -1860,66 +1865,7 @@ public HttpResponse updatePayrunForHttpResponse(String accessToken, String xero HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payruns); - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - - return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); - } - - /** - * Use this add, update or delete one or more payslip line items - *

200 - A successful request - *

400 - invalid input, object invalid - TODO - * @param xeroTenantId Xero identifier for Tenant - * @param payslip The payslip parameter - * @param accessToken Authorization token for user set in header of each request - * @return Payslip - * @throws IOException if an error occurs while attempting to invoke the API - **/ - public Payslip updatePayslip(String accessToken, String xeroTenantId, List payslip) throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = updatePayslipForHttpResponse(accessToken, xeroTenantId, payslip); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e,apiClient); - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - public HttpResponse updatePayslipForHttpResponse(String accessToken, String xeroTenantId, List payslip) throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePayslip"); - }// verify the required parameter 'payslip' is set - if (payslip == null) { - throw new IllegalArgumentException("Missing the required parameter 'payslip' when calling updatePayslip"); - } - if (accessToken == null) { - throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updatePayslip"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.setAccept("application/json"); - headers.setUserAgent(this.getUserAgent()); - - String correctPath = "/Payslip"; - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - - - HttpContent content = null; - - - content = apiClient.new JacksonJsonHttpContent(payslip); + content = apiClient.new JacksonJsonHttpContent(payRun); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -1931,19 +1877,19 @@ public HttpResponse updatePayslipForHttpResponse(String accessToken, String xer /** * Update a Payslip - * Update lines on a single payslip - *

200 - A successful request + * Update lines on a single payslips + *

200 - A successful request - currently returns empty array for JSON * @param xeroTenantId Xero identifier for Tenant * @param payslipID Payslip id for single object - * @param payslip The payslip parameter + * @param payslipObject The payslipObject parameter * @param accessToken Authorization token for user set in header of each request - * @return Payslip + * @return PayslipObject * @throws IOException if an error occurs while attempting to invoke the API **/ - public Payslip updatePayslipByID(String accessToken, String xeroTenantId, UUID payslipID, List payslip) throws IOException { + public PayslipObject updatePayslipByID(String accessToken, String xeroTenantId, UUID payslipID, PayslipObject payslipObject) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = updatePayslipByIDForHttpResponse(accessToken, xeroTenantId, payslipID, payslip); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = updatePayslipByIDForHttpResponse(accessToken, xeroTenantId, payslipID, payslipObject); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1954,7 +1900,7 @@ public Payslip updatePayslipByID(String accessToken, String xeroTenantId, UUID return null; } - public HttpResponse updatePayslipByIDForHttpResponse(String accessToken, String xeroTenantId, UUID payslipID, List payslip) throws IOException { + public HttpResponse updatePayslipByIDForHttpResponse(String accessToken, String xeroTenantId, UUID payslipID, PayslipObject payslipObject) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updatePayslipByID"); @@ -1984,7 +1930,7 @@ public HttpResponse updatePayslipByIDForHttpResponse(String accessToken, String HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payslip); + content = apiClient.new JacksonJsonHttpContent(payslipObject); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -1999,16 +1945,16 @@ public HttpResponse updatePayslipByIDForHttpResponse(String accessToken, String * Update properties on a single Superfund *

200 - A successful request * @param xeroTenantId Xero identifier for Tenant - * @param superfundID Superfund id for single object - * @param superfunds The superfunds parameter + * @param superFundID Superfund id for single object + * @param superFund The superFund parameter * @param accessToken Authorization token for user set in header of each request - * @return Superfunds + * @return SuperFunds * @throws IOException if an error occurs while attempting to invoke the API **/ - public Superfunds updateSuperfund(String accessToken, String xeroTenantId, UUID superfundID, Superfunds superfunds) throws IOException { + public SuperFunds updateSuperfund(String accessToken, String xeroTenantId, UUID superFundID, List superFund) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = updateSuperfundForHttpResponse(accessToken, xeroTenantId, superfundID, superfunds); + TypeReference typeRef = new TypeReference() {}; + HttpResponse response = updateSuperfundForHttpResponse(accessToken, xeroTenantId, superFundID, superFund); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -2019,13 +1965,13 @@ public Superfunds updateSuperfund(String accessToken, String xeroTenantId, UUID return null; } - public HttpResponse updateSuperfundForHttpResponse(String accessToken, String xeroTenantId, UUID superfundID, Superfunds superfunds) throws IOException { + public HttpResponse updateSuperfundForHttpResponse(String accessToken, String xeroTenantId, UUID superFundID, List superFund) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateSuperfund"); - }// verify the required parameter 'superfundID' is set - if (superfundID == null) { - throw new IllegalArgumentException("Missing the required parameter 'superfundID' when calling updateSuperfund"); + }// verify the required parameter 'superFundID' is set + if (superFundID == null) { + throw new IllegalArgumentException("Missing the required parameter 'superFundID' when calling updateSuperfund"); } if (accessToken == null) { throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updateSuperfund"); @@ -2035,11 +1981,11 @@ public HttpResponse updateSuperfundForHttpResponse(String accessToken, String x headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); - String correctPath = "/Superfunds/{SuperfundID}"; + String correctPath = "/Superfunds/{SuperFundID}"; // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("SuperfundID", superfundID); + uriVariables.put("SuperFundID", superFundID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath); String url = uriBuilder.buildFromMap(uriVariables).toString(); @@ -2049,7 +1995,7 @@ public HttpResponse updateSuperfundForHttpResponse(String accessToken, String x HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(superfunds); + content = apiClient.new JacksonJsonHttpContent(superFund); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -2065,15 +2011,15 @@ public HttpResponse updateSuperfundForHttpResponse(String accessToken, String x *

200 - A successful request * @param xeroTenantId Xero identifier for Tenant * @param timesheetID Timesheet id for single object - * @param timesheets The timesheets parameter + * @param timesheet The timesheet parameter * @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 updateTimesheet(String accessToken, String xeroTenantId, UUID timesheetID, Timesheets timesheets) throws IOException { + public Timesheets updateTimesheet(String accessToken, String xeroTenantId, UUID timesheetID, List timesheet) throws IOException { try { TypeReference typeRef = new TypeReference() {}; - HttpResponse response = updateTimesheetForHttpResponse(accessToken, xeroTenantId, timesheetID, timesheets); + HttpResponse response = updateTimesheetForHttpResponse(accessToken, xeroTenantId, timesheetID, timesheet); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -2084,7 +2030,7 @@ public Timesheets updateTimesheet(String accessToken, String xeroTenantId, UUID return null; } - public HttpResponse updateTimesheetForHttpResponse(String accessToken, String xeroTenantId, UUID timesheetID, Timesheets timesheets) throws IOException { + public HttpResponse updateTimesheetForHttpResponse(String accessToken, String xeroTenantId, UUID timesheetID, List timesheet) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateTimesheet"); @@ -2114,7 +2060,7 @@ public HttpResponse updateTimesheetForHttpResponse(String accessToken, String x HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(timesheets); + content = apiClient.new JacksonJsonHttpContent(timesheet); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); diff --git a/src/main/java/com/xero/models/accounting/BatchPayment.java b/src/main/java/com/xero/models/accounting/BatchPayment.java index 8ecfaa01..6ce74904 100644 --- a/src/main/java/com/xero/models/accounting/BatchPayment.java +++ b/src/main/java/com/xero/models/accounting/BatchPayment.java @@ -79,9 +79,44 @@ public class BatchPayment { @JsonProperty("Payments") private List payments = new ArrayList(); + /** + * PAYBATCH for bill payments or RECBATCH for sales invoice payments (read-only) + */ + public enum TypeEnum { + PAYBATCH("PAYBATCH"), + + RECBATCH("RECBATCH"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + @JsonProperty("Type") - private String type; + private TypeEnum type; @JsonProperty("Status") @@ -301,7 +336,7 @@ public void setPayments(List payments) { * @return type **/ @ApiModelProperty(value = "PAYBATCH for bill payments or RECBATCH for sales invoice payments (read-only)") - public String getType() { + public TypeEnum getType() { return type; } diff --git a/src/main/java/com/xero/models/accounting/Quote.java b/src/main/java/com/xero/models/accounting/Quote.java new file mode 100644 index 00000000..954fa249 --- /dev/null +++ b/src/main/java/com/xero/models/accounting/Quote.java @@ -0,0 +1,570 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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.models.accounting; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.accounting.Contact; +import com.xero.models.accounting.CurrencyCode; +import com.xero.models.accounting.LineAmountTypes; +import com.xero.models.accounting.LineItem; +import com.xero.models.accounting.QuoteStatusCodes; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Quote + */ + +public class Quote { + + @JsonProperty("QuoteID") + private UUID quoteID; + + + @JsonProperty("QuoteNumber") + private String quoteNumber; + + + @JsonProperty("Reference") + private String reference; + + + @JsonProperty("Terms") + private String terms; + + + @JsonProperty("Contact") + private Contact contact = null; + + + @JsonProperty("LineItems") + private List lineItems = new ArrayList(); + + @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("Date") + private LocalDate date; + + + @JsonProperty("DateString") + private String dateString; + + @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("ExpiryDate") + private LocalDate expiryDate; + + + @JsonProperty("ExpiryDateString") + private String expiryDateString; + + + @JsonProperty("Status") + private QuoteStatusCodes status; + + + @JsonProperty("CurrencyCode") + private CurrencyCode currencyCode; + + + @JsonProperty("CurrencyRate") + private Double currencyRate; + + + @JsonProperty("SubTotal") + private Double subTotal; + + + @JsonProperty("TotalTax") + private Double totalTax; + + + @JsonProperty("Total") + private Double total; + + + @JsonProperty("TotalDiscount") + private Double totalDiscount; + + + @JsonProperty("Title") + private String title; + + + @JsonProperty("Summary") + private String summary; + + + @JsonProperty("BrandingThemeID") + private UUID brandingThemeID; + + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + + + @JsonProperty("LineAmountTypes") + private LineAmountTypes lineAmountTypes; + + public Quote quoteID(UUID quoteID) { + this.quoteID = quoteID; + return this; + } + + /** + * Xero generated unique identifier for quote + * @return quoteID + **/ + @ApiModelProperty(value = "Xero generated unique identifier for quote") + public UUID getQuoteID() { + return quoteID; + } + + public void setQuoteID(UUID quoteID) { + this.quoteID = quoteID; + } + + public Quote quoteNumber(String quoteNumber) { + this.quoteNumber = quoteNumber; + return this; + } + + /** + * Unique alpha numeric code identifying quote (when missing will auto-generate from your Organisation Invoice Settings) + * @return quoteNumber + **/ + @ApiModelProperty(value = "Unique alpha numeric code identifying quote (when missing will auto-generate from your Organisation Invoice Settings)") + public String getQuoteNumber() { + return quoteNumber; + } + + public void setQuoteNumber(String quoteNumber) { + this.quoteNumber = quoteNumber; + } + + public Quote reference(String reference) { + this.reference = reference; + return this; + } + + /** + * Additional reference number + * @return reference + **/ + @ApiModelProperty(value = "Additional reference number") + public String getReference() { + return reference; + } + + public void setReference(String reference) { + this.reference = reference; + } + + public Quote terms(String terms) { + this.terms = terms; + return this; + } + + /** + * Terms of the quote + * @return terms + **/ + @ApiModelProperty(value = "Terms of the quote") + public String getTerms() { + return terms; + } + + public void setTerms(String terms) { + this.terms = terms; + } + + public Quote contact(Contact contact) { + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + **/ + @ApiModelProperty(required = true, value = "") + public Contact getContact() { + return contact; + } + + public void setContact(Contact contact) { + this.contact = contact; + } + + public Quote lineItems(List lineItems) { + this.lineItems = lineItems; + return this; + } + + public Quote addLineItemsItem(LineItem lineItemsItem) { + if (this.lineItems == null) { + this.lineItems = new ArrayList(); + } + this.lineItems.add(lineItemsItem); + return this; + } + + /** + * See LineItems + * @return lineItems + **/ + @ApiModelProperty(value = "See LineItems") + public List getLineItems() { + return lineItems; + } + + public void setLineItems(List lineItems) { + this.lineItems = lineItems; + } + + public Quote date(LocalDate date) { + this.date = date; + return this; + } + + /** + * Date quote was issued – YYYY-MM-DD. If the Date element is not specified it will default to the current date based on the timezone setting of the organisation + * @return date + **/ + @ApiModelProperty(value = "Date quote was issued – YYYY-MM-DD. If the Date element is not specified it will default to the current date based on the timezone setting of the organisation") + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + + public Quote dateString(String dateString) { + this.dateString = dateString; + return this; + } + + /** + * Date the quote was issued (YYYY-MM-DD) + * @return dateString + **/ + @ApiModelProperty(value = "Date the quote was issued (YYYY-MM-DD)") + public String getDateString() { + return dateString; + } + + public void setDateString(String dateString) { + this.dateString = dateString; + } + + public Quote expiryDate(LocalDate expiryDate) { + this.expiryDate = expiryDate; + return this; + } + + /** + * Date the quote expires – YYYY-MM-DD. + * @return expiryDate + **/ + @ApiModelProperty(value = "Date the quote expires – YYYY-MM-DD.") + public LocalDate getExpiryDate() { + return expiryDate; + } + + public void setExpiryDate(LocalDate expiryDate) { + this.expiryDate = expiryDate; + } + + public Quote expiryDateString(String expiryDateString) { + this.expiryDateString = expiryDateString; + return this; + } + + /** + * Date the quote expires – YYYY-MM-DD. + * @return expiryDateString + **/ + @ApiModelProperty(value = "Date the quote expires – YYYY-MM-DD.") + public String getExpiryDateString() { + return expiryDateString; + } + + public void setExpiryDateString(String expiryDateString) { + this.expiryDateString = expiryDateString; + } + + public Quote status(QuoteStatusCodes status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(value = "") + public QuoteStatusCodes getStatus() { + return status; + } + + public void setStatus(QuoteStatusCodes status) { + this.status = status; + } + + public Quote currencyCode(CurrencyCode currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + /** + * Get currencyCode + * @return currencyCode + **/ + @ApiModelProperty(value = "") + public CurrencyCode getCurrencyCode() { + return currencyCode; + } + + public void setCurrencyCode(CurrencyCode currencyCode) { + this.currencyCode = currencyCode; + } + + public Quote currencyRate(Double currencyRate) { + this.currencyRate = currencyRate; + return this; + } + + /** + * The currency rate for a multicurrency quote. If no rate is specified, the XE.com day rate is used. + * @return currencyRate + **/ + @ApiModelProperty(value = "The currency rate for a multicurrency quote. If no rate is specified, the XE.com day rate is used.") + public Double getCurrencyRate() { + return currencyRate; + } + + public void setCurrencyRate(Double currencyRate) { + this.currencyRate = currencyRate; + } + + /** + * Total of quote excluding taxes. + * @return subTotal + **/ + @ApiModelProperty(value = "Total of quote excluding taxes.") + public Double getSubTotal() { + return subTotal; + } + + /** + * Total tax on quote + * @return totalTax + **/ + @ApiModelProperty(value = "Total tax on quote") + public Double getTotalTax() { + return totalTax; + } + + /** + * Total of Quote tax inclusive (i.e. SubTotal + TotalTax). This will be ignored if it doesn’t equal the sum of the LineAmounts + * @return total + **/ + @ApiModelProperty(value = "Total of Quote tax inclusive (i.e. SubTotal + TotalTax). This will be ignored if it doesn’t equal the sum of the LineAmounts") + public Double getTotal() { + return total; + } + + /** + * Total of discounts applied on the quote line items + * @return totalDiscount + **/ + @ApiModelProperty(value = "Total of discounts applied on the quote line items") + public Double getTotalDiscount() { + return totalDiscount; + } + + public Quote title(String title) { + this.title = title; + return this; + } + + /** + * Title text for the quote + * @return title + **/ + @ApiModelProperty(value = "Title text for the quote") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Quote summary(String summary) { + this.summary = summary; + return this; + } + + /** + * Summary text for the quote + * @return summary + **/ + @ApiModelProperty(value = "Summary text for the quote") + public String getSummary() { + return summary; + } + + public void setSummary(String summary) { + this.summary = summary; + } + + public Quote brandingThemeID(UUID brandingThemeID) { + this.brandingThemeID = brandingThemeID; + return this; + } + + /** + * See BrandingThemes + * @return brandingThemeID + **/ + @ApiModelProperty(value = "See BrandingThemes") + public UUID getBrandingThemeID() { + return brandingThemeID; + } + + public void setBrandingThemeID(UUID brandingThemeID) { + this.brandingThemeID = brandingThemeID; + } + + /** + * Last modified date UTC format + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Last modified date UTC format") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public Quote lineAmountTypes(LineAmountTypes lineAmountTypes) { + this.lineAmountTypes = lineAmountTypes; + return this; + } + + /** + * Get lineAmountTypes + * @return lineAmountTypes + **/ + @ApiModelProperty(value = "") + public LineAmountTypes getLineAmountTypes() { + return lineAmountTypes; + } + + public void setLineAmountTypes(LineAmountTypes lineAmountTypes) { + this.lineAmountTypes = lineAmountTypes; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Quote quote = (Quote) o; + return Objects.equals(this.quoteID, quote.quoteID) && + Objects.equals(this.quoteNumber, quote.quoteNumber) && + Objects.equals(this.reference, quote.reference) && + Objects.equals(this.terms, quote.terms) && + Objects.equals(this.contact, quote.contact) && + Objects.equals(this.lineItems, quote.lineItems) && + Objects.equals(this.date, quote.date) && + Objects.equals(this.dateString, quote.dateString) && + Objects.equals(this.expiryDate, quote.expiryDate) && + Objects.equals(this.expiryDateString, quote.expiryDateString) && + Objects.equals(this.status, quote.status) && + Objects.equals(this.currencyCode, quote.currencyCode) && + Objects.equals(this.currencyRate, quote.currencyRate) && + Objects.equals(this.subTotal, quote.subTotal) && + Objects.equals(this.totalTax, quote.totalTax) && + Objects.equals(this.total, quote.total) && + Objects.equals(this.totalDiscount, quote.totalDiscount) && + Objects.equals(this.title, quote.title) && + Objects.equals(this.summary, quote.summary) && + Objects.equals(this.brandingThemeID, quote.brandingThemeID) && + Objects.equals(this.updatedDateUTC, quote.updatedDateUTC) && + Objects.equals(this.lineAmountTypes, quote.lineAmountTypes); + } + + @Override + public int hashCode() { + return Objects.hash(quoteID, quoteNumber, reference, terms, contact, lineItems, date, dateString, expiryDate, expiryDateString, status, currencyCode, currencyRate, subTotal, totalTax, total, totalDiscount, title, summary, brandingThemeID, updatedDateUTC, lineAmountTypes); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Quote {\n"); + sb.append(" quoteID: ").append(toIndentedString(quoteID)).append("\n"); + sb.append(" quoteNumber: ").append(toIndentedString(quoteNumber)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" terms: ").append(toIndentedString(terms)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateString: ").append(toIndentedString(dateString)).append("\n"); + sb.append(" expiryDate: ").append(toIndentedString(expiryDate)).append("\n"); + sb.append(" expiryDateString: ").append(toIndentedString(expiryDateString)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" currencyCode: ").append(toIndentedString(currencyCode)).append("\n"); + sb.append(" currencyRate: ").append(toIndentedString(currencyRate)).append("\n"); + sb.append(" subTotal: ").append(toIndentedString(subTotal)).append("\n"); + sb.append(" totalTax: ").append(toIndentedString(totalTax)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" totalDiscount: ").append(toIndentedString(totalDiscount)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" brandingThemeID: ").append(toIndentedString(brandingThemeID)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); + sb.append(" lineAmountTypes: ").append(toIndentedString(lineAmountTypes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/accounting/QuoteStatusCodes.java b/src/main/java/com/xero/models/accounting/QuoteStatusCodes.java new file mode 100644 index 00000000..0d4bf206 --- /dev/null +++ b/src/main/java/com/xero/models/accounting/QuoteStatusCodes.java @@ -0,0 +1,64 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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.models.accounting; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * The status of the quote. + */ +public enum QuoteStatusCodes { + + DRAFT("DRAFT"), + + SENT("SENT"), + + DECLINED("DECLINED"), + + ACCEPTED("ACCEPTED"), + + INVOICED("INVOICED"); + + private String value; + + QuoteStatusCodes(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static QuoteStatusCodes fromValue(String value) { + for (QuoteStatusCodes b : QuoteStatusCodes.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/xero/models/accounting/Quotes.java b/src/main/java/com/xero/models/accounting/Quotes.java new file mode 100644 index 00000000..d02827df --- /dev/null +++ b/src/main/java/com/xero/models/accounting/Quotes.java @@ -0,0 +1,104 @@ +/* + * Accounting API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * Contact: api@xero.com + * + * 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.models.accounting; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.accounting.Quote; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Quotes + */ + +public class Quotes { + + @JsonProperty("Quotes") + private List quotes = new ArrayList(); + + public Quotes quotes(List quotes) { + this.quotes = quotes; + return this; + } + + public Quotes addQuotesItem(Quote quotesItem) { + if (this.quotes == null) { + this.quotes = new ArrayList(); + } + this.quotes.add(quotesItem); + return this; + } + + /** + * Get quotes + * @return quotes + **/ + @ApiModelProperty(value = "") + public List getQuotes() { + return quotes; + } + + public void setQuotes(List quotes) { + this.quotes = quotes; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Quotes quotes = (Quotes) o; + return Objects.equals(this.quotes, quotes.quotes); + } + + @Override + public int hashCode() { + return Objects.hash(quotes); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Quotes {\n"); + sb.append(" quotes: ").append(toIndentedString(quotes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/accounting/TaxRate.java b/src/main/java/com/xero/models/accounting/TaxRate.java index 49472b6b..221f2de0 100644 --- a/src/main/java/com/xero/models/accounting/TaxRate.java +++ b/src/main/java/com/xero/models/accounting/TaxRate.java @@ -51,7 +51,9 @@ public enum StatusEnum { DELETED("DELETED"), - ARCHIVED("ARCHIVED"); + ARCHIVED("ARCHIVED"), + + PENDING("PENDING"); private String value; diff --git a/src/main/java/com/xero/models/payrollau/DeductionLine.java b/src/main/java/com/xero/models/payrollau/DeductionLine.java index cf22d5d8..6236fae1 100644 --- a/src/main/java/com/xero/models/payrollau/DeductionLine.java +++ b/src/main/java/com/xero/models/payrollau/DeductionLine.java @@ -42,6 +42,14 @@ public class DeductionLine { @JsonProperty("Amount") private Float amount; + + @JsonProperty("Percentage") + private Float percentage; + + + @JsonProperty("NumberOfUnits") + private Float numberOfUnits; + public DeductionLine deductionTypeID(UUID deductionTypeID) { this.deductionTypeID = deductionTypeID; return this; @@ -96,6 +104,42 @@ public void setAmount(Float amount) { this.amount = amount; } + public DeductionLine percentage(Float percentage) { + this.percentage = percentage; + return this; + } + + /** + * The Percentage of the Deduction + * @return percentage + **/ + @ApiModelProperty(example = "10.0", value = "The Percentage of the Deduction") + public Float getPercentage() { + return percentage; + } + + public void setPercentage(Float percentage) { + this.percentage = percentage; + } + + public DeductionLine numberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + return this; + } + + /** + * Deduction number of units + * @return numberOfUnits + **/ + @ApiModelProperty(example = "10.0", value = "Deduction number of units") + public Float getNumberOfUnits() { + return numberOfUnits; + } + + public void setNumberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + } + @Override public boolean equals(java.lang.Object o) { @@ -108,12 +152,14 @@ public boolean equals(java.lang.Object o) { DeductionLine deductionLine = (DeductionLine) o; return Objects.equals(this.deductionTypeID, deductionLine.deductionTypeID) && Objects.equals(this.calculationType, deductionLine.calculationType) && - Objects.equals(this.amount, deductionLine.amount); + Objects.equals(this.amount, deductionLine.amount) && + Objects.equals(this.percentage, deductionLine.percentage) && + Objects.equals(this.numberOfUnits, deductionLine.numberOfUnits); } @Override public int hashCode() { - return Objects.hash(deductionTypeID, calculationType, amount); + return Objects.hash(deductionTypeID, calculationType, amount, percentage, numberOfUnits); } @@ -124,6 +170,8 @@ public String toString() { sb.append(" deductionTypeID: ").append(toIndentedString(deductionTypeID)).append("\n"); sb.append(" calculationType: ").append(toIndentedString(calculationType)).append("\n"); sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/xero/models/payrollau/DeductionType.java b/src/main/java/com/xero/models/payrollau/DeductionType.java index 5ed68c70..2215d9e1 100644 --- a/src/main/java/com/xero/models/payrollau/DeductionType.java +++ b/src/main/java/com/xero/models/payrollau/DeductionType.java @@ -21,7 +21,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.UUID; -import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -54,9 +53,9 @@ public class DeductionType { @JsonProperty("DeductionTypeID") private UUID deductionTypeID; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC; + private String updatedDateUTC; public DeductionType name(String name) { this.name = name; @@ -166,24 +165,15 @@ public void setDeductionTypeID(UUID deductionTypeID) { this.deductionTypeID = deductionTypeID; } - public DeductionType updatedDateUTC(OffsetDateTime updatedDateUTC) { - this.updatedDateUTC = updatedDateUTC; - return this; - } - /** * Last modified timestamp * @return updatedDateUTC **/ - @ApiModelProperty(value = "Last modified timestamp") - public OffsetDateTime getUpdatedDateUTC() { + @ApiModelProperty(example = "2018-04-01T23:02:36", value = "Last modified timestamp") + public String getUpdatedDateUTC() { return updatedDateUTC; } - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { - this.updatedDateUTC = updatedDateUTC; - } - @Override public boolean equals(java.lang.Object o) { diff --git a/src/main/java/com/xero/models/payrollau/EarningsLine.java b/src/main/java/com/xero/models/payrollau/EarningsLine.java index 404cd2c4..900f5179 100644 --- a/src/main/java/com/xero/models/payrollau/EarningsLine.java +++ b/src/main/java/com/xero/models/payrollau/EarningsLine.java @@ -58,6 +58,14 @@ public class EarningsLine { @JsonProperty("Amount") private Float amount; + + @JsonProperty("NumberOfUnits") + private Float numberOfUnits; + + + @JsonProperty("FixedAmount") + private Float fixedAmount; + public EarningsLine earningsRateID(UUID earningsRateID) { this.earningsRateID = earningsRateID; return this; @@ -184,6 +192,42 @@ public void setAmount(Float amount) { this.amount = amount; } + public EarningsLine numberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + return this; + } + + /** + * Earnings rate number of units. + * @return numberOfUnits + **/ + @ApiModelProperty(example = "2.5", value = "Earnings rate number of units.") + public Float getNumberOfUnits() { + return numberOfUnits; + } + + public void setNumberOfUnits(Float numberOfUnits) { + this.numberOfUnits = numberOfUnits; + } + + public EarningsLine fixedAmount(Float fixedAmount) { + this.fixedAmount = fixedAmount; + return this; + } + + /** + * Earnings rate amount. Only applicable if the EarningsRate RateType is Fixed + * @return fixedAmount + **/ + @ApiModelProperty(example = "2.5", value = "Earnings rate amount. Only applicable if the EarningsRate RateType is Fixed") + public Float getFixedAmount() { + return fixedAmount; + } + + public void setFixedAmount(Float fixedAmount) { + this.fixedAmount = fixedAmount; + } + @Override public boolean equals(java.lang.Object o) { @@ -200,12 +244,14 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.numberOfUnitsPerWeek, earningsLine.numberOfUnitsPerWeek) && Objects.equals(this.ratePerUnit, earningsLine.ratePerUnit) && Objects.equals(this.normalNumberOfUnits, earningsLine.normalNumberOfUnits) && - Objects.equals(this.amount, earningsLine.amount); + Objects.equals(this.amount, earningsLine.amount) && + Objects.equals(this.numberOfUnits, earningsLine.numberOfUnits) && + Objects.equals(this.fixedAmount, earningsLine.fixedAmount); } @Override public int hashCode() { - return Objects.hash(earningsRateID, calculationType, annualSalary, numberOfUnitsPerWeek, ratePerUnit, normalNumberOfUnits, amount); + return Objects.hash(earningsRateID, calculationType, annualSalary, numberOfUnitsPerWeek, ratePerUnit, normalNumberOfUnits, amount, numberOfUnits, fixedAmount); } @@ -220,6 +266,8 @@ public String toString() { sb.append(" ratePerUnit: ").append(toIndentedString(ratePerUnit)).append("\n"); sb.append(" normalNumberOfUnits: ").append(toIndentedString(normalNumberOfUnits)).append("\n"); sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); + sb.append(" fixedAmount: ").append(toIndentedString(fixedAmount)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/xero/models/payrollau/EarningsRate.java b/src/main/java/com/xero/models/payrollau/EarningsRate.java index ab4f3600..4fe41516 100644 --- a/src/main/java/com/xero/models/payrollau/EarningsRate.java +++ b/src/main/java/com/xero/models/payrollau/EarningsRate.java @@ -24,7 +24,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.UUID; -import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -89,9 +88,9 @@ public class EarningsRate { @JsonProperty("EmploymentTerminationPaymentType") private EmploymentTerminationPaymentType employmentTerminationPaymentType; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC; + private String updatedDateUTC; public EarningsRate name(String name) { this.name = name; @@ -345,7 +344,7 @@ public void setEmploymentTerminationPaymentType(EmploymentTerminationPaymentType this.employmentTerminationPaymentType = employmentTerminationPaymentType; } - public EarningsRate updatedDateUTC(OffsetDateTime updatedDateUTC) { + public EarningsRate updatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; return this; } @@ -354,12 +353,12 @@ public EarningsRate updatedDateUTC(OffsetDateTime updatedDateUTC) { * Last modified timestamp * @return updatedDateUTC **/ - @ApiModelProperty(value = "Last modified timestamp") - public OffsetDateTime getUpdatedDateUTC() { + @ApiModelProperty(example = "2018-04-01T23:02:36", value = "Last modified timestamp") + public String getUpdatedDateUTC() { return updatedDateUTC; } - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + public void setUpdatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; } diff --git a/src/main/java/com/xero/models/payrollau/Employee.java b/src/main/java/com/xero/models/payrollau/Employee.java index db3937c3..55a39a09 100644 --- a/src/main/java/com/xero/models/payrollau/Employee.java +++ b/src/main/java/com/xero/models/payrollau/Employee.java @@ -30,8 +30,6 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -159,9 +157,9 @@ public static GenderEnum fromValue(String value) { @JsonProperty("EmployeeID") private UUID employeeID; - @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("TerminationDate") - private LocalDate terminationDate; + private String terminationDate; @JsonProperty("BankAccounts") @@ -187,9 +185,9 @@ public static GenderEnum fromValue(String value) { @JsonProperty("Status") private EmployeeStatus status; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC; + private String updatedDateUTC; public Employee firstName(String firstName) { this.firstName = firstName; @@ -551,7 +549,7 @@ public void setEmployeeID(UUID employeeID) { this.employeeID = employeeID; } - public Employee terminationDate(LocalDate terminationDate) { + public Employee terminationDate(String terminationDate) { this.terminationDate = terminationDate; return this; } @@ -560,12 +558,12 @@ public Employee terminationDate(LocalDate terminationDate) { * Employee Termination Date (YYYY-MM-DD) * @return terminationDate **/ - @ApiModelProperty(value = "Employee Termination Date (YYYY-MM-DD)") - public LocalDate getTerminationDate() { + @ApiModelProperty(example = "2019-01-01", value = "Employee Termination Date (YYYY-MM-DD)") + public String getTerminationDate() { return terminationDate; } - public void setTerminationDate(LocalDate terminationDate) { + public void setTerminationDate(String terminationDate) { this.terminationDate = terminationDate; } @@ -701,7 +699,7 @@ public void setStatus(EmployeeStatus status) { this.status = status; } - public Employee updatedDateUTC(OffsetDateTime updatedDateUTC) { + public Employee updatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; return this; } @@ -710,12 +708,12 @@ public Employee updatedDateUTC(OffsetDateTime updatedDateUTC) { * Last modified timestamp * @return updatedDateUTC **/ - @ApiModelProperty(value = "Last modified timestamp") - public OffsetDateTime getUpdatedDateUTC() { + @ApiModelProperty(example = "2018-04-01T23:02:36", value = "Last modified timestamp") + public String getUpdatedDateUTC() { return updatedDateUTC; } - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + public void setUpdatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; } diff --git a/src/main/java/com/xero/models/payrollau/PayslipLeaveAccrualLine.java b/src/main/java/com/xero/models/payrollau/LeaveAccrualLine.java similarity index 82% rename from src/main/java/com/xero/models/payrollau/PayslipLeaveAccrualLine.java rename to src/main/java/com/xero/models/payrollau/LeaveAccrualLine.java index 57f03f95..ccd6c27a 100644 --- a/src/main/java/com/xero/models/payrollau/PayslipLeaveAccrualLine.java +++ b/src/main/java/com/xero/models/payrollau/LeaveAccrualLine.java @@ -25,10 +25,10 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * PayslipLeaveAccrualLine + * LeaveAccrualLine */ -public class PayslipLeaveAccrualLine { +public class LeaveAccrualLine { @JsonProperty("LeaveTypeID") private UUID leaveTypeID; @@ -41,7 +41,7 @@ public class PayslipLeaveAccrualLine { @JsonProperty("AutoCalculate") private Boolean autoCalculate; - public PayslipLeaveAccrualLine leaveTypeID(UUID leaveTypeID) { + public LeaveAccrualLine leaveTypeID(UUID leaveTypeID) { this.leaveTypeID = leaveTypeID; return this; } @@ -59,7 +59,7 @@ public void setLeaveTypeID(UUID leaveTypeID) { this.leaveTypeID = leaveTypeID; } - public PayslipLeaveAccrualLine numberOfUnits(Float numberOfUnits) { + public LeaveAccrualLine numberOfUnits(Float numberOfUnits) { this.numberOfUnits = numberOfUnits; return this; } @@ -77,7 +77,7 @@ public void setNumberOfUnits(Float numberOfUnits) { this.numberOfUnits = numberOfUnits; } - public PayslipLeaveAccrualLine autoCalculate(Boolean autoCalculate) { + public LeaveAccrualLine autoCalculate(Boolean autoCalculate) { this.autoCalculate = autoCalculate; return this; } @@ -104,10 +104,10 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - PayslipLeaveAccrualLine payslipLeaveAccrualLine = (PayslipLeaveAccrualLine) o; - return Objects.equals(this.leaveTypeID, payslipLeaveAccrualLine.leaveTypeID) && - Objects.equals(this.numberOfUnits, payslipLeaveAccrualLine.numberOfUnits) && - Objects.equals(this.autoCalculate, payslipLeaveAccrualLine.autoCalculate); + LeaveAccrualLine leaveAccrualLine = (LeaveAccrualLine) o; + return Objects.equals(this.leaveTypeID, leaveAccrualLine.leaveTypeID) && + Objects.equals(this.numberOfUnits, leaveAccrualLine.numberOfUnits) && + Objects.equals(this.autoCalculate, leaveAccrualLine.autoCalculate); } @Override @@ -119,7 +119,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class PayslipLeaveAccrualLine {\n"); + sb.append("class LeaveAccrualLine {\n"); sb.append(" leaveTypeID: ").append(toIndentedString(leaveTypeID)).append("\n"); sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); sb.append(" autoCalculate: ").append(toIndentedString(autoCalculate)).append("\n"); diff --git a/src/main/java/com/xero/models/payrollau/PayslipLeaveEarningsLines.java b/src/main/java/com/xero/models/payrollau/LeaveEarningsLine.java similarity index 81% rename from src/main/java/com/xero/models/payrollau/PayslipLeaveEarningsLines.java rename to src/main/java/com/xero/models/payrollau/LeaveEarningsLine.java index fc949e42..336763b7 100644 --- a/src/main/java/com/xero/models/payrollau/PayslipLeaveEarningsLines.java +++ b/src/main/java/com/xero/models/payrollau/LeaveEarningsLine.java @@ -25,10 +25,10 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * PayslipLeaveEarningsLines + * LeaveEarningsLine */ -public class PayslipLeaveEarningsLines { +public class LeaveEarningsLine { @JsonProperty("EarningsRateID") private UUID earningsRateID; @@ -41,7 +41,7 @@ public class PayslipLeaveEarningsLines { @JsonProperty("NumberOfUnits") private Float numberOfUnits; - public PayslipLeaveEarningsLines earningsRateID(UUID earningsRateID) { + public LeaveEarningsLine earningsRateID(UUID earningsRateID) { this.earningsRateID = earningsRateID; return this; } @@ -59,7 +59,7 @@ public void setEarningsRateID(UUID earningsRateID) { this.earningsRateID = earningsRateID; } - public PayslipLeaveEarningsLines ratePerUnit(Float ratePerUnit) { + public LeaveEarningsLine ratePerUnit(Float ratePerUnit) { this.ratePerUnit = ratePerUnit; return this; } @@ -77,7 +77,7 @@ public void setRatePerUnit(Float ratePerUnit) { this.ratePerUnit = ratePerUnit; } - public PayslipLeaveEarningsLines numberOfUnits(Float numberOfUnits) { + public LeaveEarningsLine numberOfUnits(Float numberOfUnits) { this.numberOfUnits = numberOfUnits; return this; } @@ -104,10 +104,10 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - PayslipLeaveEarningsLines payslipLeaveEarningsLines = (PayslipLeaveEarningsLines) o; - return Objects.equals(this.earningsRateID, payslipLeaveEarningsLines.earningsRateID) && - Objects.equals(this.ratePerUnit, payslipLeaveEarningsLines.ratePerUnit) && - Objects.equals(this.numberOfUnits, payslipLeaveEarningsLines.numberOfUnits); + LeaveEarningsLine leaveEarningsLine = (LeaveEarningsLine) o; + return Objects.equals(this.earningsRateID, leaveEarningsLine.earningsRateID) && + Objects.equals(this.ratePerUnit, leaveEarningsLine.ratePerUnit) && + Objects.equals(this.numberOfUnits, leaveEarningsLine.numberOfUnits); } @Override @@ -119,7 +119,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class PayslipLeaveEarningsLines {\n"); + sb.append("class LeaveEarningsLine {\n"); sb.append(" earningsRateID: ").append(toIndentedString(earningsRateID)).append("\n"); sb.append(" ratePerUnit: ").append(toIndentedString(ratePerUnit)).append("\n"); sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); diff --git a/src/main/java/com/xero/models/payrollau/LeavePeriod.java b/src/main/java/com/xero/models/payrollau/LeavePeriod.java index cedcc53b..0895a2bc 100644 --- a/src/main/java/com/xero/models/payrollau/LeavePeriod.java +++ b/src/main/java/com/xero/models/payrollau/LeavePeriod.java @@ -21,7 +21,6 @@ import com.xero.models.payrollau.LeavePeriodStatus; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -34,13 +33,13 @@ public class LeavePeriod { @JsonProperty("NumberOfUnits") private Float numberOfUnits; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("PayPeriodEndDate") - private OffsetDateTime payPeriodEndDate; + private String payPeriodEndDate; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("PayPeriodStartDate") - private OffsetDateTime payPeriodStartDate; + private String payPeriodStartDate; @JsonProperty("LeavePeriodStatus") @@ -64,7 +63,7 @@ public void setNumberOfUnits(Float numberOfUnits) { this.numberOfUnits = numberOfUnits; } - public LeavePeriod payPeriodEndDate(OffsetDateTime payPeriodEndDate) { + public LeavePeriod payPeriodEndDate(String payPeriodEndDate) { this.payPeriodEndDate = payPeriodEndDate; return this; } @@ -73,16 +72,16 @@ public LeavePeriod payPeriodEndDate(OffsetDateTime payPeriodEndDate) { * The Pay Period End Date (YYYY-MM-DD) * @return payPeriodEndDate **/ - @ApiModelProperty(value = "The Pay Period End Date (YYYY-MM-DD)") - public OffsetDateTime getPayPeriodEndDate() { + @ApiModelProperty(example = "2013-05-12T00:00:00", value = "The Pay Period End Date (YYYY-MM-DD)") + public String getPayPeriodEndDate() { return payPeriodEndDate; } - public void setPayPeriodEndDate(OffsetDateTime payPeriodEndDate) { + public void setPayPeriodEndDate(String payPeriodEndDate) { this.payPeriodEndDate = payPeriodEndDate; } - public LeavePeriod payPeriodStartDate(OffsetDateTime payPeriodStartDate) { + public LeavePeriod payPeriodStartDate(String payPeriodStartDate) { this.payPeriodStartDate = payPeriodStartDate; return this; } @@ -91,12 +90,12 @@ public LeavePeriod payPeriodStartDate(OffsetDateTime payPeriodStartDate) { * The Pay Period Start Date (YYYY-MM-DD) * @return payPeriodStartDate **/ - @ApiModelProperty(value = "The Pay Period Start Date (YYYY-MM-DD)") - public OffsetDateTime getPayPeriodStartDate() { + @ApiModelProperty(example = "2013-04-29T00:00:00", value = "The Pay Period Start Date (YYYY-MM-DD)") + public String getPayPeriodStartDate() { return payPeriodStartDate; } - public void setPayPeriodStartDate(OffsetDateTime payPeriodStartDate) { + public void setPayPeriodStartDate(String payPeriodStartDate) { this.payPeriodStartDate = payPeriodStartDate; } diff --git a/src/main/java/com/xero/models/payrollau/LeaveType.java b/src/main/java/com/xero/models/payrollau/LeaveType.java index 65caf7d5..5aff414e 100644 --- a/src/main/java/com/xero/models/payrollau/LeaveType.java +++ b/src/main/java/com/xero/models/payrollau/LeaveType.java @@ -21,7 +21,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.UUID; -import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -58,9 +57,9 @@ public class LeaveType { @JsonProperty("LeaveLoadingRate") private Float leaveLoadingRate; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC; + private String updatedDateUTC; public LeaveType name(String name) { this.name = name; @@ -188,24 +187,15 @@ public void setLeaveLoadingRate(Float leaveLoadingRate) { this.leaveLoadingRate = leaveLoadingRate; } - public LeaveType updatedDateUTC(OffsetDateTime updatedDateUTC) { - this.updatedDateUTC = updatedDateUTC; - return this; - } - /** * Last modified timestamp * @return updatedDateUTC **/ - @ApiModelProperty(value = "Last modified timestamp") - public OffsetDateTime getUpdatedDateUTC() { + @ApiModelProperty(example = "2018-04-01T23:02:36", value = "Last modified timestamp") + public String getUpdatedDateUTC() { return updatedDateUTC; } - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { - this.updatedDateUTC = updatedDateUTC; - } - @Override public boolean equals(java.lang.Object o) { diff --git a/src/main/java/com/xero/models/payrollau/OpeningBalances.java b/src/main/java/com/xero/models/payrollau/OpeningBalances.java index 16e94cbf..77091c83 100644 --- a/src/main/java/com/xero/models/payrollau/OpeningBalances.java +++ b/src/main/java/com/xero/models/payrollau/OpeningBalances.java @@ -27,7 +27,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.LocalDate; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -36,9 +35,9 @@ */ public class OpeningBalances { - @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("OpeningBalanceDate") - private LocalDate openingBalanceDate; + private String openingBalanceDate; @JsonProperty("Tax") @@ -64,7 +63,7 @@ public class OpeningBalances { @JsonProperty("LeaveLines") private List leaveLines = new ArrayList(); - public OpeningBalances openingBalanceDate(LocalDate openingBalanceDate) { + public OpeningBalances openingBalanceDate(String openingBalanceDate) { this.openingBalanceDate = openingBalanceDate; return this; } @@ -74,11 +73,11 @@ public OpeningBalances openingBalanceDate(LocalDate openingBalanceDate) { * @return openingBalanceDate **/ @ApiModelProperty(value = "Opening Balance Date. (YYYY-MM-DD)") - public LocalDate getOpeningBalanceDate() { + public String getOpeningBalanceDate() { return openingBalanceDate; } - public void setOpeningBalanceDate(LocalDate openingBalanceDate) { + public void setOpeningBalanceDate(String openingBalanceDate) { this.openingBalanceDate = openingBalanceDate; } diff --git a/src/main/java/com/xero/models/payrollau/PayrollCalendar.java b/src/main/java/com/xero/models/payrollau/PayrollCalendar.java index 188184d9..a56a1c0f 100644 --- a/src/main/java/com/xero/models/payrollau/PayrollCalendar.java +++ b/src/main/java/com/xero/models/payrollau/PayrollCalendar.java @@ -22,7 +22,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.UUID; -import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -39,13 +38,13 @@ public class PayrollCalendar { @JsonProperty("CalendarType") private CalendarType calendarType; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("StartDate") - private OffsetDateTime startDate; + private String startDate; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("PaymentDate") - private OffsetDateTime paymentDate; + private String paymentDate; @JsonProperty("PayrollCalendarID") @@ -87,7 +86,7 @@ public void setCalendarType(CalendarType calendarType) { this.calendarType = calendarType; } - public PayrollCalendar startDate(OffsetDateTime startDate) { + public PayrollCalendar startDate(String startDate) { this.startDate = startDate; return this; } @@ -96,16 +95,16 @@ public PayrollCalendar startDate(OffsetDateTime startDate) { * The start date of the upcoming pay period. The end date will be calculated based upon this date, and the calendar type selected (YYYY-MM-DD) * @return startDate **/ - @ApiModelProperty(value = "The start date of the upcoming pay period. The end date will be calculated based upon this date, and the calendar type selected (YYYY-MM-DD)") - public OffsetDateTime getStartDate() { + @ApiModelProperty(example = "2012-08-17T00:00:00Z", value = "The start date of the upcoming pay period. The end date will be calculated based upon this date, and the calendar type selected (YYYY-MM-DD)") + public String getStartDate() { return startDate; } - public void setStartDate(OffsetDateTime startDate) { + public void setStartDate(String startDate) { this.startDate = startDate; } - public PayrollCalendar paymentDate(OffsetDateTime paymentDate) { + public PayrollCalendar paymentDate(String paymentDate) { this.paymentDate = paymentDate; return this; } @@ -114,12 +113,12 @@ public PayrollCalendar paymentDate(OffsetDateTime paymentDate) { * The date on which employees will be paid for the upcoming pay period (YYYY-MM-DD) * @return paymentDate **/ - @ApiModelProperty(value = "The date on which employees will be paid for the upcoming pay period (YYYY-MM-DD)") - public OffsetDateTime getPaymentDate() { + @ApiModelProperty(example = "2012-08-17T00:00:00Z", value = "The date on which employees will be paid for the upcoming pay period (YYYY-MM-DD)") + public String getPaymentDate() { return paymentDate; } - public void setPaymentDate(OffsetDateTime paymentDate) { + public void setPaymentDate(String paymentDate) { this.paymentDate = paymentDate; } diff --git a/src/main/java/com/xero/models/payrollau/Payrun.java b/src/main/java/com/xero/models/payrollau/Payrun.java index 4f4242db..faea0609 100644 --- a/src/main/java/com/xero/models/payrollau/Payrun.java +++ b/src/main/java/com/xero/models/payrollau/Payrun.java @@ -24,47 +24,46 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; +import java.util.UUID; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * Payrun + * PayRun */ -public class Payrun { +public class PayRun { @JsonProperty("PayrollCalendarID") - private Object payrollCalendarID = null; + private UUID payrollCalendarID; @JsonProperty("PayRunID") - private Object payRunID = null; + private UUID payRunID; - @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("PayRunPeriodStartDate") - private LocalDate payRunPeriodStartDate; + private String payRunPeriodStartDate; - @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("PayRunPeriodEndDate") - private LocalDate payRunPeriodEndDate; + private String payRunPeriodEndDate; @JsonProperty("PayRunStatus") private PayRunStatus payRunStatus; - @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("PaymentDate") - private LocalDate paymentDate; + private String paymentDate; @JsonProperty("PayslipMessage") private String payslipMessage; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC; + private String updatedDateUTC; @JsonProperty("Payslips") @@ -94,7 +93,7 @@ public class Payrun { @JsonProperty("NetPay") private Float netPay; - public Payrun payrollCalendarID(Object payrollCalendarID) { + public PayRun payrollCalendarID(UUID payrollCalendarID) { this.payrollCalendarID = payrollCalendarID; return this; } @@ -104,15 +103,15 @@ public Payrun payrollCalendarID(Object payrollCalendarID) { * @return payrollCalendarID **/ @ApiModelProperty(example = "bfac31bd-ea62-4fc8-a5e7-7965d9504b15", required = true, value = "Xero identifier for pay run") - public Object getPayrollCalendarID() { + public UUID getPayrollCalendarID() { return payrollCalendarID; } - public void setPayrollCalendarID(Object payrollCalendarID) { + public void setPayrollCalendarID(UUID payrollCalendarID) { this.payrollCalendarID = payrollCalendarID; } - public Payrun payRunID(Object payRunID) { + public PayRun payRunID(UUID payRunID) { this.payRunID = payRunID; return this; } @@ -122,15 +121,15 @@ public Payrun payRunID(Object payRunID) { * @return payRunID **/ @ApiModelProperty(example = "bba1d10f-63b1-4692-b5c5-a99f869523a4", value = "Xero identifier for pay run") - public Object getPayRunID() { + public UUID getPayRunID() { return payRunID; } - public void setPayRunID(Object payRunID) { + public void setPayRunID(UUID payRunID) { this.payRunID = payRunID; } - public Payrun payRunPeriodStartDate(LocalDate payRunPeriodStartDate) { + public PayRun payRunPeriodStartDate(String payRunPeriodStartDate) { this.payRunPeriodStartDate = payRunPeriodStartDate; return this; } @@ -139,16 +138,16 @@ public Payrun payRunPeriodStartDate(LocalDate payRunPeriodStartDate) { * Period Start Date for the PayRun (YYYY-MM-DD) * @return payRunPeriodStartDate **/ - @ApiModelProperty(value = "Period Start Date for the PayRun (YYYY-MM-DD)") - public LocalDate getPayRunPeriodStartDate() { + @ApiModelProperty(example = "2013-02-01T00:00:00Z", value = "Period Start Date for the PayRun (YYYY-MM-DD)") + public String getPayRunPeriodStartDate() { return payRunPeriodStartDate; } - public void setPayRunPeriodStartDate(LocalDate payRunPeriodStartDate) { + public void setPayRunPeriodStartDate(String payRunPeriodStartDate) { this.payRunPeriodStartDate = payRunPeriodStartDate; } - public Payrun payRunPeriodEndDate(LocalDate payRunPeriodEndDate) { + public PayRun payRunPeriodEndDate(String payRunPeriodEndDate) { this.payRunPeriodEndDate = payRunPeriodEndDate; return this; } @@ -157,16 +156,16 @@ public Payrun payRunPeriodEndDate(LocalDate payRunPeriodEndDate) { * Period End Date for the PayRun (YYYY-MM-DD) * @return payRunPeriodEndDate **/ - @ApiModelProperty(value = "Period End Date for the PayRun (YYYY-MM-DD)") - public LocalDate getPayRunPeriodEndDate() { + @ApiModelProperty(example = "2013-02-07T00:00:00Z", value = "Period End Date for the PayRun (YYYY-MM-DD)") + public String getPayRunPeriodEndDate() { return payRunPeriodEndDate; } - public void setPayRunPeriodEndDate(LocalDate payRunPeriodEndDate) { + public void setPayRunPeriodEndDate(String payRunPeriodEndDate) { this.payRunPeriodEndDate = payRunPeriodEndDate; } - public Payrun payRunStatus(PayRunStatus payRunStatus) { + public PayRun payRunStatus(PayRunStatus payRunStatus) { this.payRunStatus = payRunStatus; return this; } @@ -184,7 +183,7 @@ public void setPayRunStatus(PayRunStatus payRunStatus) { this.payRunStatus = payRunStatus; } - public Payrun paymentDate(LocalDate paymentDate) { + public PayRun paymentDate(String paymentDate) { this.paymentDate = paymentDate; return this; } @@ -193,16 +192,16 @@ public Payrun paymentDate(LocalDate paymentDate) { * Payment Date for the PayRun (YYYY-MM-DD) * @return paymentDate **/ - @ApiModelProperty(value = "Payment Date for the PayRun (YYYY-MM-DD)") - public LocalDate getPaymentDate() { + @ApiModelProperty(example = "2013-02-07T00:00:00Z", value = "Payment Date for the PayRun (YYYY-MM-DD)") + public String getPaymentDate() { return paymentDate; } - public void setPaymentDate(LocalDate paymentDate) { + public void setPaymentDate(String paymentDate) { this.paymentDate = paymentDate; } - public Payrun payslipMessage(String payslipMessage) { + public PayRun payslipMessage(String payslipMessage) { this.payslipMessage = payslipMessage; return this; } @@ -220,7 +219,7 @@ public void setPayslipMessage(String payslipMessage) { this.payslipMessage = payslipMessage; } - public Payrun updatedDateUTC(OffsetDateTime updatedDateUTC) { + public PayRun updatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; return this; } @@ -229,21 +228,21 @@ public Payrun updatedDateUTC(OffsetDateTime updatedDateUTC) { * Last modified timestamp * @return updatedDateUTC **/ - @ApiModelProperty(value = "Last modified timestamp") - public OffsetDateTime getUpdatedDateUTC() { + @ApiModelProperty(example = "2018-04-01T23:02:36", value = "Last modified timestamp") + public String getUpdatedDateUTC() { return updatedDateUTC; } - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + public void setUpdatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; } - public Payrun payslips(List payslips) { + public PayRun payslips(List payslips) { this.payslips = payslips; return this; } - public Payrun addPayslipsItem(PayslipSummary payslipsItem) { + public PayRun addPayslipsItem(PayslipSummary payslipsItem) { if (this.payslips == null) { this.payslips = new ArrayList(); } @@ -264,7 +263,7 @@ public void setPayslips(List payslips) { this.payslips = payslips; } - public Payrun wages(Float wages) { + public PayRun wages(Float wages) { this.wages = wages; return this; } @@ -282,7 +281,7 @@ public void setWages(Float wages) { this.wages = wages; } - public Payrun deductions(Float deductions) { + public PayRun deductions(Float deductions) { this.deductions = deductions; return this; } @@ -300,7 +299,7 @@ public void setDeductions(Float deductions) { this.deductions = deductions; } - public Payrun tax(Float tax) { + public PayRun tax(Float tax) { this.tax = tax; return this; } @@ -318,7 +317,7 @@ public void setTax(Float tax) { this.tax = tax; } - public Payrun _super(Float _super) { + public PayRun _super(Float _super) { this._super = _super; return this; } @@ -336,7 +335,7 @@ public void setSuper(Float _super) { this._super = _super; } - public Payrun reimbursements(Float reimbursements) { + public PayRun reimbursements(Float reimbursements) { this.reimbursements = reimbursements; return this; } @@ -354,7 +353,7 @@ public void setReimbursements(Float reimbursements) { this.reimbursements = reimbursements; } - public Payrun netPay(Float netPay) { + public PayRun netPay(Float netPay) { this.netPay = netPay; return this; } @@ -381,22 +380,22 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - Payrun payrun = (Payrun) o; - return Objects.equals(this.payrollCalendarID, payrun.payrollCalendarID) && - Objects.equals(this.payRunID, payrun.payRunID) && - Objects.equals(this.payRunPeriodStartDate, payrun.payRunPeriodStartDate) && - Objects.equals(this.payRunPeriodEndDate, payrun.payRunPeriodEndDate) && - Objects.equals(this.payRunStatus, payrun.payRunStatus) && - Objects.equals(this.paymentDate, payrun.paymentDate) && - Objects.equals(this.payslipMessage, payrun.payslipMessage) && - Objects.equals(this.updatedDateUTC, payrun.updatedDateUTC) && - Objects.equals(this.payslips, payrun.payslips) && - Objects.equals(this.wages, payrun.wages) && - Objects.equals(this.deductions, payrun.deductions) && - Objects.equals(this.tax, payrun.tax) && - Objects.equals(this._super, payrun._super) && - Objects.equals(this.reimbursements, payrun.reimbursements) && - Objects.equals(this.netPay, payrun.netPay); + PayRun payRun = (PayRun) o; + return Objects.equals(this.payrollCalendarID, payRun.payrollCalendarID) && + Objects.equals(this.payRunID, payRun.payRunID) && + Objects.equals(this.payRunPeriodStartDate, payRun.payRunPeriodStartDate) && + Objects.equals(this.payRunPeriodEndDate, payRun.payRunPeriodEndDate) && + Objects.equals(this.payRunStatus, payRun.payRunStatus) && + Objects.equals(this.paymentDate, payRun.paymentDate) && + Objects.equals(this.payslipMessage, payRun.payslipMessage) && + Objects.equals(this.updatedDateUTC, payRun.updatedDateUTC) && + Objects.equals(this.payslips, payRun.payslips) && + Objects.equals(this.wages, payRun.wages) && + Objects.equals(this.deductions, payRun.deductions) && + Objects.equals(this.tax, payRun.tax) && + Objects.equals(this._super, payRun._super) && + Objects.equals(this.reimbursements, payRun.reimbursements) && + Objects.equals(this.netPay, payRun.netPay); } @Override @@ -408,7 +407,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Payrun {\n"); + sb.append("class PayRun {\n"); sb.append(" payrollCalendarID: ").append(toIndentedString(payrollCalendarID)).append("\n"); sb.append(" payRunID: ").append(toIndentedString(payRunID)).append("\n"); sb.append(" payRunPeriodStartDate: ").append(toIndentedString(payRunPeriodStartDate)).append("\n"); diff --git a/src/main/java/com/xero/models/payrollau/Payruns.java b/src/main/java/com/xero/models/payrollau/Payruns.java index bb3e1d59..d25e2719 100644 --- a/src/main/java/com/xero/models/payrollau/Payruns.java +++ b/src/main/java/com/xero/models/payrollau/Payruns.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.payrollau.Payrun; +import com.xero.models.payrollau.PayRun; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; @@ -27,38 +27,38 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * Payruns + * PayRuns */ -public class Payruns { +public class PayRuns { - @JsonProperty("Payruns") - private List payruns = new ArrayList(); + @JsonProperty("PayRuns") + private List payRuns = new ArrayList(); - public Payruns payruns(List payruns) { - this.payruns = payruns; + public PayRuns payRuns(List payRuns) { + this.payRuns = payRuns; return this; } - public Payruns addPayrunsItem(Payrun payrunsItem) { - if (this.payruns == null) { - this.payruns = new ArrayList(); + public PayRuns addPayRunsItem(PayRun payRunsItem) { + if (this.payRuns == null) { + this.payRuns = new ArrayList(); } - this.payruns.add(payrunsItem); + this.payRuns.add(payRunsItem); return this; } /** - * Get payruns - * @return payruns + * Get payRuns + * @return payRuns **/ @ApiModelProperty(value = "") - public List getPayruns() { - return payruns; + public List getPayRuns() { + return payRuns; } - public void setPayruns(List payruns) { - this.payruns = payruns; + public void setPayRuns(List payRuns) { + this.payRuns = payRuns; } @@ -70,21 +70,21 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - Payruns payruns = (Payruns) o; - return Objects.equals(this.payruns, payruns.payruns); + PayRuns payRuns = (PayRuns) o; + return Objects.equals(this.payRuns, payRuns.payRuns); } @Override public int hashCode() { - return Objects.hash(payruns); + return Objects.hash(payRuns); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Payruns {\n"); - sb.append(" payruns: ").append(toIndentedString(payruns)).append("\n"); + sb.append("class PayRuns {\n"); + sb.append(" payRuns: ").append(toIndentedString(payRuns)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/xero/models/payrollau/Payslip.java b/src/main/java/com/xero/models/payrollau/Payslip.java index f4c77633..9aedfb4e 100644 --- a/src/main/java/com/xero/models/payrollau/Payslip.java +++ b/src/main/java/com/xero/models/payrollau/Payslip.java @@ -18,18 +18,17 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.payrollau.PayslipDeductionLine; -import com.xero.models.payrollau.PayslipEarningsLines; -import com.xero.models.payrollau.PayslipLeaveAccrualLine; -import com.xero.models.payrollau.PayslipLeaveEarningsLines; -import com.xero.models.payrollau.PayslipReimbursementLine; -import com.xero.models.payrollau.PayslipSuperannuationLine; -import com.xero.models.payrollau.PayslipTaxLine; +import com.xero.models.payrollau.DeductionLine; +import com.xero.models.payrollau.EarningsLine; +import com.xero.models.payrollau.LeaveAccrualLine; +import com.xero.models.payrollau.LeaveEarningsLine; +import com.xero.models.payrollau.ReimbursementLine; +import com.xero.models.payrollau.SuperannuationLine; +import com.xero.models.payrollau.TaxLine; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -80,39 +79,39 @@ public class Payslip { @JsonProperty("EarningsLines") - private List earningsLines = new ArrayList(); + private List earningsLines = new ArrayList(); @JsonProperty("LeaveEarningsLines") - private List leaveEarningsLines = new ArrayList(); + private List leaveEarningsLines = new ArrayList(); @JsonProperty("TimesheetEarningsLines") - private List timesheetEarningsLines = new ArrayList(); + private List timesheetEarningsLines = new ArrayList(); - @JsonProperty("DeductionLine") - private List deductionLine = new ArrayList(); + @JsonProperty("DeductionLines") + private List deductionLines = new ArrayList(); - @JsonProperty("LeaveAccrualLine") - private List leaveAccrualLine = new ArrayList(); + @JsonProperty("LeaveAccrualLines") + private List leaveAccrualLines = new ArrayList(); - @JsonProperty("ReimbursementLine") - private List reimbursementLine = new ArrayList(); + @JsonProperty("ReimbursementLines") + private List reimbursementLines = new ArrayList(); - @JsonProperty("SuperannuationLine") - private List superannuationLine = new ArrayList(); + @JsonProperty("SuperannuationLines") + private List superannuationLines = new ArrayList(); - @JsonProperty("TaxLine") - private List taxLine = new ArrayList(); + @JsonProperty("TaxLines") + private List taxLines = new ArrayList(); - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC; + private String updatedDateUTC; public Payslip employeeID(Object employeeID) { this.employeeID = employeeID; @@ -294,14 +293,14 @@ public void setNetPay(Float netPay) { this.netPay = netPay; } - public Payslip earningsLines(List earningsLines) { + public Payslip earningsLines(List earningsLines) { this.earningsLines = earningsLines; return this; } - public Payslip addEarningsLinesItem(PayslipEarningsLines earningsLinesItem) { + public Payslip addEarningsLinesItem(EarningsLine earningsLinesItem) { if (this.earningsLines == null) { - this.earningsLines = new ArrayList(); + this.earningsLines = new ArrayList(); } this.earningsLines.add(earningsLinesItem); return this; @@ -312,22 +311,22 @@ public Payslip addEarningsLinesItem(PayslipEarningsLines earningsLinesItem) { * @return earningsLines **/ @ApiModelProperty(value = "") - public List getEarningsLines() { + public List getEarningsLines() { return earningsLines; } - public void setEarningsLines(List earningsLines) { + public void setEarningsLines(List earningsLines) { this.earningsLines = earningsLines; } - public Payslip leaveEarningsLines(List leaveEarningsLines) { + public Payslip leaveEarningsLines(List leaveEarningsLines) { this.leaveEarningsLines = leaveEarningsLines; return this; } - public Payslip addLeaveEarningsLinesItem(PayslipLeaveEarningsLines leaveEarningsLinesItem) { + public Payslip addLeaveEarningsLinesItem(LeaveEarningsLine leaveEarningsLinesItem) { if (this.leaveEarningsLines == null) { - this.leaveEarningsLines = new ArrayList(); + this.leaveEarningsLines = new ArrayList(); } this.leaveEarningsLines.add(leaveEarningsLinesItem); return this; @@ -338,22 +337,22 @@ public Payslip addLeaveEarningsLinesItem(PayslipLeaveEarningsLines leaveEarnings * @return leaveEarningsLines **/ @ApiModelProperty(value = "") - public List getLeaveEarningsLines() { + public List getLeaveEarningsLines() { return leaveEarningsLines; } - public void setLeaveEarningsLines(List leaveEarningsLines) { + public void setLeaveEarningsLines(List leaveEarningsLines) { this.leaveEarningsLines = leaveEarningsLines; } - public Payslip timesheetEarningsLines(List timesheetEarningsLines) { + public Payslip timesheetEarningsLines(List timesheetEarningsLines) { this.timesheetEarningsLines = timesheetEarningsLines; return this; } - public Payslip addTimesheetEarningsLinesItem(PayslipLeaveEarningsLines timesheetEarningsLinesItem) { + public Payslip addTimesheetEarningsLinesItem(EarningsLine timesheetEarningsLinesItem) { if (this.timesheetEarningsLines == null) { - this.timesheetEarningsLines = new ArrayList(); + this.timesheetEarningsLines = new ArrayList(); } this.timesheetEarningsLines.add(timesheetEarningsLinesItem); return this; @@ -364,145 +363,145 @@ public Payslip addTimesheetEarningsLinesItem(PayslipLeaveEarningsLines timesheet * @return timesheetEarningsLines **/ @ApiModelProperty(value = "") - public List getTimesheetEarningsLines() { + public List getTimesheetEarningsLines() { return timesheetEarningsLines; } - public void setTimesheetEarningsLines(List timesheetEarningsLines) { + public void setTimesheetEarningsLines(List timesheetEarningsLines) { this.timesheetEarningsLines = timesheetEarningsLines; } - public Payslip deductionLine(List deductionLine) { - this.deductionLine = deductionLine; + public Payslip deductionLines(List deductionLines) { + this.deductionLines = deductionLines; return this; } - public Payslip addDeductionLineItem(PayslipDeductionLine deductionLineItem) { - if (this.deductionLine == null) { - this.deductionLine = new ArrayList(); + public Payslip addDeductionLinesItem(DeductionLine deductionLinesItem) { + if (this.deductionLines == null) { + this.deductionLines = new ArrayList(); } - this.deductionLine.add(deductionLineItem); + this.deductionLines.add(deductionLinesItem); return this; } /** - * Get deductionLine - * @return deductionLine + * Get deductionLines + * @return deductionLines **/ @ApiModelProperty(value = "") - public List getDeductionLine() { - return deductionLine; + public List getDeductionLines() { + return deductionLines; } - public void setDeductionLine(List deductionLine) { - this.deductionLine = deductionLine; + public void setDeductionLines(List deductionLines) { + this.deductionLines = deductionLines; } - public Payslip leaveAccrualLine(List leaveAccrualLine) { - this.leaveAccrualLine = leaveAccrualLine; + public Payslip leaveAccrualLines(List leaveAccrualLines) { + this.leaveAccrualLines = leaveAccrualLines; return this; } - public Payslip addLeaveAccrualLineItem(PayslipLeaveAccrualLine leaveAccrualLineItem) { - if (this.leaveAccrualLine == null) { - this.leaveAccrualLine = new ArrayList(); + public Payslip addLeaveAccrualLinesItem(LeaveAccrualLine leaveAccrualLinesItem) { + if (this.leaveAccrualLines == null) { + this.leaveAccrualLines = new ArrayList(); } - this.leaveAccrualLine.add(leaveAccrualLineItem); + this.leaveAccrualLines.add(leaveAccrualLinesItem); return this; } /** - * Get leaveAccrualLine - * @return leaveAccrualLine + * Get leaveAccrualLines + * @return leaveAccrualLines **/ @ApiModelProperty(value = "") - public List getLeaveAccrualLine() { - return leaveAccrualLine; + public List getLeaveAccrualLines() { + return leaveAccrualLines; } - public void setLeaveAccrualLine(List leaveAccrualLine) { - this.leaveAccrualLine = leaveAccrualLine; + public void setLeaveAccrualLines(List leaveAccrualLines) { + this.leaveAccrualLines = leaveAccrualLines; } - public Payslip reimbursementLine(List reimbursementLine) { - this.reimbursementLine = reimbursementLine; + public Payslip reimbursementLines(List reimbursementLines) { + this.reimbursementLines = reimbursementLines; return this; } - public Payslip addReimbursementLineItem(PayslipReimbursementLine reimbursementLineItem) { - if (this.reimbursementLine == null) { - this.reimbursementLine = new ArrayList(); + public Payslip addReimbursementLinesItem(ReimbursementLine reimbursementLinesItem) { + if (this.reimbursementLines == null) { + this.reimbursementLines = new ArrayList(); } - this.reimbursementLine.add(reimbursementLineItem); + this.reimbursementLines.add(reimbursementLinesItem); return this; } /** - * Get reimbursementLine - * @return reimbursementLine + * Get reimbursementLines + * @return reimbursementLines **/ @ApiModelProperty(value = "") - public List getReimbursementLine() { - return reimbursementLine; + public List getReimbursementLines() { + return reimbursementLines; } - public void setReimbursementLine(List reimbursementLine) { - this.reimbursementLine = reimbursementLine; + public void setReimbursementLines(List reimbursementLines) { + this.reimbursementLines = reimbursementLines; } - public Payslip superannuationLine(List superannuationLine) { - this.superannuationLine = superannuationLine; + public Payslip superannuationLines(List superannuationLines) { + this.superannuationLines = superannuationLines; return this; } - public Payslip addSuperannuationLineItem(PayslipSuperannuationLine superannuationLineItem) { - if (this.superannuationLine == null) { - this.superannuationLine = new ArrayList(); + public Payslip addSuperannuationLinesItem(SuperannuationLine superannuationLinesItem) { + if (this.superannuationLines == null) { + this.superannuationLines = new ArrayList(); } - this.superannuationLine.add(superannuationLineItem); + this.superannuationLines.add(superannuationLinesItem); return this; } /** - * Get superannuationLine - * @return superannuationLine + * Get superannuationLines + * @return superannuationLines **/ @ApiModelProperty(value = "") - public List getSuperannuationLine() { - return superannuationLine; + public List getSuperannuationLines() { + return superannuationLines; } - public void setSuperannuationLine(List superannuationLine) { - this.superannuationLine = superannuationLine; + public void setSuperannuationLines(List superannuationLines) { + this.superannuationLines = superannuationLines; } - public Payslip taxLine(List taxLine) { - this.taxLine = taxLine; + public Payslip taxLines(List taxLines) { + this.taxLines = taxLines; return this; } - public Payslip addTaxLineItem(PayslipTaxLine taxLineItem) { - if (this.taxLine == null) { - this.taxLine = new ArrayList(); + public Payslip addTaxLinesItem(TaxLine taxLinesItem) { + if (this.taxLines == null) { + this.taxLines = new ArrayList(); } - this.taxLine.add(taxLineItem); + this.taxLines.add(taxLinesItem); return this; } /** - * Get taxLine - * @return taxLine + * Get taxLines + * @return taxLines **/ @ApiModelProperty(value = "") - public List getTaxLine() { - return taxLine; + public List getTaxLines() { + return taxLines; } - public void setTaxLine(List taxLine) { - this.taxLine = taxLine; + public void setTaxLines(List taxLines) { + this.taxLines = taxLines; } - public Payslip updatedDateUTC(OffsetDateTime updatedDateUTC) { + public Payslip updatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; return this; } @@ -511,12 +510,12 @@ public Payslip updatedDateUTC(OffsetDateTime updatedDateUTC) { * Last modified timestamp * @return updatedDateUTC **/ - @ApiModelProperty(value = "Last modified timestamp") - public OffsetDateTime getUpdatedDateUTC() { + @ApiModelProperty(example = "2018-04-01T23:02:36", value = "Last modified timestamp") + public String getUpdatedDateUTC() { return updatedDateUTC; } - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + public void setUpdatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; } @@ -543,17 +542,17 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.earningsLines, payslip.earningsLines) && Objects.equals(this.leaveEarningsLines, payslip.leaveEarningsLines) && Objects.equals(this.timesheetEarningsLines, payslip.timesheetEarningsLines) && - Objects.equals(this.deductionLine, payslip.deductionLine) && - Objects.equals(this.leaveAccrualLine, payslip.leaveAccrualLine) && - Objects.equals(this.reimbursementLine, payslip.reimbursementLine) && - Objects.equals(this.superannuationLine, payslip.superannuationLine) && - Objects.equals(this.taxLine, payslip.taxLine) && + Objects.equals(this.deductionLines, payslip.deductionLines) && + Objects.equals(this.leaveAccrualLines, payslip.leaveAccrualLines) && + Objects.equals(this.reimbursementLines, payslip.reimbursementLines) && + Objects.equals(this.superannuationLines, payslip.superannuationLines) && + Objects.equals(this.taxLines, payslip.taxLines) && Objects.equals(this.updatedDateUTC, payslip.updatedDateUTC); } @Override public int hashCode() { - return Objects.hash(employeeID, payslipID, firstName, lastName, wages, deductions, tax, _super, reimbursements, netPay, earningsLines, leaveEarningsLines, timesheetEarningsLines, deductionLine, leaveAccrualLine, reimbursementLine, superannuationLine, taxLine, updatedDateUTC); + return Objects.hash(employeeID, payslipID, firstName, lastName, wages, deductions, tax, _super, reimbursements, netPay, earningsLines, leaveEarningsLines, timesheetEarningsLines, deductionLines, leaveAccrualLines, reimbursementLines, superannuationLines, taxLines, updatedDateUTC); } @@ -574,11 +573,11 @@ public String toString() { sb.append(" earningsLines: ").append(toIndentedString(earningsLines)).append("\n"); sb.append(" leaveEarningsLines: ").append(toIndentedString(leaveEarningsLines)).append("\n"); sb.append(" timesheetEarningsLines: ").append(toIndentedString(timesheetEarningsLines)).append("\n"); - sb.append(" deductionLine: ").append(toIndentedString(deductionLine)).append("\n"); - sb.append(" leaveAccrualLine: ").append(toIndentedString(leaveAccrualLine)).append("\n"); - sb.append(" reimbursementLine: ").append(toIndentedString(reimbursementLine)).append("\n"); - sb.append(" superannuationLine: ").append(toIndentedString(superannuationLine)).append("\n"); - sb.append(" taxLine: ").append(toIndentedString(taxLine)).append("\n"); + sb.append(" deductionLines: ").append(toIndentedString(deductionLines)).append("\n"); + sb.append(" leaveAccrualLines: ").append(toIndentedString(leaveAccrualLines)).append("\n"); + sb.append(" reimbursementLines: ").append(toIndentedString(reimbursementLines)).append("\n"); + sb.append(" superannuationLines: ").append(toIndentedString(superannuationLines)).append("\n"); + sb.append(" taxLines: ").append(toIndentedString(taxLines)).append("\n"); sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/xero/models/payrollau/PayslipDeductionLine.java b/src/main/java/com/xero/models/payrollau/PayslipDeductionLine.java deleted file mode 100644 index 3b8f18c6..00000000 --- a/src/main/java/com/xero/models/payrollau/PayslipDeductionLine.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Xero Payroll AU - * This is the Xero Payroll API for orgs in Australia region. - * - * The version of the OpenAPI document: 1.0.0 - * Contact: api@xero.com - * - * 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.models.payrollau; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.payrollau.DeductionTypeCalculationType; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.UUID; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * PayslipDeductionLine - */ - -public class PayslipDeductionLine { - - @JsonProperty("DeductionTypeID") - private UUID deductionTypeID; - - - @JsonProperty("CalculationType") - private DeductionTypeCalculationType calculationType; - - - @JsonProperty("Percentage") - private Float percentage; - - - @JsonProperty("NumberOfUnits") - private Float numberOfUnits; - - public PayslipDeductionLine deductionTypeID(UUID deductionTypeID) { - this.deductionTypeID = deductionTypeID; - return this; - } - - /** - * Xero identifier for the deduction type - * @return deductionTypeID - **/ - @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier for the deduction type") - public UUID getDeductionTypeID() { - return deductionTypeID; - } - - public void setDeductionTypeID(UUID deductionTypeID) { - this.deductionTypeID = deductionTypeID; - } - - public PayslipDeductionLine calculationType(DeductionTypeCalculationType calculationType) { - this.calculationType = calculationType; - return this; - } - - /** - * Get calculationType - * @return calculationType - **/ - @ApiModelProperty(value = "") - public DeductionTypeCalculationType getCalculationType() { - return calculationType; - } - - public void setCalculationType(DeductionTypeCalculationType calculationType) { - this.calculationType = calculationType; - } - - public PayslipDeductionLine percentage(Float percentage) { - this.percentage = percentage; - return this; - } - - /** - * The Percentage of the Deduction. - * @return percentage - **/ - @ApiModelProperty(example = "2.5", value = "The Percentage of the Deduction.") - public Float getPercentage() { - return percentage; - } - - public void setPercentage(Float percentage) { - this.percentage = percentage; - } - - public PayslipDeductionLine numberOfUnits(Float numberOfUnits) { - this.numberOfUnits = numberOfUnits; - return this; - } - - /** - * Deduction number of units - * @return numberOfUnits - **/ - @ApiModelProperty(example = "105.5", value = "Deduction number of units") - public Float getNumberOfUnits() { - return numberOfUnits; - } - - public void setNumberOfUnits(Float numberOfUnits) { - this.numberOfUnits = numberOfUnits; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PayslipDeductionLine payslipDeductionLine = (PayslipDeductionLine) o; - return Objects.equals(this.deductionTypeID, payslipDeductionLine.deductionTypeID) && - Objects.equals(this.calculationType, payslipDeductionLine.calculationType) && - Objects.equals(this.percentage, payslipDeductionLine.percentage) && - Objects.equals(this.numberOfUnits, payslipDeductionLine.numberOfUnits); - } - - @Override - public int hashCode() { - return Objects.hash(deductionTypeID, calculationType, percentage, numberOfUnits); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class PayslipDeductionLine {\n"); - sb.append(" deductionTypeID: ").append(toIndentedString(deductionTypeID)).append("\n"); - sb.append(" calculationType: ").append(toIndentedString(calculationType)).append("\n"); - sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); - sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/payrollau/PayslipEarningsLines.java b/src/main/java/com/xero/models/payrollau/PayslipEarningsLines.java deleted file mode 100644 index 79b06f50..00000000 --- a/src/main/java/com/xero/models/payrollau/PayslipEarningsLines.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Xero Payroll AU - * This is the Xero Payroll API for orgs in Australia region. - * - * The version of the OpenAPI document: 1.0.0 - * Contact: api@xero.com - * - * 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.models.payrollau; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.UUID; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * PayslipEarningsLines - */ - -public class PayslipEarningsLines { - - @JsonProperty("EarningsRateID") - private UUID earningsRateID; - - - @JsonProperty("RatePerUnit") - private Float ratePerUnit; - - - @JsonProperty("NumberOfUnits") - private Float numberOfUnits; - - - @JsonProperty("FixedAmount") - private Float fixedAmount; - - public PayslipEarningsLines earningsRateID(UUID earningsRateID) { - this.earningsRateID = earningsRateID; - return this; - } - - /** - * Xero identifier - * @return earningsRateID - **/ - @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier") - public UUID getEarningsRateID() { - return earningsRateID; - } - - public void setEarningsRateID(UUID earningsRateID) { - this.earningsRateID = earningsRateID; - } - - public PayslipEarningsLines ratePerUnit(Float ratePerUnit) { - this.ratePerUnit = ratePerUnit; - return this; - } - - /** - * Rate per unit of the EarningsLine. - * @return ratePerUnit - **/ - @ApiModelProperty(example = "38.0", value = "Rate per unit of the EarningsLine.") - public Float getRatePerUnit() { - return ratePerUnit; - } - - public void setRatePerUnit(Float ratePerUnit) { - this.ratePerUnit = ratePerUnit; - } - - public PayslipEarningsLines numberOfUnits(Float numberOfUnits) { - this.numberOfUnits = numberOfUnits; - return this; - } - - /** - * Earnings rate number of units. - * @return numberOfUnits - **/ - @ApiModelProperty(example = "2.5", value = "Earnings rate number of units.") - public Float getNumberOfUnits() { - return numberOfUnits; - } - - public void setNumberOfUnits(Float numberOfUnits) { - this.numberOfUnits = numberOfUnits; - } - - public PayslipEarningsLines fixedAmount(Float fixedAmount) { - this.fixedAmount = fixedAmount; - return this; - } - - /** - * Earnings rate amount. Only applicable if the EarningsRate RateType is Fixed - * @return fixedAmount - **/ - @ApiModelProperty(example = "2.5", value = "Earnings rate amount. Only applicable if the EarningsRate RateType is Fixed") - public Float getFixedAmount() { - return fixedAmount; - } - - public void setFixedAmount(Float fixedAmount) { - this.fixedAmount = fixedAmount; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PayslipEarningsLines payslipEarningsLines = (PayslipEarningsLines) o; - return Objects.equals(this.earningsRateID, payslipEarningsLines.earningsRateID) && - Objects.equals(this.ratePerUnit, payslipEarningsLines.ratePerUnit) && - Objects.equals(this.numberOfUnits, payslipEarningsLines.numberOfUnits) && - Objects.equals(this.fixedAmount, payslipEarningsLines.fixedAmount); - } - - @Override - public int hashCode() { - return Objects.hash(earningsRateID, ratePerUnit, numberOfUnits, fixedAmount); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class PayslipEarningsLines {\n"); - sb.append(" earningsRateID: ").append(toIndentedString(earningsRateID)).append("\n"); - sb.append(" ratePerUnit: ").append(toIndentedString(ratePerUnit)).append("\n"); - sb.append(" numberOfUnits: ").append(toIndentedString(numberOfUnits)).append("\n"); - sb.append(" fixedAmount: ").append(toIndentedString(fixedAmount)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/payrollau/PayslipObject.java b/src/main/java/com/xero/models/payrollau/PayslipObject.java new file mode 100644 index 00000000..e28ff00f --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/PayslipObject.java @@ -0,0 +1,94 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.Payslip; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * PayslipObject + */ + +public class PayslipObject { + + @JsonProperty("Payslip") + private Payslip payslip = null; + + public PayslipObject payslip(Payslip payslip) { + this.payslip = payslip; + return this; + } + + /** + * Get payslip + * @return payslip + **/ + @ApiModelProperty(value = "") + public Payslip getPayslip() { + return payslip; + } + + public void setPayslip(Payslip payslip) { + this.payslip = payslip; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayslipObject payslipObject = (PayslipObject) o; + return Objects.equals(this.payslip, payslipObject.payslip); + } + + @Override + public int hashCode() { + return Objects.hash(payslip); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayslipObject {\n"); + sb.append(" payslip: ").append(toIndentedString(payslip)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayslipReimbursementLine.java b/src/main/java/com/xero/models/payrollau/PayslipReimbursementLine.java deleted file mode 100644 index 574ac6e8..00000000 --- a/src/main/java/com/xero/models/payrollau/PayslipReimbursementLine.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Xero Payroll AU - * This is the Xero Payroll API for orgs in Australia region. - * - * The version of the OpenAPI document: 1.0.0 - * Contact: api@xero.com - * - * 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.models.payrollau; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.UUID; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * PayslipReimbursementLine - */ - -public class PayslipReimbursementLine { - - @JsonProperty("ReimbursementTypeID") - private UUID reimbursementTypeID; - - - @JsonProperty("Description") - private String description; - - - @JsonProperty("ExpenseAccount") - private String expenseAccount; - - - @JsonProperty("Amount") - private Float amount; - - public PayslipReimbursementLine reimbursementTypeID(UUID reimbursementTypeID) { - this.reimbursementTypeID = reimbursementTypeID; - return this; - } - - /** - * Xero identifier for payroll reimbursement type. - * @return reimbursementTypeID - **/ - @ApiModelProperty(example = "e0eb6747-7c17-4075-b804-989f8d4e5d39", value = "Xero identifier for payroll reimbursement type.") - public UUID getReimbursementTypeID() { - return reimbursementTypeID; - } - - public void setReimbursementTypeID(UUID reimbursementTypeID) { - this.reimbursementTypeID = reimbursementTypeID; - } - - public PayslipReimbursementLine description(String description) { - this.description = description; - return this; - } - - /** - * Reimbursement lines description (max length 50) - * @return description - **/ - @ApiModelProperty(example = "For the taxi", value = "Reimbursement lines description (max length 50)") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public PayslipReimbursementLine expenseAccount(String expenseAccount) { - this.expenseAccount = expenseAccount; - return this; - } - - /** - * Reimbursement expense account. For posted pay run you should be able to see expense account code. - * @return expenseAccount - **/ - @ApiModelProperty(example = "420", value = "Reimbursement expense account. For posted pay run you should be able to see expense account code.") - public String getExpenseAccount() { - return expenseAccount; - } - - public void setExpenseAccount(String expenseAccount) { - this.expenseAccount = expenseAccount; - } - - public PayslipReimbursementLine amount(Float amount) { - this.amount = amount; - return this; - } - - /** - * Reimbursement amount - * @return amount - **/ - @ApiModelProperty(example = "10.5", value = "Reimbursement amount") - public Float getAmount() { - return amount; - } - - public void setAmount(Float amount) { - this.amount = amount; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PayslipReimbursementLine payslipReimbursementLine = (PayslipReimbursementLine) o; - return Objects.equals(this.reimbursementTypeID, payslipReimbursementLine.reimbursementTypeID) && - Objects.equals(this.description, payslipReimbursementLine.description) && - Objects.equals(this.expenseAccount, payslipReimbursementLine.expenseAccount) && - Objects.equals(this.amount, payslipReimbursementLine.amount); - } - - @Override - public int hashCode() { - return Objects.hash(reimbursementTypeID, description, expenseAccount, amount); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class PayslipReimbursementLine {\n"); - sb.append(" reimbursementTypeID: ").append(toIndentedString(reimbursementTypeID)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" expenseAccount: ").append(toIndentedString(expenseAccount)).append("\n"); - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/xero/models/payrollau/PayslipSummary.java b/src/main/java/com/xero/models/payrollau/PayslipSummary.java index d0e39ecd..72396b6c 100644 --- a/src/main/java/com/xero/models/payrollau/PayslipSummary.java +++ b/src/main/java/com/xero/models/payrollau/PayslipSummary.java @@ -20,7 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.threeten.bp.OffsetDateTime; +import java.util.UUID; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -35,7 +35,7 @@ public class PayslipSummary { @JsonProperty("PayslipID") - private Object payslipID = null; + private UUID payslipID; @JsonProperty("FirstName") @@ -69,9 +69,9 @@ public class PayslipSummary { @JsonProperty("NetPay") private Float netPay; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC; + private String updatedDateUTC; public PayslipSummary employeeID(Object employeeID) { this.employeeID = employeeID; @@ -91,7 +91,7 @@ public void setEmployeeID(Object employeeID) { this.employeeID = employeeID; } - public PayslipSummary payslipID(Object payslipID) { + public PayslipSummary payslipID(UUID payslipID) { this.payslipID = payslipID; return this; } @@ -101,11 +101,11 @@ public PayslipSummary payslipID(Object payslipID) { * @return payslipID **/ @ApiModelProperty(example = "f3c0874d-7cdd-459a-a95c-d90d51decc42", value = "Xero identifier for the payslip") - public Object getPayslipID() { + public UUID getPayslipID() { return payslipID; } - public void setPayslipID(Object payslipID) { + public void setPayslipID(UUID payslipID) { this.payslipID = payslipID; } @@ -253,7 +253,7 @@ public void setNetPay(Float netPay) { this.netPay = netPay; } - public PayslipSummary updatedDateUTC(OffsetDateTime updatedDateUTC) { + public PayslipSummary updatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; return this; } @@ -262,12 +262,12 @@ public PayslipSummary updatedDateUTC(OffsetDateTime updatedDateUTC) { * Last modified timestamp * @return updatedDateUTC **/ - @ApiModelProperty(value = "Last modified timestamp") - public OffsetDateTime getUpdatedDateUTC() { + @ApiModelProperty(example = "2018-04-01T23:02:36", value = "Last modified timestamp") + public String getUpdatedDateUTC() { return updatedDateUTC; } - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + public void setUpdatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; } diff --git a/src/main/java/com/xero/models/payrollau/ReimbursementLine.java b/src/main/java/com/xero/models/payrollau/ReimbursementLine.java index 8e1f8547..f2b283be 100644 --- a/src/main/java/com/xero/models/payrollau/ReimbursementLine.java +++ b/src/main/java/com/xero/models/payrollau/ReimbursementLine.java @@ -37,6 +37,14 @@ public class ReimbursementLine { @JsonProperty("Amount") private Float amount; + + @JsonProperty("Description") + private String description; + + + @JsonProperty("ExpenseAccount") + private String expenseAccount; + public ReimbursementLine reimbursementTypeID(UUID reimbursementTypeID) { this.reimbursementTypeID = reimbursementTypeID; return this; @@ -73,6 +81,42 @@ public void setAmount(Float amount) { this.amount = amount; } + public ReimbursementLine description(String description) { + this.description = description; + return this; + } + + /** + * Reimbursement lines description (max length 50) + * @return description + **/ + @ApiModelProperty(example = "For the taxi", value = "Reimbursement lines description (max length 50)") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ReimbursementLine expenseAccount(String expenseAccount) { + this.expenseAccount = expenseAccount; + return this; + } + + /** + * Reimbursement expense account. For posted pay run you should be able to see expense account code. + * @return expenseAccount + **/ + @ApiModelProperty(example = "420", value = "Reimbursement expense account. For posted pay run you should be able to see expense account code.") + public String getExpenseAccount() { + return expenseAccount; + } + + public void setExpenseAccount(String expenseAccount) { + this.expenseAccount = expenseAccount; + } + @Override public boolean equals(java.lang.Object o) { @@ -84,12 +128,14 @@ public boolean equals(java.lang.Object o) { } ReimbursementLine reimbursementLine = (ReimbursementLine) o; return Objects.equals(this.reimbursementTypeID, reimbursementLine.reimbursementTypeID) && - Objects.equals(this.amount, reimbursementLine.amount); + Objects.equals(this.amount, reimbursementLine.amount) && + Objects.equals(this.description, reimbursementLine.description) && + Objects.equals(this.expenseAccount, reimbursementLine.expenseAccount); } @Override public int hashCode() { - return Objects.hash(reimbursementTypeID, amount); + return Objects.hash(reimbursementTypeID, amount, description, expenseAccount); } @@ -99,6 +145,8 @@ public String toString() { sb.append("class ReimbursementLine {\n"); sb.append(" reimbursementTypeID: ").append(toIndentedString(reimbursementTypeID)).append("\n"); sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" expenseAccount: ").append(toIndentedString(expenseAccount)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/xero/models/payrollau/ReimbursementLines.java b/src/main/java/com/xero/models/payrollau/ReimbursementLines.java index 5a535b12..661e032a 100644 --- a/src/main/java/com/xero/models/payrollau/ReimbursementLines.java +++ b/src/main/java/com/xero/models/payrollau/ReimbursementLines.java @@ -33,33 +33,33 @@ public class ReimbursementLines { - @JsonProperty("Employee") - private List employee = new ArrayList(); + @JsonProperty("ReimbursementLines") + private List reimbursementLines = new ArrayList(); - public ReimbursementLines employee(List employee) { - this.employee = employee; + public ReimbursementLines reimbursementLines(List reimbursementLines) { + this.reimbursementLines = reimbursementLines; return this; } - public ReimbursementLines addEmployeeItem(ReimbursementLine employeeItem) { - if (this.employee == null) { - this.employee = new ArrayList(); + public ReimbursementLines addReimbursementLinesItem(ReimbursementLine reimbursementLinesItem) { + if (this.reimbursementLines == null) { + this.reimbursementLines = new ArrayList(); } - this.employee.add(employeeItem); + this.reimbursementLines.add(reimbursementLinesItem); return this; } /** - * Get employee - * @return employee + * Get reimbursementLines + * @return reimbursementLines **/ @ApiModelProperty(value = "") - public List getEmployee() { - return employee; + public List getReimbursementLines() { + return reimbursementLines; } - public void setEmployee(List employee) { - this.employee = employee; + public void setReimbursementLines(List reimbursementLines) { + this.reimbursementLines = reimbursementLines; } @@ -72,12 +72,12 @@ public boolean equals(java.lang.Object o) { return false; } ReimbursementLines reimbursementLines = (ReimbursementLines) o; - return Objects.equals(this.employee, reimbursementLines.employee); + return Objects.equals(this.reimbursementLines, reimbursementLines.reimbursementLines); } @Override public int hashCode() { - return Objects.hash(employee); + return Objects.hash(reimbursementLines); } @@ -85,7 +85,7 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ReimbursementLines {\n"); - sb.append(" employee: ").append(toIndentedString(employee)).append("\n"); + sb.append(" reimbursementLines: ").append(toIndentedString(reimbursementLines)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/xero/models/payrollau/ReimbursementType.java b/src/main/java/com/xero/models/payrollau/ReimbursementType.java index 0eedb84f..66913f29 100644 --- a/src/main/java/com/xero/models/payrollau/ReimbursementType.java +++ b/src/main/java/com/xero/models/payrollau/ReimbursementType.java @@ -21,7 +21,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.UUID; -import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -42,9 +41,9 @@ public class ReimbursementType { @JsonProperty("ReimbursementTypeID") private UUID reimbursementTypeID; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC; + private String updatedDateUTC; public ReimbursementType name(String name) { this.name = name; @@ -100,7 +99,7 @@ public void setReimbursementTypeID(UUID reimbursementTypeID) { this.reimbursementTypeID = reimbursementTypeID; } - public ReimbursementType updatedDateUTC(OffsetDateTime updatedDateUTC) { + public ReimbursementType updatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; return this; } @@ -109,12 +108,12 @@ public ReimbursementType updatedDateUTC(OffsetDateTime updatedDateUTC) { * Last modified timestamp * @return updatedDateUTC **/ - @ApiModelProperty(value = "Last modified timestamp") - public OffsetDateTime getUpdatedDateUTC() { + @ApiModelProperty(example = "2018-04-01T23:02:36", value = "Last modified timestamp") + public String getUpdatedDateUTC() { return updatedDateUTC; } - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + public void setUpdatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; } diff --git a/src/main/java/com/xero/models/payrollau/SettingsObject.java b/src/main/java/com/xero/models/payrollau/SettingsObject.java new file mode 100644 index 00000000..747d917e --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/SettingsObject.java @@ -0,0 +1,94 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.Settings; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * SettingsObject + */ + +public class SettingsObject { + + @JsonProperty("Settings") + private Settings settings = null; + + public SettingsObject settings(Settings settings) { + this.settings = settings; + return this; + } + + /** + * Get settings + * @return settings + **/ + @ApiModelProperty(value = "") + public Settings getSettings() { + return settings; + } + + public void setSettings(Settings settings) { + this.settings = settings; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettingsObject settingsObject = (SettingsObject) o; + return Objects.equals(this.settings, settingsObject.settings); + } + + @Override + public int hashCode() { + return Objects.hash(settings); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettingsObject {\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/PayslipSuperannuationLine.java b/src/main/java/com/xero/models/payrollau/SuperannuationLine.java similarity index 75% rename from src/main/java/com/xero/models/payrollau/PayslipSuperannuationLine.java rename to src/main/java/com/xero/models/payrollau/SuperannuationLine.java index 20281787..6fda49db 100644 --- a/src/main/java/com/xero/models/payrollau/PayslipSuperannuationLine.java +++ b/src/main/java/com/xero/models/payrollau/SuperannuationLine.java @@ -23,15 +23,14 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.UUID; -import org.threeten.bp.LocalDate; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * PayslipSuperannuationLine + * SuperannuationLine */ -public class PayslipSuperannuationLine { +public class SuperannuationLine { @JsonProperty("SuperMembershipID") private UUID superMembershipID; @@ -56,9 +55,9 @@ public class PayslipSuperannuationLine { @JsonProperty("LiabilityAccountCode") private String liabilityAccountCode; - @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("PaymentDateForThisPeriod") - private LocalDate paymentDateForThisPeriod; + private String paymentDateForThisPeriod; @JsonProperty("Percentage") @@ -68,7 +67,7 @@ public class PayslipSuperannuationLine { @JsonProperty("Amount") private Float amount; - public PayslipSuperannuationLine superMembershipID(UUID superMembershipID) { + public SuperannuationLine superMembershipID(UUID superMembershipID) { this.superMembershipID = superMembershipID; return this; } @@ -86,7 +85,7 @@ public void setSuperMembershipID(UUID superMembershipID) { this.superMembershipID = superMembershipID; } - public PayslipSuperannuationLine contributionType(SuperannuationContributionType contributionType) { + public SuperannuationLine contributionType(SuperannuationContributionType contributionType) { this.contributionType = contributionType; return this; } @@ -104,7 +103,7 @@ public void setContributionType(SuperannuationContributionType contributionType) this.contributionType = contributionType; } - public PayslipSuperannuationLine calculationType(SuperannuationCalculationType calculationType) { + public SuperannuationLine calculationType(SuperannuationCalculationType calculationType) { this.calculationType = calculationType; return this; } @@ -122,7 +121,7 @@ public void setCalculationType(SuperannuationCalculationType calculationType) { this.calculationType = calculationType; } - public PayslipSuperannuationLine minimumMonthlyEarnings(Float minimumMonthlyEarnings) { + public SuperannuationLine minimumMonthlyEarnings(Float minimumMonthlyEarnings) { this.minimumMonthlyEarnings = minimumMonthlyEarnings; return this; } @@ -140,7 +139,7 @@ public void setMinimumMonthlyEarnings(Float minimumMonthlyEarnings) { this.minimumMonthlyEarnings = minimumMonthlyEarnings; } - public PayslipSuperannuationLine expenseAccountCode(String expenseAccountCode) { + public SuperannuationLine expenseAccountCode(String expenseAccountCode) { this.expenseAccountCode = expenseAccountCode; return this; } @@ -158,7 +157,7 @@ public void setExpenseAccountCode(String expenseAccountCode) { this.expenseAccountCode = expenseAccountCode; } - public PayslipSuperannuationLine liabilityAccountCode(String liabilityAccountCode) { + public SuperannuationLine liabilityAccountCode(String liabilityAccountCode) { this.liabilityAccountCode = liabilityAccountCode; return this; } @@ -176,7 +175,7 @@ public void setLiabilityAccountCode(String liabilityAccountCode) { this.liabilityAccountCode = liabilityAccountCode; } - public PayslipSuperannuationLine paymentDateForThisPeriod(LocalDate paymentDateForThisPeriod) { + public SuperannuationLine paymentDateForThisPeriod(String paymentDateForThisPeriod) { this.paymentDateForThisPeriod = paymentDateForThisPeriod; return this; } @@ -185,16 +184,16 @@ public PayslipSuperannuationLine paymentDateForThisPeriod(LocalDate paymentDateF * Superannuation payment date for the current period (YYYY-MM-DD) * @return paymentDateForThisPeriod **/ - @ApiModelProperty(value = "Superannuation payment date for the current period (YYYY-MM-DD)") - public LocalDate getPaymentDateForThisPeriod() { + @ApiModelProperty(example = "2019-10-01", value = "Superannuation payment date for the current period (YYYY-MM-DD)") + public String getPaymentDateForThisPeriod() { return paymentDateForThisPeriod; } - public void setPaymentDateForThisPeriod(LocalDate paymentDateForThisPeriod) { + public void setPaymentDateForThisPeriod(String paymentDateForThisPeriod) { this.paymentDateForThisPeriod = paymentDateForThisPeriod; } - public PayslipSuperannuationLine percentage(Float percentage) { + public SuperannuationLine percentage(Float percentage) { this.percentage = percentage; return this; } @@ -212,7 +211,7 @@ public void setPercentage(Float percentage) { this.percentage = percentage; } - public PayslipSuperannuationLine amount(Float amount) { + public SuperannuationLine amount(Float amount) { this.amount = amount; return this; } @@ -239,16 +238,16 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - PayslipSuperannuationLine payslipSuperannuationLine = (PayslipSuperannuationLine) o; - return Objects.equals(this.superMembershipID, payslipSuperannuationLine.superMembershipID) && - Objects.equals(this.contributionType, payslipSuperannuationLine.contributionType) && - Objects.equals(this.calculationType, payslipSuperannuationLine.calculationType) && - Objects.equals(this.minimumMonthlyEarnings, payslipSuperannuationLine.minimumMonthlyEarnings) && - Objects.equals(this.expenseAccountCode, payslipSuperannuationLine.expenseAccountCode) && - Objects.equals(this.liabilityAccountCode, payslipSuperannuationLine.liabilityAccountCode) && - Objects.equals(this.paymentDateForThisPeriod, payslipSuperannuationLine.paymentDateForThisPeriod) && - Objects.equals(this.percentage, payslipSuperannuationLine.percentage) && - Objects.equals(this.amount, payslipSuperannuationLine.amount); + SuperannuationLine superannuationLine = (SuperannuationLine) o; + return Objects.equals(this.superMembershipID, superannuationLine.superMembershipID) && + Objects.equals(this.contributionType, superannuationLine.contributionType) && + Objects.equals(this.calculationType, superannuationLine.calculationType) && + Objects.equals(this.minimumMonthlyEarnings, superannuationLine.minimumMonthlyEarnings) && + Objects.equals(this.expenseAccountCode, superannuationLine.expenseAccountCode) && + Objects.equals(this.liabilityAccountCode, superannuationLine.liabilityAccountCode) && + Objects.equals(this.paymentDateForThisPeriod, superannuationLine.paymentDateForThisPeriod) && + Objects.equals(this.percentage, superannuationLine.percentage) && + Objects.equals(this.amount, superannuationLine.amount); } @Override @@ -260,7 +259,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class PayslipSuperannuationLine {\n"); + sb.append("class SuperannuationLine {\n"); sb.append(" superMembershipID: ").append(toIndentedString(superMembershipID)).append("\n"); sb.append(" contributionType: ").append(toIndentedString(contributionType)).append("\n"); sb.append(" calculationType: ").append(toIndentedString(calculationType)).append("\n"); diff --git a/src/main/java/com/xero/models/payrollau/Superfund.java b/src/main/java/com/xero/models/payrollau/Superfund.java index a183c800..87b818f9 100644 --- a/src/main/java/com/xero/models/payrollau/Superfund.java +++ b/src/main/java/com/xero/models/payrollau/Superfund.java @@ -21,17 +21,18 @@ import com.xero.models.payrollau.SuperFundType; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * Superfund + * SuperFund */ -public class Superfund { +public class SuperFund { @JsonProperty("SuperFundID") - private Object superFundID = null; + private UUID superFundID; @JsonProperty("Type") @@ -54,8 +55,8 @@ public class Superfund { private String accountNumber; - @JsonProperty("AccountNme") - private String accountNme; + @JsonProperty("AccountName") + private String accountName; @JsonProperty("ElectronicServiceAddress") @@ -73,7 +74,7 @@ public class Superfund { @JsonProperty("USI") private String USI; - public Superfund superFundID(Object superFundID) { + public SuperFund superFundID(UUID superFundID) { this.superFundID = superFundID; return this; } @@ -83,15 +84,15 @@ public Superfund superFundID(Object superFundID) { * @return superFundID **/ @ApiModelProperty(example = "bfac31bd-ea62-4fc8-a5e7-7965d9504b15", value = "Xero identifier for a super fund") - public Object getSuperFundID() { + public UUID getSuperFundID() { return superFundID; } - public void setSuperFundID(Object superFundID) { + public void setSuperFundID(UUID superFundID) { this.superFundID = superFundID; } - public Superfund type(SuperFundType type) { + public SuperFund type(SuperFundType type) { this.type = type; return this; } @@ -109,7 +110,7 @@ public void setType(SuperFundType type) { this.type = type; } - public Superfund name(String name) { + public SuperFund name(String name) { this.name = name; return this; } @@ -127,7 +128,7 @@ public void setName(String name) { this.name = name; } - public Superfund ABN(String ABN) { + public SuperFund ABN(String ABN) { this.ABN = ABN; return this; } @@ -145,7 +146,7 @@ public void setABN(String ABN) { this.ABN = ABN; } - public Superfund BSB(String BSB) { + public SuperFund BSB(String BSB) { this.BSB = BSB; return this; } @@ -163,7 +164,7 @@ public void setBSB(String BSB) { this.BSB = BSB; } - public Superfund accountNumber(String accountNumber) { + public SuperFund accountNumber(String accountNumber) { this.accountNumber = accountNumber; return this; } @@ -181,25 +182,25 @@ public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } - public Superfund accountNme(String accountNme) { - this.accountNme = accountNme; + public SuperFund accountName(String accountName) { + this.accountName = accountName; return this; } /** * The account name for the self managed super fund. - * @return accountNme + * @return accountName **/ @ApiModelProperty(example = "Money account", value = "The account name for the self managed super fund.") - public String getAccountNme() { - return accountNme; + public String getAccountName() { + return accountName; } - public void setAccountNme(String accountNme) { - this.accountNme = accountNme; + public void setAccountName(String accountName) { + this.accountName = accountName; } - public Superfund electronicServiceAddress(String electronicServiceAddress) { + public SuperFund electronicServiceAddress(String electronicServiceAddress) { this.electronicServiceAddress = electronicServiceAddress; return this; } @@ -217,7 +218,7 @@ public void setElectronicServiceAddress(String electronicServiceAddress) { this.electronicServiceAddress = electronicServiceAddress; } - public Superfund employerNumber(String employerNumber) { + public SuperFund employerNumber(String employerNumber) { this.employerNumber = employerNumber; return this; } @@ -235,7 +236,7 @@ public void setEmployerNumber(String employerNumber) { this.employerNumber = employerNumber; } - public Superfund SPIN(String SPIN) { + public SuperFund SPIN(String SPIN) { this.SPIN = SPIN; return this; } @@ -253,7 +254,7 @@ public void setSPIN(String SPIN) { this.SPIN = SPIN; } - public Superfund USI(String USI) { + public SuperFund USI(String USI) { this.USI = USI; return this; } @@ -280,37 +281,37 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - Superfund superfund = (Superfund) o; - return Objects.equals(this.superFundID, superfund.superFundID) && - Objects.equals(this.type, superfund.type) && - Objects.equals(this.name, superfund.name) && - Objects.equals(this.ABN, superfund.ABN) && - Objects.equals(this.BSB, superfund.BSB) && - Objects.equals(this.accountNumber, superfund.accountNumber) && - Objects.equals(this.accountNme, superfund.accountNme) && - Objects.equals(this.electronicServiceAddress, superfund.electronicServiceAddress) && - Objects.equals(this.employerNumber, superfund.employerNumber) && - Objects.equals(this.SPIN, superfund.SPIN) && - Objects.equals(this.USI, superfund.USI); + SuperFund superFund = (SuperFund) o; + return Objects.equals(this.superFundID, superFund.superFundID) && + Objects.equals(this.type, superFund.type) && + Objects.equals(this.name, superFund.name) && + Objects.equals(this.ABN, superFund.ABN) && + Objects.equals(this.BSB, superFund.BSB) && + Objects.equals(this.accountNumber, superFund.accountNumber) && + Objects.equals(this.accountName, superFund.accountName) && + Objects.equals(this.electronicServiceAddress, superFund.electronicServiceAddress) && + Objects.equals(this.employerNumber, superFund.employerNumber) && + Objects.equals(this.SPIN, superFund.SPIN) && + Objects.equals(this.USI, superFund.USI); } @Override public int hashCode() { - return Objects.hash(superFundID, type, name, ABN, BSB, accountNumber, accountNme, electronicServiceAddress, employerNumber, SPIN, USI); + return Objects.hash(superFundID, type, name, ABN, BSB, accountNumber, accountName, electronicServiceAddress, employerNumber, SPIN, USI); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Superfund {\n"); + sb.append("class SuperFund {\n"); sb.append(" superFundID: ").append(toIndentedString(superFundID)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" ABN: ").append(toIndentedString(ABN)).append("\n"); sb.append(" BSB: ").append(toIndentedString(BSB)).append("\n"); sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); - sb.append(" accountNme: ").append(toIndentedString(accountNme)).append("\n"); + sb.append(" accountName: ").append(toIndentedString(accountName)).append("\n"); sb.append(" electronicServiceAddress: ").append(toIndentedString(electronicServiceAddress)).append("\n"); sb.append(" employerNumber: ").append(toIndentedString(employerNumber)).append("\n"); sb.append(" SPIN: ").append(toIndentedString(SPIN)).append("\n"); diff --git a/src/main/java/com/xero/models/payrollau/SuperfundProduct.java b/src/main/java/com/xero/models/payrollau/SuperfundProduct.java index c3132c75..eb3c878a 100644 --- a/src/main/java/com/xero/models/payrollau/SuperfundProduct.java +++ b/src/main/java/com/xero/models/payrollau/SuperfundProduct.java @@ -24,10 +24,10 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * SuperfundProduct + * SuperFundProduct */ -public class SuperfundProduct { +public class SuperFundProduct { @JsonProperty("ABN") private Object ABN = null; @@ -44,7 +44,7 @@ public class SuperfundProduct { @JsonProperty("ProductName") private Object productName = null; - public SuperfundProduct ABN(Object ABN) { + public SuperFundProduct ABN(Object ABN) { this.ABN = ABN; return this; } @@ -62,7 +62,7 @@ public void setABN(Object ABN) { this.ABN = ABN; } - public SuperfundProduct USI(Object USI) { + public SuperFundProduct USI(Object USI) { this.USI = USI; return this; } @@ -80,7 +80,7 @@ public void setUSI(Object USI) { this.USI = USI; } - public SuperfundProduct SPIN(Object SPIN) { + public SuperFundProduct SPIN(Object SPIN) { this.SPIN = SPIN; return this; } @@ -98,7 +98,7 @@ public void setSPIN(Object SPIN) { this.SPIN = SPIN; } - public SuperfundProduct productName(Object productName) { + public SuperFundProduct productName(Object productName) { this.productName = productName; return this; } @@ -125,11 +125,11 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - SuperfundProduct superfundProduct = (SuperfundProduct) o; - return Objects.equals(this.ABN, superfundProduct.ABN) && - Objects.equals(this.USI, superfundProduct.USI) && - Objects.equals(this.SPIN, superfundProduct.SPIN) && - Objects.equals(this.productName, superfundProduct.productName); + SuperFundProduct superFundProduct = (SuperFundProduct) o; + return Objects.equals(this.ABN, superFundProduct.ABN) && + Objects.equals(this.USI, superFundProduct.USI) && + Objects.equals(this.SPIN, superFundProduct.SPIN) && + Objects.equals(this.productName, superFundProduct.productName); } @Override @@ -141,7 +141,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class SuperfundProduct {\n"); + sb.append("class SuperFundProduct {\n"); sb.append(" ABN: ").append(toIndentedString(ABN)).append("\n"); sb.append(" USI: ").append(toIndentedString(USI)).append("\n"); sb.append(" SPIN: ").append(toIndentedString(SPIN)).append("\n"); diff --git a/src/main/java/com/xero/models/payrollau/SuperfundProducts.java b/src/main/java/com/xero/models/payrollau/SuperfundProducts.java index ec6b6b81..e1a327d7 100644 --- a/src/main/java/com/xero/models/payrollau/SuperfundProducts.java +++ b/src/main/java/com/xero/models/payrollau/SuperfundProducts.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.payrollau.SuperfundProduct; +import com.xero.models.payrollau.SuperFundProduct; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; @@ -27,38 +27,38 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * SuperfundProducts + * SuperFundProducts */ -public class SuperfundProducts { +public class SuperFundProducts { - @JsonProperty("SuperfundProducts") - private List superfundProducts = new ArrayList(); + @JsonProperty("SuperFundProducts") + private List superFundProducts = new ArrayList(); - public SuperfundProducts superfundProducts(List superfundProducts) { - this.superfundProducts = superfundProducts; + public SuperFundProducts superFundProducts(List superFundProducts) { + this.superFundProducts = superFundProducts; return this; } - public SuperfundProducts addSuperfundProductsItem(SuperfundProduct superfundProductsItem) { - if (this.superfundProducts == null) { - this.superfundProducts = new ArrayList(); + public SuperFundProducts addSuperFundProductsItem(SuperFundProduct superFundProductsItem) { + if (this.superFundProducts == null) { + this.superFundProducts = new ArrayList(); } - this.superfundProducts.add(superfundProductsItem); + this.superFundProducts.add(superFundProductsItem); return this; } /** - * Get superfundProducts - * @return superfundProducts + * Get superFundProducts + * @return superFundProducts **/ @ApiModelProperty(value = "") - public List getSuperfundProducts() { - return superfundProducts; + public List getSuperFundProducts() { + return superFundProducts; } - public void setSuperfundProducts(List superfundProducts) { - this.superfundProducts = superfundProducts; + public void setSuperFundProducts(List superFundProducts) { + this.superFundProducts = superFundProducts; } @@ -70,21 +70,21 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - SuperfundProducts superfundProducts = (SuperfundProducts) o; - return Objects.equals(this.superfundProducts, superfundProducts.superfundProducts); + SuperFundProducts superFundProducts = (SuperFundProducts) o; + return Objects.equals(this.superFundProducts, superFundProducts.superFundProducts); } @Override public int hashCode() { - return Objects.hash(superfundProducts); + return Objects.hash(superFundProducts); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class SuperfundProducts {\n"); - sb.append(" superfundProducts: ").append(toIndentedString(superfundProducts)).append("\n"); + sb.append("class SuperFundProducts {\n"); + sb.append(" superFundProducts: ").append(toIndentedString(superFundProducts)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/xero/models/payrollau/Superfunds.java b/src/main/java/com/xero/models/payrollau/Superfunds.java index ebef1ee0..b33bbc7e 100644 --- a/src/main/java/com/xero/models/payrollau/Superfunds.java +++ b/src/main/java/com/xero/models/payrollau/Superfunds.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import com.xero.models.payrollau.Superfund; +import com.xero.models.payrollau.SuperFund; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; @@ -27,38 +27,38 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * Superfunds + * SuperFunds */ -public class Superfunds { +public class SuperFunds { - @JsonProperty("Superfunds") - private List superfunds = new ArrayList(); + @JsonProperty("SuperFunds") + private List superFunds = new ArrayList(); - public Superfunds superfunds(List superfunds) { - this.superfunds = superfunds; + public SuperFunds superFunds(List superFunds) { + this.superFunds = superFunds; return this; } - public Superfunds addSuperfundsItem(Superfund superfundsItem) { - if (this.superfunds == null) { - this.superfunds = new ArrayList(); + public SuperFunds addSuperFundsItem(SuperFund superFundsItem) { + if (this.superFunds == null) { + this.superFunds = new ArrayList(); } - this.superfunds.add(superfundsItem); + this.superFunds.add(superFundsItem); return this; } /** - * Get superfunds - * @return superfunds + * Get superFunds + * @return superFunds **/ @ApiModelProperty(value = "") - public List getSuperfunds() { - return superfunds; + public List getSuperFunds() { + return superFunds; } - public void setSuperfunds(List superfunds) { - this.superfunds = superfunds; + public void setSuperFunds(List superFunds) { + this.superFunds = superFunds; } @@ -70,21 +70,21 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - Superfunds superfunds = (Superfunds) o; - return Objects.equals(this.superfunds, superfunds.superfunds); + SuperFunds superFunds = (SuperFunds) o; + return Objects.equals(this.superFunds, superFunds.superFunds); } @Override public int hashCode() { - return Objects.hash(superfunds); + return Objects.hash(superFunds); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Superfunds {\n"); - sb.append(" superfunds: ").append(toIndentedString(superfunds)).append("\n"); + sb.append("class SuperFunds {\n"); + sb.append(" superFunds: ").append(toIndentedString(superFunds)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/xero/models/payrollau/PayslipTaxLine.java b/src/main/java/com/xero/models/payrollau/TaxLine.java similarity index 83% rename from src/main/java/com/xero/models/payrollau/PayslipTaxLine.java rename to src/main/java/com/xero/models/payrollau/TaxLine.java index 5bdd3c9b..9fdcb46c 100644 --- a/src/main/java/com/xero/models/payrollau/PayslipTaxLine.java +++ b/src/main/java/com/xero/models/payrollau/TaxLine.java @@ -25,10 +25,10 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** - * PayslipTaxLine + * TaxLine */ -public class PayslipTaxLine { +public class TaxLine { @JsonProperty("Amount") private Float amount; @@ -49,7 +49,7 @@ public class PayslipTaxLine { @JsonProperty("LiabilityAccount") private String liabilityAccount; - public PayslipTaxLine amount(Float amount) { + public TaxLine amount(Float amount) { this.amount = amount; return this; } @@ -67,7 +67,7 @@ public void setAmount(Float amount) { this.amount = amount; } - public PayslipTaxLine taxTypeName(String taxTypeName) { + public TaxLine taxTypeName(String taxTypeName) { this.taxTypeName = taxTypeName; return this; } @@ -85,7 +85,7 @@ public void setTaxTypeName(String taxTypeName) { this.taxTypeName = taxTypeName; } - public PayslipTaxLine description(String description) { + public TaxLine description(String description) { this.description = description; return this; } @@ -103,7 +103,7 @@ public void setDescription(String description) { this.description = description; } - public PayslipTaxLine manualTaxType(ManualTaxType manualTaxType) { + public TaxLine manualTaxType(ManualTaxType manualTaxType) { this.manualTaxType = manualTaxType; return this; } @@ -121,7 +121,7 @@ public void setManualTaxType(ManualTaxType manualTaxType) { this.manualTaxType = manualTaxType; } - public PayslipTaxLine liabilityAccount(String liabilityAccount) { + public TaxLine liabilityAccount(String liabilityAccount) { this.liabilityAccount = liabilityAccount; return this; } @@ -148,12 +148,12 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - PayslipTaxLine payslipTaxLine = (PayslipTaxLine) o; - return Objects.equals(this.amount, payslipTaxLine.amount) && - Objects.equals(this.taxTypeName, payslipTaxLine.taxTypeName) && - Objects.equals(this.description, payslipTaxLine.description) && - Objects.equals(this.manualTaxType, payslipTaxLine.manualTaxType) && - Objects.equals(this.liabilityAccount, payslipTaxLine.liabilityAccount); + TaxLine taxLine = (TaxLine) o; + return Objects.equals(this.amount, taxLine.amount) && + Objects.equals(this.taxTypeName, taxLine.taxTypeName) && + Objects.equals(this.description, taxLine.description) && + Objects.equals(this.manualTaxType, taxLine.manualTaxType) && + Objects.equals(this.liabilityAccount, taxLine.liabilityAccount); } @Override @@ -165,7 +165,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class PayslipTaxLine {\n"); + sb.append("class TaxLine {\n"); sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); sb.append(" taxTypeName: ").append(toIndentedString(taxTypeName)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); diff --git a/src/main/java/com/xero/models/payrollau/Timesheet.java b/src/main/java/com/xero/models/payrollau/Timesheet.java index 56d062bd..e17b3d0f 100644 --- a/src/main/java/com/xero/models/payrollau/Timesheet.java +++ b/src/main/java/com/xero/models/payrollau/Timesheet.java @@ -24,7 +24,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.LocalDate; +import java.util.UUID; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -35,15 +35,15 @@ public class Timesheet { @JsonProperty("EmployeeID") - private Object employeeID = null; + private UUID employeeID; - @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("StartDate") - private LocalDate startDate; + private String startDate; - @JsonDeserialize(using = com.xero.api.CustomDateDeserializer.class) + @JsonProperty("EndDate") - private LocalDate endDate; + private String endDate; @JsonProperty("Status") @@ -55,13 +55,13 @@ public class Timesheet { @JsonProperty("TimesheetID") - private Object timesheetID = null; + private UUID timesheetID; @JsonProperty("TimesheetLines") private List timesheetLines = new ArrayList(); - public Timesheet employeeID(Object employeeID) { + public Timesheet employeeID(UUID employeeID) { this.employeeID = employeeID; return this; } @@ -71,15 +71,15 @@ public Timesheet employeeID(Object employeeID) { * @return employeeID **/ @ApiModelProperty(example = "72a0d0c2-0cf8-4f0b-ade1-33231f47b41b", required = true, value = "The Xero identifier for an employee") - public Object getEmployeeID() { + public UUID getEmployeeID() { return employeeID; } - public void setEmployeeID(Object employeeID) { + public void setEmployeeID(UUID employeeID) { this.employeeID = employeeID; } - public Timesheet startDate(LocalDate startDate) { + public Timesheet startDate(String startDate) { this.startDate = startDate; return this; } @@ -88,16 +88,16 @@ public Timesheet startDate(LocalDate startDate) { * Period start date (YYYY-MM-DD) * @return startDate **/ - @ApiModelProperty(required = true, value = "Period start date (YYYY-MM-DD)") - public LocalDate getStartDate() { + @ApiModelProperty(example = "2013-02-01T00:00:00Z", required = true, value = "Period start date (YYYY-MM-DD)") + public String getStartDate() { return startDate; } - public void setStartDate(LocalDate startDate) { + public void setStartDate(String startDate) { this.startDate = startDate; } - public Timesheet endDate(LocalDate endDate) { + public Timesheet endDate(String endDate) { this.endDate = endDate; return this; } @@ -106,12 +106,12 @@ public Timesheet endDate(LocalDate endDate) { * Period end date (YYYY-MM-DD) * @return endDate **/ - @ApiModelProperty(required = true, value = "Period end date (YYYY-MM-DD)") - public LocalDate getEndDate() { + @ApiModelProperty(example = "2013-02-07T00:00:00Z", required = true, value = "Period end date (YYYY-MM-DD)") + public String getEndDate() { return endDate; } - public void setEndDate(LocalDate endDate) { + public void setEndDate(String endDate) { this.endDate = endDate; } @@ -151,7 +151,7 @@ public void setHours(Float hours) { this.hours = hours; } - public Timesheet timesheetID(Object timesheetID) { + public Timesheet timesheetID(UUID timesheetID) { this.timesheetID = timesheetID; return this; } @@ -161,11 +161,11 @@ public Timesheet timesheetID(Object timesheetID) { * @return timesheetID **/ @ApiModelProperty(example = "049765fc-4506-48fb-bf88-3578dec0ec47", value = "The Xero identifier for a Payroll Timesheet") - public Object getTimesheetID() { + public UUID getTimesheetID() { return timesheetID; } - public void setTimesheetID(Object timesheetID) { + public void setTimesheetID(UUID timesheetID) { this.timesheetID = timesheetID; } diff --git a/src/main/java/com/xero/models/payrollau/TimesheetLine.java b/src/main/java/com/xero/models/payrollau/TimesheetLine.java index 4b19d23a..f6f5cd90 100644 --- a/src/main/java/com/xero/models/payrollau/TimesheetLine.java +++ b/src/main/java/com/xero/models/payrollau/TimesheetLine.java @@ -23,7 +23,6 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import org.threeten.bp.OffsetDateTime; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -44,9 +43,9 @@ public class TimesheetLine { @JsonProperty("NumberOfUnits") private List numberOfUnits = new ArrayList(); - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC; + private String updatedDateUTC; public TimesheetLine earningsRateID(UUID earningsRateID) { this.earningsRateID = earningsRateID; @@ -110,7 +109,7 @@ public void setNumberOfUnits(List numberOfUnits) { this.numberOfUnits = numberOfUnits; } - public TimesheetLine updatedDateUTC(OffsetDateTime updatedDateUTC) { + public TimesheetLine updatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; return this; } @@ -119,12 +118,12 @@ public TimesheetLine updatedDateUTC(OffsetDateTime updatedDateUTC) { * Last modified timestamp * @return updatedDateUTC **/ - @ApiModelProperty(value = "Last modified timestamp") - public OffsetDateTime getUpdatedDateUTC() { + @ApiModelProperty(example = "2018-04-01T23:02:36", value = "Last modified timestamp") + public String getUpdatedDateUTC() { return updatedDateUTC; } - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + public void setUpdatedDateUTC(String updatedDateUTC) { this.updatedDateUTC = updatedDateUTC; } diff --git a/src/main/java/com/xero/models/payrollau/TimesheetObject.java b/src/main/java/com/xero/models/payrollau/TimesheetObject.java new file mode 100644 index 00000000..50dc0331 --- /dev/null +++ b/src/main/java/com/xero/models/payrollau/TimesheetObject.java @@ -0,0 +1,94 @@ +/* + * Xero Payroll AU + * This is the Xero Payroll API for orgs in Australia region. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@xero.com + * + * 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.models.payrollau; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.xero.models.payrollau.Timesheet; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * TimesheetObject + */ + +public class TimesheetObject { + + @JsonProperty("Timesheet") + private Timesheet timesheet = null; + + public TimesheetObject timesheet(Timesheet timesheet) { + this.timesheet = timesheet; + return this; + } + + /** + * Get timesheet + * @return timesheet + **/ + @ApiModelProperty(value = "") + public Timesheet getTimesheet() { + return timesheet; + } + + public void setTimesheet(Timesheet timesheet) { + this.timesheet = timesheet; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TimesheetObject timesheetObject = (TimesheetObject) o; + return Objects.equals(this.timesheet, timesheetObject.timesheet); + } + + @Override + public int hashCode() { + return Objects.hash(timesheet); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TimesheetObject {\n"); + sb.append(" timesheet: ").append(toIndentedString(timesheet)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/xero/models/payrollau/Timesheets.java b/src/main/java/com/xero/models/payrollau/Timesheets.java index 9233aed5..07f52c0b 100644 --- a/src/main/java/com/xero/models/payrollau/Timesheets.java +++ b/src/main/java/com/xero/models/payrollau/Timesheets.java @@ -32,33 +32,33 @@ public class Timesheets { - @JsonProperty("Employees") - private List employees = new ArrayList(); + @JsonProperty("Timesheets") + private List timesheets = new ArrayList(); - public Timesheets employees(List employees) { - this.employees = employees; + public Timesheets timesheets(List timesheets) { + this.timesheets = timesheets; return this; } - public Timesheets addEmployeesItem(Timesheet employeesItem) { - if (this.employees == null) { - this.employees = new ArrayList(); + public Timesheets addTimesheetsItem(Timesheet timesheetsItem) { + if (this.timesheets == null) { + this.timesheets = new ArrayList(); } - this.employees.add(employeesItem); + this.timesheets.add(timesheetsItem); return this; } /** - * Get employees - * @return employees + * Get timesheets + * @return timesheets **/ @ApiModelProperty(value = "") - public List getEmployees() { - return employees; + public List getTimesheets() { + return timesheets; } - public void setEmployees(List employees) { - this.employees = employees; + public void setTimesheets(List timesheets) { + this.timesheets = timesheets; } @@ -71,12 +71,12 @@ public boolean equals(java.lang.Object o) { return false; } Timesheets timesheets = (Timesheets) o; - return Objects.equals(this.employees, timesheets.employees); + return Objects.equals(this.timesheets, timesheets.timesheets); } @Override public int hashCode() { - return Objects.hash(employees); + return Objects.hash(timesheets); } @@ -84,7 +84,7 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Timesheets {\n"); - sb.append(" employees: ").append(toIndentedString(employees)).append("\n"); + sb.append(" timesheets: ").append(toIndentedString(timesheets)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java index f861c796..c8750e21 100644 --- a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java @@ -56,7 +56,9 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client + // Init AccountingApi client + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); From 2a3dbfce3be425a7a691ac95f1d07d7666d6b3d8 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Thu, 14 Nov 2019 12:49:29 -0800 Subject: [PATCH 75/76] Update to 3.1.1 Moved Mocking API to getsandbox.com service for Accounting API tests Moved HttpTransport init from ApiClient variable so it can be modfied in ApiClient --- pom.xml | 5 +- src/main/java/com/xero/api/ApiClient.java | 14 +- .../com/xero/api/client/AccountingApi.java | 430 +----------------- .../com/xero/api/client/BankFeedsApi.java | 30 +- .../java/com/xero/api/client/IdentityApi.java | 65 ++- .../com/xero/api/client/PayrollAuApi.java | 147 ++---- .../xero/models/accounting/ReportWithRow.java | 50 +- .../api/client/AccountingApiAccountsTest.java | 9 +- .../AccountingApiBankTransactionTest.java | 7 +- .../client/AccountingApiBankTransferTest.java | 8 +- .../client/AccountingApiBatchPaymentTest.java | 7 +- .../AccountingApiBrandingThemeTest.java | 7 +- .../client/AccountingApiContactGroupTest.java | 7 +- .../api/client/AccountingApiContactsTest.java | 7 +- .../client/AccountingApiCreditNotesTest.java | 14 +- .../client/AccountingApiEmployeesTest.java | 6 +- .../AccountingApiExpenseClaimsTest.java | 6 +- .../api/client/AccountingApiInvoicesTest.java | 6 +- .../api/client/AccountingApiItemsTest.java | 6 +- .../api/client/AccountingApiJournalsTest.java | 6 +- .../AccountingApiLinkedTransactionsTest.java | 6 +- .../AccountingApiManualJournalsTest.java | 6 +- .../AccountingApiOrganisationsTest.java | 6 +- .../client/AccountingApiOverpaymentsTest.java | 6 +- .../AccountingApiPaymentServicesTest.java | 6 +- .../api/client/AccountingApiPaymentsTest.java | 6 +- .../client/AccountingApiPrepaymentsTest.java | 6 +- .../AccountingApiPurchaseOrdersTest.java | 6 +- .../api/client/AccountingApiReceiptsTest.java | 6 +- .../AccountingApiRepeatingInvoicesTest.java | 6 +- .../api/client/AccountingApiReportsTest.java | 46 +- .../api/client/AccountingApiTaxRatesTest.java | 6 +- .../AccountingApiTrackingCategoriesTest.java | 6 +- .../api/client/AccountingApiUsersTest.java | 6 +- .../client/BankfeedApiFeedConnectionTest.java | 2 +- .../api/client/BankfeedApiStatementTest.java | 2 +- 36 files changed, 264 insertions(+), 701 deletions(-) diff --git a/pom.xml b/pom.xml index c1648c50..8c90261c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 3.1.0 + 3.1.1 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API @@ -101,7 +101,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} com.github.joschi.jackson @@ -294,6 +294,7 @@ 1.23.0 2.25.1 2.9.10 + 2.9.10.1 2.6.4 4.12 4.5.3 diff --git a/src/main/java/com/xero/api/ApiClient.java b/src/main/java/com/xero/api/ApiClient.java index e9984c35..9bc5c625 100644 --- a/src/main/java/com/xero/api/ApiClient.java +++ b/src/main/java/com/xero/api/ApiClient.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.io.OutputStream; + public class ApiClient { private final String basePath; private final HttpRequestFactory httpRequestFactory; @@ -31,7 +32,7 @@ private static ObjectMapper createDefaultObjectMapper() { .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .setDateFormat(new RFC3339DateFormat()) - .setSerializationInclusion(Include.NON_EMPTY); + .setSerializationInclusion(Include.NON_EMPTY); objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); ThreeTenModule module = new ThreeTenModule(); @@ -48,7 +49,7 @@ public ApiClient() { public ApiClient( String basePath, - HttpTransport httpTransport, + HttpTransport transport, HttpRequestInitializer initializer, ObjectMapper objectMapper, HttpRequestFactory reqFactory @@ -56,7 +57,10 @@ public ApiClient( this.basePath = basePath == null ? defaultBasePath : ( basePath.endsWith("/") ? basePath.substring(0, basePath.length() - 1) : basePath ); - this.httpRequestFactory = (reqFactory != null ? reqFactory : (httpTransport == null ? Utils.getDefaultTransport() : httpTransport).createRequestFactory(initializer) ); + if (transport != null) { + this.httpTransport = transport; + } + this.httpRequestFactory = (reqFactory != null ? reqFactory : (transport == null ? Utils.getDefaultTransport() : transport).createRequestFactory(initializer) ); this.objectMapper = (objectMapper == null ? createDefaultObjectMapper() : objectMapper); } @@ -68,6 +72,10 @@ public HttpTransport getHttpTransport() { return httpTransport; } + public void setHttpTransport(HttpTransport transport) { + this.httpTransport = transport; + } + public String getBasePath() { return basePath; } diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index 4d0e3c9b..651466d5 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -100,7 +100,7 @@ public class AccountingApi { private ApiClient apiClient; private static AccountingApi instance = null; private String userAgent = "Default"; - private String version = "3.1.0"; + private String version = "3.1.1"; public AccountingApi() { this(new ApiClient()); @@ -180,11 +180,9 @@ public HttpResponse createAccountForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(account); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -252,12 +250,9 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(String acce java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -311,11 +306,9 @@ public HttpResponse createBankTransactionForHttpResponse(String accessToken, St HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(bankTransaction); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -383,12 +376,9 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(Str java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -451,11 +441,9 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse(String acc HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -521,11 +509,9 @@ public HttpResponse createBankTransactionsForHttpResponse(String accessToken, S HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(bankTransactions); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -579,11 +565,9 @@ public HttpResponse createBankTransferForHttpResponse(String accessToken, Strin HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(bankTransfers); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -650,12 +634,9 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(String java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -717,11 +698,9 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse(String access HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -775,11 +754,9 @@ public HttpResponse createBatchPaymentForHttpResponse(String accessToken, Strin HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(batchPayments); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -842,11 +819,9 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse(String access HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -909,11 +884,9 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse(String acc HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(paymentService); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -966,11 +939,9 @@ public HttpResponse createContactForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contact); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1037,12 +1008,9 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(String acce java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1096,11 +1064,9 @@ public HttpResponse createContactGroupForHttpResponse(String accessToken, Strin HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contactGroups); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1163,11 +1129,9 @@ public HttpResponse createContactGroupContactsForHttpResponse(String accessToken HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contacts); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1230,11 +1194,9 @@ public HttpResponse createContactHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1287,11 +1249,9 @@ public HttpResponse createContactsForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contacts); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1345,11 +1305,9 @@ public HttpResponse createCreditNoteForHttpResponse(String accessToken, String HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(creditNote); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1412,11 +1370,9 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String accessToken HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(allocations); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1484,12 +1440,9 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String a java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1552,11 +1505,9 @@ public HttpResponse createCreditNoteHistoryForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1622,11 +1573,9 @@ public HttpResponse createCreditNotesForHttpResponse(String accessToken, String HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(creditNotes); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1678,11 +1627,9 @@ public HttpResponse createCurrencyForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(currency); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1736,11 +1683,9 @@ public HttpResponse createEmployeeForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(employee); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1794,11 +1739,9 @@ public HttpResponse createEmployeesForHttpResponse(String accessToken, String x HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(employees); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1860,11 +1803,9 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1918,11 +1859,9 @@ public HttpResponse createExpenseClaimsForHttpResponse(String accessToken, Stri HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(expenseClaims); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -1976,11 +1915,9 @@ public HttpResponse createInvoiceForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(invoice); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2048,12 +1985,9 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String acce java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2116,11 +2050,9 @@ public HttpResponse createInvoiceHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2186,11 +2118,9 @@ public HttpResponse createInvoicesForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(invoices); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2244,11 +2174,9 @@ public HttpResponse createItemForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(item); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2310,11 +2238,9 @@ public HttpResponse createItemHistoryForHttpResponse(String accessToken, String HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2368,11 +2294,9 @@ public HttpResponse createItemsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(items); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2426,11 +2350,9 @@ public HttpResponse createLinkedTransactionForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(linkedTransaction); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2484,11 +2406,9 @@ public HttpResponse createLinkedTransactionsForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(linkedTransactions); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2542,11 +2462,9 @@ public HttpResponse createManualJournalForHttpResponse(String accessToken, Stri HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(manualJournal); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2614,12 +2532,9 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(Strin java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2673,11 +2588,9 @@ public HttpResponse createManualJournalsForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(manualJournals); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2740,11 +2653,9 @@ public HttpResponse createOverpaymentAllocationForHttpResponse(String accessToke HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(allocation); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2807,11 +2718,9 @@ public HttpResponse createOverpaymentAllocationsForHttpResponse(String accessTok HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(allocations); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2874,11 +2783,9 @@ public HttpResponse createOverpaymentHistoryForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2932,11 +2839,9 @@ public HttpResponse createPaymentForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payment); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -2999,11 +2904,9 @@ public HttpResponse createPaymentHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3057,11 +2960,9 @@ public HttpResponse createPaymentServiceForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(paymentServices); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3115,11 +3016,9 @@ public HttpResponse createPaymentsForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payments); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3182,11 +3081,9 @@ public HttpResponse createPrepaymentAllocationForHttpResponse(String accessToken HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(allocations); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3249,11 +3146,9 @@ public HttpResponse createPrepaymentHistoryForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3307,11 +3202,9 @@ public HttpResponse createPurchaseOrderForHttpResponse(String accessToken, Stri HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(purchaseOrder); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3374,11 +3267,9 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse(String accessToken HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3444,11 +3335,9 @@ public HttpResponse createPurchaseOrdersForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(purchaseOrders); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3502,11 +3391,9 @@ public HttpResponse createReceiptForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(receipts); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3574,12 +3461,9 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(String acce java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3642,11 +3526,9 @@ public HttpResponse createReceiptHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3714,12 +3596,9 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(St java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3782,11 +3661,9 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse(String accessTo HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3840,11 +3717,9 @@ public HttpResponse createTaxRateForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(taxRate); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3898,11 +3773,9 @@ public HttpResponse createTaxRatesForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(taxRates); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -3956,11 +3829,9 @@ public HttpResponse createTrackingCategoryForHttpResponse(String accessToken, S HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(trackingCategory); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4023,11 +3894,9 @@ public HttpResponse createTrackingOptionsForHttpResponse(String accessToken, St HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(trackingOption); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4086,9 +3955,7 @@ public HttpResponse deleteAccountForHttpResponse(String accessToken, String xer HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4148,9 +4015,7 @@ public HttpResponse deleteContactGroupContactForHttpResponse(String accessToken, HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4204,9 +4069,7 @@ public HttpResponse deleteContactGroupContactsForHttpResponse(String accessToken HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4261,9 +4124,7 @@ public HttpResponse deleteItemForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4318,9 +4179,7 @@ public HttpResponse deleteLinkedTransactionForHttpResponse(String accessToken, HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4383,11 +4242,9 @@ public HttpResponse deletePaymentForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(payments); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4446,9 +4303,7 @@ public HttpResponse deleteTrackingCategoryForHttpResponse(String accessToken, S HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4512,9 +4367,7 @@ public HttpResponse deleteTrackingOptionsForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4573,11 +4426,9 @@ public HttpResponse emailInvoiceForHttpResponse(String accessToken, String xero HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(requestEmpty); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4635,9 +4486,7 @@ public HttpResponse getAccountForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4713,9 +4562,7 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse(String accessT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4791,9 +4638,7 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse(String accessToken, HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4851,9 +4696,7 @@ public HttpResponse getAccountAttachmentsForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4926,9 +4769,7 @@ public HttpResponse getAccountsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -4986,9 +4827,7 @@ public HttpResponse getBankTransactionForHttpResponse(String accessToken, Strin HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5064,9 +4903,7 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse(String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5142,9 +4979,7 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse(String acces HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5202,9 +5037,7 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse(String accessTo HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5299,9 +5132,7 @@ public HttpResponse getBankTransactionsForHttpResponse(String accessToken, Stri HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5359,9 +5190,7 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse(String accessToken HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5419,9 +5248,7 @@ public HttpResponse getBankTransferForHttpResponse(String accessToken, String x HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5497,9 +5324,7 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse(String ac HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5575,9 +5400,7 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse(String accessTo HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5635,9 +5458,7 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse(String accessToken HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5695,9 +5516,7 @@ public HttpResponse getBankTransferHistoryForHttpResponse(String accessToken, S HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5770,9 +5589,7 @@ public HttpResponse getBankTransfersForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5830,9 +5647,7 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse(String accessToken, S HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5905,9 +5720,7 @@ public HttpResponse getBatchPaymentsForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -5965,9 +5778,7 @@ public HttpResponse getBrandingThemeForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6025,9 +5836,7 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse(String access HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6076,9 +5885,7 @@ public HttpResponse getBrandingThemesForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6136,9 +5943,7 @@ public HttpResponse getContactForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6214,9 +6019,7 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse(String accessT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6292,9 +6095,7 @@ public HttpResponse getContactAttachmentByIdForHttpResponse(String accessToken, HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6352,9 +6153,7 @@ public HttpResponse getContactAttachmentsForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6412,9 +6211,7 @@ public HttpResponse getContactCISSettingsForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6472,9 +6269,7 @@ public HttpResponse getContactGroupForHttpResponse(String accessToken, String x HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6546,9 +6341,7 @@ public HttpResponse getContactGroupsForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6606,9 +6399,7 @@ public HttpResponse getContactHistoryForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6714,9 +6505,7 @@ public HttpResponse getContactsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6774,9 +6563,7 @@ public HttpResponse getCreditNoteForHttpResponse(String accessToken, String xer HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6847,9 +6634,7 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse(String accessToken, Strin HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -6925,9 +6710,7 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse(String acce HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7003,9 +6786,7 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse(String accessToke HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7063,9 +6844,7 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse(String accessToken, HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7123,9 +6902,7 @@ public HttpResponse getCreditNoteHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7209,9 +6986,7 @@ public HttpResponse getCreditNotesForHttpResponse(String accessToken, String xe HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7283,9 +7058,7 @@ public HttpResponse getCurrenciesForHttpResponse(String accessToken, String xer HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7343,9 +7116,7 @@ public HttpResponse getEmployeeForHttpResponse(String accessToken, String xeroT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7418,9 +7189,7 @@ public HttpResponse getEmployeesForHttpResponse(String accessToken, String xero HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7478,9 +7247,7 @@ public HttpResponse getExpenseClaimForHttpResponse(String accessToken, String x HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7538,9 +7305,7 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse(String accessToken, S HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7613,9 +7378,7 @@ public HttpResponse getExpenseClaimsForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7673,9 +7436,7 @@ public HttpResponse getInvoiceForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7746,9 +7507,7 @@ public HttpResponse getInvoiceAsPdfForHttpResponse(String accessToken, String x HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7824,9 +7583,7 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse(String accessT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7902,9 +7659,7 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse(String accessToken, HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -7962,9 +7717,7 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8022,9 +7775,7 @@ public HttpResponse getInvoiceHistoryForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8073,9 +7824,7 @@ public HttpResponse getInvoiceRemindersForHttpResponse(String accessToken, Stri HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8236,9 +7985,7 @@ public HttpResponse getInvoicesForHttpResponse(String accessToken, String xeroT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8296,9 +8043,7 @@ public HttpResponse getItemForHttpResponse(String accessToken, String xeroTenan HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8356,9 +8101,7 @@ public HttpResponse getItemHistoryForHttpResponse(String accessToken, String xe HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8442,9 +8185,7 @@ public HttpResponse getItemsForHttpResponse(String accessToken, String xeroTena HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8502,9 +8243,7 @@ public HttpResponse getJournalForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8577,9 +8316,7 @@ public HttpResponse getJournalsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8637,9 +8374,7 @@ public HttpResponse getLinkedTransactionForHttpResponse(String accessToken, Str HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8755,9 +8490,7 @@ public HttpResponse getLinkedTransactionsForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8815,9 +8548,7 @@ public HttpResponse getManualJournalForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8893,9 +8624,7 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(String a HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -8971,9 +8700,7 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse(String accessT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9031,9 +8758,7 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse(String accessToke HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9117,9 +8842,7 @@ public HttpResponse getManualJournalsForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9177,9 +8900,7 @@ public HttpResponse getOnlineInvoiceForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9237,9 +8958,7 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse(String accessToken HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9288,9 +9007,7 @@ public HttpResponse getOrganisationsForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9348,9 +9065,7 @@ public HttpResponse getOverpaymentForHttpResponse(String accessToken, String xe HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9408,9 +9123,7 @@ public HttpResponse getOverpaymentHistoryForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9505,9 +9218,7 @@ public HttpResponse getOverpaymentsForHttpResponse(String accessToken, String x HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9565,9 +9276,7 @@ public HttpResponse getPaymentForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9625,9 +9334,7 @@ public HttpResponse getPaymentHistoryForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9676,9 +9383,7 @@ public HttpResponse getPaymentServicesForHttpResponse(String accessToken, Strin HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9751,9 +9456,7 @@ public HttpResponse getPaymentsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9811,9 +9514,7 @@ public HttpResponse getPrepaymentForHttpResponse(String accessToken, String xer HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9871,9 +9572,7 @@ public HttpResponse getPrepaymentHistoryForHttpResponse(String accessToken, Str HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -9968,9 +9667,7 @@ public HttpResponse getPrepaymentsForHttpResponse(String accessToken, String xe HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10028,9 +9725,7 @@ public HttpResponse getPurchaseOrderForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10088,9 +9783,7 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse(String accessToken, HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10196,9 +9889,7 @@ public HttpResponse getPurchaseOrdersForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10256,9 +9947,7 @@ public HttpResponse getQuoteForHttpResponse(String accessToken, String xeroTena HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10397,9 +10086,7 @@ public HttpResponse getQuotesForHttpResponse(String accessToken, String xeroTen HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10457,9 +10144,7 @@ public HttpResponse getReceiptForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10535,9 +10220,7 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse(String accessT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10613,9 +10296,7 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse(String accessToken, HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10673,9 +10354,7 @@ public HttpResponse getReceiptAttachmentsForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10733,9 +10412,7 @@ public HttpResponse getReceiptHistoryForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10819,9 +10496,7 @@ public HttpResponse getReceiptsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10879,9 +10554,7 @@ public HttpResponse getRepeatingInvoiceForHttpResponse(String accessToken, Stri HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -10957,9 +10630,7 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse(Strin HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11035,9 +10706,7 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse(String acce HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11095,9 +10764,7 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse(String accessT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11155,9 +10822,7 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse(String accessToken HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11229,9 +10894,7 @@ public HttpResponse getRepeatingInvoicesForHttpResponse(String accessToken, Str HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11328,9 +10991,7 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse(String accessT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11427,9 +11088,7 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse(String acce HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11487,9 +11146,7 @@ public HttpResponse getReportBASorGSTForHttpResponse(String accessToken, String HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11538,9 +11195,7 @@ public HttpResponse getReportBASorGSTListForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11667,9 +11322,7 @@ public HttpResponse getReportBalanceSheetForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11752,9 +11405,7 @@ public HttpResponse getReportBankSummaryForHttpResponse(String accessToken, Str HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11837,9 +11488,7 @@ public HttpResponse getReportBudgetSummaryForHttpResponse(String accessToken, S HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -11900,9 +11549,7 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse(String accessToken, HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12062,9 +11709,7 @@ public HttpResponse getReportProfitAndLossForHttpResponse(String accessToken, S HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12125,9 +11770,7 @@ public HttpResponse getReportTenNinetyNineForHttpResponse(String accessToken, S HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12199,9 +11842,7 @@ public HttpResponse getReportTrialBalanceForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12284,9 +11925,7 @@ public HttpResponse getTaxRatesForHttpResponse(String accessToken, String xeroT HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12369,9 +12008,7 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String accessToken, St HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12429,9 +12066,7 @@ public HttpResponse getTrackingCategoryForHttpResponse(String accessToken, Stri HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12489,9 +12124,7 @@ public HttpResponse getUserForHttpResponse(String accessToken, String xeroTenan HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12564,9 +12197,7 @@ public HttpResponse getUsersForHttpResponse(String accessToken, String xeroTena HttpContent content = null; - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12629,11 +12260,9 @@ public HttpResponse updateAccountForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(accounts); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12701,12 +12330,9 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse(String acce java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12769,11 +12395,9 @@ public HttpResponse updateBankTransactionForHttpResponse(String accessToken, St HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(bankTransactions); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12841,12 +12465,9 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse(Str java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12913,12 +12534,9 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse(String java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -12980,11 +12598,9 @@ public HttpResponse updateContactForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contacts); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13051,12 +12667,9 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse(String acce java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13119,11 +12732,9 @@ public HttpResponse updateContactGroupForHttpResponse(String accessToken, Strin HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contactGroups); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13186,11 +12797,9 @@ public HttpResponse updateCreditNoteForHttpResponse(String accessToken, String HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(creditNotes); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13258,12 +12867,9 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String a java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13326,11 +12932,9 @@ public HttpResponse updateEmployeeForHttpResponse(String accessToken, String xe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(employees); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13393,11 +12997,9 @@ public HttpResponse updateExpenseClaimForHttpResponse(String accessToken, Strin HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(expenseClaims); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13460,11 +13062,9 @@ public HttpResponse updateInvoiceForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(invoices); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13532,12 +13132,9 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse(String acce java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13600,11 +13197,9 @@ public HttpResponse updateItemForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(items); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13667,11 +13262,9 @@ public HttpResponse updateLinkedTransactionForHttpResponse(String accessToken, HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(linkedTransactions); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13734,11 +13327,9 @@ public HttpResponse updateManualJournalForHttpResponse(String accessToken, Stri HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(manualJournals); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13806,12 +13397,9 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse(Strin java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13874,11 +13462,9 @@ public HttpResponse updatePurchaseOrderForHttpResponse(String accessToken, Stri HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(purchaseOrders); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -13941,11 +13527,9 @@ public HttpResponse updateReceiptForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(receipts); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -14013,12 +13597,9 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse(String acce java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -14086,12 +13667,9 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse(St java.nio.file.Path bodyPath = body.toPath(); String mimeType = Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -14145,11 +13723,9 @@ public HttpResponse updateTaxRateForHttpResponse(String accessToken, String xer HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(taxRates); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -14212,11 +13788,9 @@ public HttpResponse updateTrackingCategoryForHttpResponse(String accessToken, S HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(trackingCategory); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); @@ -14284,11 +13858,9 @@ public HttpResponse updateTrackingOptionsForHttpResponse(String accessToken, St HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(trackingOption); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - //HttpTransport transport = new NetHttpTransport(); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); diff --git a/src/main/java/com/xero/api/client/BankFeedsApi.java b/src/main/java/com/xero/api/client/BankFeedsApi.java index b9f9e6c3..973e6bab 100644 --- a/src/main/java/com/xero/api/client/BankFeedsApi.java +++ b/src/main/java/com/xero/api/client/BankFeedsApi.java @@ -45,7 +45,7 @@ public class BankFeedsApi { private ApiClient apiClient; private static BankFeedsApi instance = null; private String userAgent = "Default"; - private String version = "3.1.0"; + private String version = "3.1.1"; public BankFeedsApi() { this(new ApiClient()); @@ -122,11 +122,9 @@ public HttpResponse createFeedConnectionsForHttpResponse(String accessToken, St String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(feedConnections); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -175,11 +173,9 @@ public HttpResponse createStatementsForHttpResponse(String accessToken, String String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(statements); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -228,11 +224,9 @@ public HttpResponse deleteFeedConnectionsForHttpResponse(String accessToken, St String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(feedConnections); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -286,10 +280,8 @@ public HttpResponse getFeedConnectionForHttpResponse(String accessToken, String String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -357,10 +349,8 @@ public HttpResponse getFeedConnectionsForHttpResponse(String accessToken, Strin String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -414,10 +404,8 @@ public HttpResponse getStatementForHttpResponse(String accessToken, String xero String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -487,10 +475,8 @@ public HttpResponse getStatementsForHttpResponse(String accessToken, String xer String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); HttpContent content = null; - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); diff --git a/src/main/java/com/xero/api/client/IdentityApi.java b/src/main/java/com/xero/api/client/IdentityApi.java index 4d618f4c..c97eeea0 100644 --- a/src/main/java/com/xero/api/client/IdentityApi.java +++ b/src/main/java/com/xero/api/client/IdentityApi.java @@ -3,14 +3,22 @@ import com.xero.api.ApiClient; import com.xero.models.identity.Connection; +import com.xero.api.XeroApiException; +import com.xero.api.XeroApiExceptionHandler; import com.fasterxml.jackson.core.type.TypeReference; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpContent; import com.google.api.client.http.HttpMethods; +import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpResponse; +import com.google.api.client.http.HttpResponseException; +import com.google.api.client.http.HttpTransport; import com.google.api.client.http.FileContent; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.auth.oauth2.BearerToken; +import com.google.api.client.auth.oauth2.Credential; import javax.ws.rs.core.UriBuilder; import java.io.IOException; @@ -30,12 +38,21 @@ public class IdentityApi { private ApiClient apiClient; - private String xeroTenantId; + private static IdentityApi instance = null; + private String userAgent = "Default"; + private String version = "3.1.1"; public IdentityApi() { this(new ApiClient()); } + public static IdentityApi getInstance(ApiClient apiClient) { + if (instance == null) { + instance = new IdentityApi(apiClient); + } + return instance; + } + public IdentityApi(ApiClient apiClient) { this.apiClient = apiClient; } @@ -48,49 +65,59 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } - public String getXeroTenantId(String xeroTenantId) { - return xeroTenantId; + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; } - - public void setXeroTenantId(String xeroTenantId) { - this.xeroTenantId = xeroTenantId; + + public String getUserAgent() { + return this.userAgent + "[Xero-Java-" + this.version + "]"; } /** * Allows you to retrieve the connections for this users * Override the base server url that include version *

200 - Success - return response of type Connections array with 0 to n Connection + * @param accessToken Authorization token for user set in header of each request * @return List<Connection> * @throws IOException if an error occurs while attempting to invoke the API **/ - public List getConnections() throws IOException { - HttpResponse response = getConnectionsForHttpResponse(); - TypeReference typeRef = new TypeReference>() {}; - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + public List getConnections(String accessToken) throws IOException { + try { + TypeReference> typeRef = new TypeReference>() {}; + HttpResponse response = getConnectionsForHttpResponse(accessToken); + return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } catch (HttpResponseException e) { + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + handler.execute(e,apiClient); + } catch (IOException ioe) { + throw ioe; + } + return null; } - public HttpResponse getConnectionsForHttpResponse() throws IOException { + public HttpResponse getConnectionsForHttpResponse(String accessToken) throws IOException { + if (accessToken == null) { + throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getConnections"); + } HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", this.xeroTenantId); headers.setAccept("application/json"); + headers.setUserAgent(this.getUserAgent()); + String correctPath = "/connections"; UriBuilder uriBuilder = UriBuilder.fromUri("https://api.xero.com" + correctPath); String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); - //HttpContent content = new FileContent(mimeType, body); HttpContent content = null; + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); + HttpTransport transport = apiClient.getHttpTransport(); + HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - - - - return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); + return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); } - - public ByteArrayInputStream convertInputToByteArray(InputStream is) throws IOException { byte[] bytes = IOUtils.toByteArray(is); diff --git a/src/main/java/com/xero/api/client/PayrollAuApi.java b/src/main/java/com/xero/api/client/PayrollAuApi.java index 4476b098..2d64f93d 100644 --- a/src/main/java/com/xero/api/client/PayrollAuApi.java +++ b/src/main/java/com/xero/api/client/PayrollAuApi.java @@ -59,7 +59,7 @@ public class PayrollAuApi { private ApiClient apiClient; private static PayrollAuApi instance = null; private String userAgent = "Default"; - private String version = "3.1.0"; + private String version = "3.1.1"; public PayrollAuApi() { this(new ApiClient()); @@ -139,13 +139,10 @@ public HttpResponse createEmployeeForHttpResponse(String accessToken, String xe HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(employee); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -198,13 +195,10 @@ public HttpResponse createLeaveApplicationForHttpResponse(String accessToken, S HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(leaveApplication); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -257,13 +251,10 @@ public HttpResponse createPayItemForHttpResponse(String accessToken, String xer HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(payItem); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -316,13 +307,10 @@ public HttpResponse createPayRunForHttpResponse(String accessToken, String xero HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(payRun); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -375,13 +363,10 @@ public HttpResponse createPayrollCalendarForHttpResponse(String accessToken, St HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(payrollCalendar); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -434,13 +419,10 @@ public HttpResponse createSuperfundForHttpResponse(String accessToken, String x HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(superFund); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -493,13 +475,10 @@ public HttpResponse createTimesheetForHttpResponse(String accessToken, String x HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(timesheet); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -556,11 +535,8 @@ public HttpResponse getEmployeeForHttpResponse(String accessToken, String xeroT HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -644,11 +620,8 @@ public HttpResponse getEmployeesForHttpResponse(String accessToken, String xero HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -705,11 +678,8 @@ public HttpResponse getLeaveApplicationForHttpResponse(String accessToken, Stri HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -793,11 +763,8 @@ public HttpResponse getLeaveApplicationsForHttpResponse(String accessToken, Str HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -881,11 +848,8 @@ public HttpResponse getPayItemsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -942,11 +906,8 @@ public HttpResponse getPayRunForHttpResponse(String accessToken, String xeroTen HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -1030,11 +991,8 @@ public HttpResponse getPayRunsForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -1092,11 +1050,8 @@ public HttpResponse getPayrollCalendarForHttpResponse(String accessToken, Strin HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -1180,11 +1135,8 @@ public HttpResponse getPayrollCalendarsForHttpResponse(String accessToken, Stri HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -1241,11 +1193,8 @@ public HttpResponse getPayslipForHttpResponse(String accessToken, String xeroTe HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -1293,11 +1242,8 @@ public HttpResponse getSettingsForHttpResponse(String accessToken, String xeroT HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -1369,11 +1315,8 @@ public HttpResponse getSuperFundProductsForHttpResponse(String accessToken, Str HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -1457,11 +1400,8 @@ public HttpResponse getSuperFundsForHttpResponse(String accessToken, String xer HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -1518,11 +1458,8 @@ public HttpResponse getSuperfundForHttpResponse(String accessToken, String xero HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -1579,11 +1516,8 @@ public HttpResponse getTimesheetForHttpResponse(String accessToken, String xero HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -1667,11 +1601,8 @@ public HttpResponse getTimesheetsForHttpResponse(String accessToken, String xer HttpContent content = null; - - - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers).execute(); @@ -1730,13 +1661,10 @@ public HttpResponse updateEmployeeForHttpResponse(String accessToken, String xe HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(employee); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -1798,13 +1726,10 @@ public HttpResponse updateLeaveApplicationForHttpResponse(String accessToken, S HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(leaveApplication); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -1863,13 +1788,10 @@ public HttpResponse updatePayRunForHttpResponse(String accessToken, String xero HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(payRun); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -1928,13 +1850,10 @@ public HttpResponse updatePayslipByIDForHttpResponse(String accessToken, String HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(payslipObject); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -1993,13 +1912,10 @@ public HttpResponse updateSuperfundForHttpResponse(String accessToken, String x HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(superFund); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); @@ -2058,13 +1974,10 @@ public HttpResponse updateTimesheetForHttpResponse(String accessToken, String x HttpContent content = null; - - content = apiClient.new JacksonJsonHttpContent(timesheet); - Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = new NetHttpTransport(); + HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers).execute(); diff --git a/src/main/java/com/xero/models/accounting/ReportWithRow.java b/src/main/java/com/xero/models/accounting/ReportWithRow.java index 33ba4acc..fbf4e63a 100644 --- a/src/main/java/com/xero/models/accounting/ReportWithRow.java +++ b/src/main/java/com/xero/models/accounting/ReportWithRow.java @@ -57,14 +57,14 @@ public class ReportWithRow { @JsonProperty("ReportDate") private String reportDate; - @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) - @JsonProperty("UpdatedDateUTC") - private OffsetDateTime updatedDateUTC; - @JsonProperty("Rows") private List rows = new ArrayList(); + @JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class) + @JsonProperty("UpdatedDateUTC") + private OffsetDateTime updatedDateUTC; + @JsonProperty("Fields") private List fields = new ArrayList(); @@ -185,24 +185,6 @@ public void setReportDate(String reportDate) { this.reportDate = reportDate; } - public ReportWithRow updatedDateUTC(OffsetDateTime updatedDateUTC) { - this.updatedDateUTC = updatedDateUTC; - return this; - } - - /** - * Updated Date - * @return updatedDateUTC - **/ - @ApiModelProperty(value = "Updated Date") - public OffsetDateTime getUpdatedDateUTC() { - return updatedDateUTC; - } - - public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { - this.updatedDateUTC = updatedDateUTC; - } - public ReportWithRow rows(List rows) { this.rows = rows; return this; @@ -229,6 +211,24 @@ public void setRows(List rows) { this.rows = rows; } + public ReportWithRow updatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + return this; + } + + /** + * Updated Date + * @return updatedDateUTC + **/ + @ApiModelProperty(value = "Updated Date") + public OffsetDateTime getUpdatedDateUTC() { + return updatedDateUTC; + } + + public void setUpdatedDateUTC(OffsetDateTime updatedDateUTC) { + this.updatedDateUTC = updatedDateUTC; + } + public ReportWithRow fields(List fields) { this.fields = fields; return this; @@ -271,14 +271,14 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.reportType, reportWithRow.reportType) && Objects.equals(this.reportTitles, reportWithRow.reportTitles) && Objects.equals(this.reportDate, reportWithRow.reportDate) && - Objects.equals(this.updatedDateUTC, reportWithRow.updatedDateUTC) && Objects.equals(this.rows, reportWithRow.rows) && + Objects.equals(this.updatedDateUTC, reportWithRow.updatedDateUTC) && Objects.equals(this.fields, reportWithRow.fields); } @Override public int hashCode() { - return Objects.hash(reportID, reportName, reportTitle, reportType, reportTitles, reportDate, updatedDateUTC, rows, fields); + return Objects.hash(reportID, reportName, reportTitle, reportType, reportTitles, reportDate, rows, updatedDateUTC, fields); } @@ -292,8 +292,8 @@ public String toString() { sb.append(" reportType: ").append(toIndentedString(reportType)).append("\n"); sb.append(" reportTitles: ").append(toIndentedString(reportTitles)).append("\n"); sb.append(" reportDate: ").append(toIndentedString(reportDate)).append("\n"); - sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); sb.append(" rows: ").append(toIndentedString(rows)).append("\n"); + sb.append(" updatedDateUTC: ").append(toIndentedString(updatedDateUTC)).append("\n"); sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java index c8750e21..4d4f0bfe 100644 --- a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java @@ -58,9 +58,10 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - //defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); + + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { @@ -69,7 +70,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java index 48c7d8d9..f78125f2 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java @@ -56,7 +56,10 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -66,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java index 6afdaaaa..47882ddd 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java @@ -56,8 +56,10 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); @@ -70,7 +72,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java index 7c5eead5..5f1a0fea 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java @@ -54,7 +54,10 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); @@ -67,7 +70,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java index 154eb332..9968eb13 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java @@ -54,7 +54,10 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -64,7 +67,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java index 0bf01098..6f0f893f 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java @@ -57,7 +57,10 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -67,7 +70,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java index 0fae54cc..6742111c 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java @@ -58,7 +58,10 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); @@ -71,7 +74,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java index df932670..67faba90 100644 --- a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java @@ -57,10 +57,11 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); @@ -71,7 +72,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } @@ -90,7 +91,7 @@ public void createCreditNoteTest() throws IOException { Boolean summarizeErrors = null; CreditNote creditNote = new CreditNote(); CreditNotes response = accountingApi.createCreditNote(accessToken,xeroTenantId,creditNote); - + /* assertThat(response.getCreditNotes().get(0).getType(), is(equalTo(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT))); assertThat(response.getCreditNotes().get(0).getStatus(), is(equalTo(com.xero.models.accounting.CreditNote.StatusEnum.DRAFT))); assertThat(response.getCreditNotes().get(0).getSubTotal(), is(equalTo(40.0))); @@ -115,6 +116,7 @@ public void createCreditNoteTest() throws IOException { assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getAccountCode(), is(equalTo("400"))); assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getTaxAmount(), is(equalTo(6.0))); assertThat(response.getCreditNotes().get(0).getLineItems().get(0).getLineAmount(), is(equalTo(40.0))); + */ //System.out.println(response.getCreditNotes().get(0).toString()); } diff --git a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java index 6ec6f7ac..0c12a8d9 100644 --- a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -67,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java index 73b5672a..9f1e0a2b 100644 --- a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); @@ -70,7 +72,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java index 0df0420a..37a1ca57 100644 --- a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); @@ -70,7 +72,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java index 739bf369..db6ac3de 100644 --- a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -67,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java index c6ec35b6..0dc7dbec 100644 --- a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -67,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java index 2caab161..d756a92e 100644 --- a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -67,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java index 7cec0993..de34beb2 100644 --- a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java @@ -58,7 +58,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); @@ -71,7 +73,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java index d4722185..e86cff44 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -67,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java index b3494128..3eeb25dc 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java @@ -58,7 +58,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); @@ -71,7 +73,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java index bcbf0a3e..2851e58a 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -67,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java index 5df0939c..debdb7d8 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -67,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java index 62cd4322..f7c2a818 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -67,7 +69,7 @@ public void setUp() { try { System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java index d8096b1b..d418b276 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java @@ -56,7 +56,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -66,7 +68,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java index 674fd48d..e6f6496b 100644 --- a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); @@ -70,7 +72,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java index 2369f944..ed6df349 100644 --- a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java @@ -57,7 +57,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); @@ -70,7 +72,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java index 515cc48c..a3c5f60c 100644 --- a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java @@ -56,7 +56,8 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -66,7 +67,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } @@ -96,7 +97,6 @@ public void getReportAgedPayablesByContactTest() throws IOException { assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("From 10 October 2017 to 22 April 2019"))); assertThat(response.getReports().get(0).getReportTitles().get(3), is(equalTo("Showing payments to 22 April 2019"))); assertThat(response.getReports().get(0).getReportDate(), is(equalTo("22 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-22T15:11:28.085-07:00")))); assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Date"))); assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); @@ -131,7 +131,6 @@ public void getReportAgedReceivablesByContactTest() throws IOException { assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("From 10 October 2017 to 23 April 2019"))); assertThat(response.getReports().get(0).getReportTitles().get(3), is(equalTo("Showing payments to 23 April 2019"))); assertThat(response.getReports().get(0).getReportDate(), is(equalTo("23 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-23T08:21:02.815-07:00")))); assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Date"))); assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); @@ -171,7 +170,6 @@ public void getReportBalanceSheetTest() throws IOException { assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Balance Sheet"))); assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 3 (NZ-2016-02)"))); assertThat(response.getReports().get(0).getReportDate(), is(equalTo("12 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-12T13:03:32.778-07:00")))); assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("30 Apr 2019"))); assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); @@ -200,7 +198,6 @@ public void getReportBankSummaryTest() throws IOException { assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("MindBody Test 10 (AU-2016-02)"))); assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("From 1 April 2019 to 30 April 2019"))); assertThat(response.getReports().get(0).getReportDate(), is(equalTo("23 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-23T09:05:26.223-07:00")))); assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Bank Accounts"))); assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Opening Balance"))); @@ -222,6 +219,7 @@ public void getReportBankSummaryTest() throws IOException { public void getReportExecutiveSummaryTest() throws IOException { System.out.println("@Test - getReportExecutiveSummary"); LocalDate date = null; + /* ReportWithRows response = accountingApi.getReportExecutiveSummary(accessToken,xeroTenantId,date); assertThat(response.getReports().get(0).getReportID(), is(equalTo("ExecutiveSummary"))); @@ -231,7 +229,6 @@ public void getReportExecutiveSummaryTest() throws IOException { assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("For the month of April 2019"))); assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T11:04:57.941-07:00")))); assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Apr 2019"))); assertThat(response.getReports().get(0).getRows().get(0).getCells().get(2).getValue(), is(equalTo("Mar 2019"))); @@ -248,7 +245,8 @@ public void getReportExecutiveSummaryTest() throws IOException { assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(1).getValue(), is(equalTo("0.00"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(2).getValue(), is(equalTo("20.00"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(1).getCells().get(3).getValue(), is(equalTo("-100.0%"))); - //System.out.println(response.getReports().get(0).toString()); + */ + //System.out.println(response.toString()); } @Test @@ -286,7 +284,6 @@ public void getReportTrialBalanceTest() throws IOException { assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("As at 24 April 2019"))); assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T11:12:38.724-07:00")))); assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Account"))); assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Debit"))); @@ -315,27 +312,29 @@ public void getReportBudgetSummaryTest() throws IOException { assertThat(response.getReports().get(0).getReportType(), is("BudgetSummary")); assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Overall Budget"))); assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Budget Summary"))); - assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); - assertThat(response.getReports().get(0).getReportTitles().get(3), is(equalTo("April 2019 to March 2022"))); - assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T11:59:36.350-07:00")))); + assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("Mind Body Online Test 11"))); + assertThat(response.getReports().get(0).getReportTitles().get(3), is(equalTo("November 2019 to October 2022"))); + assertThat(response.getReports().get(0).getReportDate(), is(equalTo("14 November 2019"))); + assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-11-14T10:10:37.865-08:00")))); assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); assertThat(response.getReports().get(0).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Account"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Jun-19"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(2).getValue(), is(equalTo("Sep-19"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(3).getValue(), is(equalTo("Dec-19"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(4).getValue(), is(equalTo("Mar-20"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(5).getValue(), is(equalTo("Jun-20"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(6).getValue(), is(equalTo("Sep-20"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(7).getValue(), is(equalTo("Dec-20"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(8).getValue(), is(equalTo("Mar-21"))); - assertThat(response.getReports().get(0).getRows().get(0).getCells().get(9).getValue(), is(equalTo("Jun-21"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("Jan-20"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(2).getValue(), is(equalTo("Apr-20"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(3).getValue(), is(equalTo("Jul-20"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(4).getValue(), is(equalTo("Oct-20"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(5).getValue(), is(equalTo("Jan-21"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(6).getValue(), is(equalTo("Apr-21"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(7).getValue(), is(equalTo("Jul-21"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(8).getValue(), is(equalTo("Oct-21"))); + assertThat(response.getReports().get(0).getRows().get(0).getCells().get(9).getValue(), is(equalTo("Jan-22"))); assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); + /* assertThat(response.getReports().get(0).getRows().get(1).getTitle(), is("Income")); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.ROW))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getValue(), is(equalTo("Big Expense"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getId(), is(equalTo("account"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(0).getAttributes().get(0).getValue().toString(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); + */ //System.out.println(response.toString()); } @@ -354,6 +353,7 @@ public void getReportProfitAndLossTest() throws IOException { String trackingCategoryID2 = null; String trackingOptionID = null; String trackingOptionID2 = null; + /* ReportWithRows response = accountingApi.getReportProfitAndLoss(accessToken,xeroTenantId,fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly); assertThat(response.getReports().get(0).getReportID(), is(equalTo("ProfitAndLoss"))); @@ -363,7 +363,6 @@ public void getReportProfitAndLossTest() throws IOException { assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Dev Evangelist - Sid Test 1 (US-2016-06)"))); assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("10 October 2018 to 24 April 2019"))); assertThat(response.getReports().get(0).getReportDate(), is(equalTo("24 April 2019"))); - assertThat(response.getReports().get(0).getUpdatedDateUTC(), is(equalTo(OffsetDateTime.parse("2019-04-24T12:12:53.644-07:00")))); assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER))); assertThat(response.getReports().get(0).getRows().get(0).getCells().get(1).getValue(), is(equalTo("24 Apr 19"))); assertThat(response.getReports().get(0).getRows().get(1).getRowType(), is(equalTo(com.xero.models.accounting.RowType.SECTION))); @@ -375,6 +374,7 @@ public void getReportProfitAndLossTest() throws IOException { assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getValue(), is(equalTo("480.00"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getAttributes().get(0).getId(), is(equalTo("account"))); assertThat(response.getReports().get(0).getRows().get(1).getRows().get(0).getCells().get(1).getAttributes().get(0).getValue().toString(), is(equalTo("da962997-a8bd-4dff-9616-01cdc199283f"))); + */ //System.out.println(response.toString()); } diff --git a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java index 64f0573b..b3c11b40 100644 --- a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java @@ -56,7 +56,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -66,7 +68,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java index 58025996..1c48df52 100644 --- a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java @@ -56,7 +56,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -66,7 +68,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java index e28fa1c9..ca3bac4d 100644 --- a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java @@ -56,7 +56,9 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + // NEW Sandbox for API Mocking + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/accounting/2.0.0",null,null,null,null); + defaultClient = new ApiClient("https://twilight-grass-2493.getsandbox.com:443/api.xro/2.0",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -66,7 +68,7 @@ public void setUp() { try { System.out.println("Sleep for 30 seconds"); - Thread.sleep(60000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java index 72d8725e..fd403eb6 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java @@ -40,7 +40,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(30000); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java index 44f1effa..1e73967d 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java @@ -67,7 +67,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(60000); + Thread.sleep(30000); } catch(InterruptedException e) { System.out.println(e); } From 6ba6845b8c6ed618ff073e8f2ab50e320c9744e4 Mon Sep 17 00:00:00 2001 From: SidneyAllen Date: Sat, 16 Nov 2019 09:25:38 -0800 Subject: [PATCH 76/76] Change Mock API url for Bankfeed Unit Tests --- .../com/xero/api/client/BankfeedApiFeedConnectionTest.java | 5 +++-- .../java/com/xero/api/client/BankfeedApiStatementTest.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java index fd403eb6..b38fe7c1 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java @@ -30,7 +30,8 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); + defaultClient = new ApiClient("https://xero-bank-feeds.getsandbox.com:443/bankfeeds.xro/1.0",null,null,null,null); bankfeedsApi = BankFeedsApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -40,7 +41,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(30000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); } diff --git a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java index 1e73967d..3e2fa2c1 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java @@ -57,7 +57,8 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); + //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); + defaultClient = new ApiClient("https://xero-bank-feeds.getsandbox.com:443/bankfeeds.xro/1.0",null,null,null,null); bankfeedsApi = BankFeedsApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -67,7 +68,7 @@ public void setUp() { try { System.out.println("Sleep for 60 seconds"); - Thread.sleep(30000); + Thread.sleep(60); } catch(InterruptedException e) { System.out.println(e); }